UNPKG

7.52 kBJavaScriptView Raw
1import{r as t,h as s}from"./p-8c721f74.js";const e=["inputs","outputs","props","events","methods"],r=class{constructor(s){t(this,s)}hasApi(){if(!this.doc)return!1;for(const t of e)if(this.doc[t]&&this.doc[t].length>0)return!0}angular(){return[this.doc.inputs?this.doc.inputs.map(t=>s("ad-input-def",{input:t})):void 0,this.doc.outputs?this.doc.outputs.map(t=>s("ad-output-def",{output:t})):void 0,this.doc.props?this.doc.props.map(t=>s("ad-prop-def",{prop:t})):void 0]}stencil(){return[this.doc.props?this.doc.props.map(t=>s("ad-prop-def",{prop:t})):void 0,this.doc.events?this.doc.events.map(t=>s("ad-event-def",{event:t})):void 0]}render(){if(!this.hasApi())return;const t=!this.doc.tag;return s("article",{id:"api",class:"api"},s("h2",null,"API"),t?this.angular():this.stencil(),this.doc.methods?this.doc.methods.map(t=>s("ad-method-def",{method:t})):void 0)}static get style(){return".sc-ad-api-h{display:block;font-size:.875rem;font-family:var(--anj-font-family);font-weight:400;line-height:1.5;outline:none}.sc-ad-api-h, .sc-ad-api-h:after, .sc-ad-api-h:before{-webkit-box-sizing:border-box;box-sizing:border-box;outline:none}.sc-ad-api-h:active, .sc-ad-api-h .sc-ad-api:active, .sc-ad-api-h:focus, .sc-ad-api-h .sc-ad-api:focus{outline:none}.sc-ad-api-h .api.sc-ad-api{border-bottom:1px solid var(--anj-border);margin-bottom:3rem;padding-bottom:3rem}.sc-ad-api-h .api.sc-ad-api h2.sc-ad-api{margin-bottom:1.5rem}"}},a=class{constructor(s){t(this,s)}static get style(){return"ad-api-name{display:inline;font-size:.875rem;font-family:var(--anj-font-family);font-weight:400;line-height:1.5;outline:none}ad-api-name,ad-api-name:after,ad-api-name:before{-webkit-box-sizing:border-box;box-sizing:border-box;outline:none}ad-api-name:active,ad-api-name :active,ad-api-name:focus,ad-api-name :focus{outline:none}ad-api-name:after{color:var(--anj-secondary-dark);content:\":\";margin-right:.5rem}"}},i=class{constructor(s){t(this,s)}render(){return[s("ad-api-name",null,this.arg.name),s("ad-type-def",null,this.arg.type)]}static get style(){return"ad-arg-def{display:inline;font-size:.875rem;font-family:var(--anj-font-family);font-weight:400;line-height:1.5;outline:none}ad-arg-def,ad-arg-def:after,ad-arg-def:before{-webkit-box-sizing:border-box;box-sizing:border-box;outline:none}ad-arg-def:active,ad-arg-def :active,ad-arg-def:focus,ad-arg-def :focus{outline:none}ad-arg-def:after{color:var(--anj-secondary-dark);content:\",\";margin-right:.5rem}ad-arg-def:last-child:after{content:none;margin-right:0}"}},n=class{constructor(s){t(this,s)}static get style(){return"ad-decorator{color:var(--anj-secondary-dark)}.api.ng ad-method-def ad-decorator,.api.ng ad-prop-def ad-decorator{display:none}"}},d=class{constructor(s){t(this,s)}render(){return[s("h4",null,s("ad-decorator",null,"@Event")," ",s("ad-api-name",null,this.event.event),s("ad-type-def",null,"<",this.event.detail,">")),s("p",null,this.event.docs)]}static get style(){return"ad-event-def,ad-input-def,ad-method-def,ad-output-def,ad-prop-def{display:block;margin-bottom:1.5rem}ad-event-def h4,ad-input-def h4,ad-method-def h4,ad-output-def h4,ad-prop-def h4{color:var(--anj-dark);font-size:1rem;font-weight:400;margin:0 0 .5rem;padding:0}"}},o=class{constructor(s){t(this,s)}render(){return[s("h4",null,s("ad-decorator",null,"@Input "),s("ad-api-name",null,this.input.name),s("ad-type-def",null,this.input.type)),s("p",null,this.input.docs)]}static get style(){return"ad-event-def,ad-input-def,ad-method-def,ad-output-def,ad-prop-def{display:block;margin-bottom:1.5rem}ad-event-def h4,ad-input-def h4,ad-method-def h4,ad-output-def h4,ad-prop-def h4{color:var(--anj-dark);font-size:1rem;font-weight:400;margin:0 0 .5rem;padding:0}"}},l=class{constructor(s){t(this,s)}nameless(t){return`(${t.split("(")[1]}`}render(){return[s("h4",null,s("ad-decorator",null,"@Method "),s("ad-api-name",null,this.method.name),s("ad-type-def",null,this.nameless(this.method.signature))),s("p",null,this.method.docs)]}static get style(){return"ad-event-def,ad-input-def,ad-method-def,ad-output-def,ad-prop-def{display:block;margin-bottom:1.5rem}ad-event-def h4,ad-input-def h4,ad-method-def h4,ad-output-def h4,ad-prop-def h4{color:var(--anj-dark);font-size:1rem;font-weight:400;margin:0 0 .5rem;padding:0}"}},u=class{constructor(s){t(this,s)}render(){return[s("h4",null,s("ad-decorator",null,"@Output "),s("ad-api-name",null,this.output.name),s("ad-type-def",null,this.output.type)),s("p",null,this.output.docs)]}static get style(){return"ad-event-def,ad-input-def,ad-method-def,ad-output-def,ad-prop-def{display:block;margin-bottom:1.5rem}ad-event-def h4,ad-input-def h4,ad-method-def h4,ad-output-def h4,ad-prop-def h4{color:var(--anj-dark);font-size:1rem;font-weight:400;margin:0 0 .5rem;padding:0}"}},h=class{constructor(s){t(this,s)}render(){return[s("h4",null,s("ad-decorator",null,"@Prop "),s("ad-api-name",null,this.prop.name),s("ad-type-def",null,this.prop.type)),s("p",null,this.prop.docs)]}static get style(){return"ad-event-def,ad-input-def,ad-method-def,ad-output-def,ad-prop-def{display:block;margin-bottom:1.5rem}ad-event-def h4,ad-input-def h4,ad-method-def h4,ad-output-def h4,ad-prop-def h4{color:var(--anj-dark);font-size:1rem;font-weight:400;margin:0 0 .5rem;padding:0}"}},c=class{constructor(s){t(this,s)}static get style(){return"ad-real-time{border:1px dashed var(--anj-border);border-radius:.25rem;display:block;margin-top:1.5rem;overflow-x:auto;padding:1rem;width:100%}"}},p=class{constructor(s){t(this,s),this.activeId="#overview",this.docs={},this.keys=[]}onDemosChange(){this.sectionIds=["#overview"].concat(this.keys.map(t=>`#${t}`)).concat("#api")}connectedCallback(){this.navigate=E(this.navigate.bind(this),100),this.onScroll=E(this.onScroll.bind(this),25),this.onDemosChange(),window.location.hash&&this.navigate()}onScroll(){const t=this.sectionIds.map(t=>document.querySelector(t));let s=t[0];t.slice(1).forEach(t=>{t&&Math.abs(window.scrollY-t.offsetTop)<Math.abs(window.scrollY-s.offsetTop)&&(s=t)}),this.activeId=`#${s.getAttribute("id")}`}parseTitle(t){const s=t.replace("#",""),e=this.docs[s];return e?e.split(/##(.*?)\n/).find(t=>""!==t).trim():s}anchorClass(t){return t===this.activeId?"anj-active":""}navigate(){return new Promise(t=>{window.setTimeout(()=>{this.activeId=window.location.hash;const s=document.querySelector(this.activeId);s&&window.scrollTo(0,s.offsetTop),t()},500)})}render(){if(!this.sectionIds)return;const t=window.location.pathname;return s("div",{class:"anj-toc"},this.sectionIds.map(e=>s("a",{href:`${t}${e}`,onClick:()=>this.activeId=e,class:this.anchorClass(e)},this.parseTitle(e))))}static get watchers(){return{keys:["onDemosChange"]}}static get style(){return"ad-toc{display:block;position:relative}ad-toc .anj-toc{padding:1rem 0;position:fixed;top:3rem}ad-toc a{display:block;font-size:.75rem;margin-bottom:.5rem;text-transform:capitalize;-webkit-transition:color .2s ease;transition:color .2s ease}ad-toc a:focus{text-decoration:underline}ad-toc a:active{text-decoration:none}ad-toc a.anj-active,ad-toc a.anj-active:focus,ad-toc a.anj-active:hover{color:var(--anj-primary);text-decoration:none}"}},E=(t,s=0)=>{let e;return(...r)=>{clearTimeout(e),e=setTimeout(t,s,...r)}},_=class{constructor(s){t(this,s)}static get style(){return"ad-type-def{color:var(--anj-neutral-dark);font-size:.75rem}"}};export{r as ad_api,a as ad_api_name,i as ad_arg_def,n as ad_decorator,d as ad_event_def,o as ad_input_def,l as ad_method_def,u as ad_output_def,h as ad_prop_def,c as ad_real_time,p as ad_toc,_ as ad_type_def};
\No newline at end of file