UNPKG

@anjuna/docs

Version:

Anjuna Documentation Web Components

1 lines 8.83 kB
import{h}from"../anjuna-docs.core.js";var ApiName=function(){function e(){}return Object.defineProperty(e,"is",{get:function(){return"ad-api-name"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return"ad-api-name:after{color:var(--anj-secondary-dark);content:\":\";margin-right:.5rem}"},enumerable:!0,configurable:!0}),e}(),ArgDef=function(){function e(){}return e.prototype.render=function(){return[h("ad-api-name",null,this.arg.name),h("ad-type-def",null,this.arg.type)]},Object.defineProperty(e,"is",{get:function(){return"ad-arg-def"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"properties",{get:function(){return{arg:{type:"Any",attr:"arg"}}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return"ad-arg-def:after{color:var(--anj-secondary-dark);content:\",\";margin-right:.5rem}ad-arg-def:last-child:after{content:none;margin-right:0}"},enumerable:!0,configurable:!0}),e}(),Decorator=function(){function e(){}return Object.defineProperty(e,"is",{get:function(){return"ad-decorator"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return"ad-decorator{color:var(--anj-secondary-dark)}.api.ng ad-method-def ad-decorator,.api.ng ad-prop-def ad-decorator{display:none}"},enumerable:!0,configurable:!0}),e}(),EventDef=function(){function e(){}return e.prototype.render=function(){return[h("h4",null,h("ad-decorator",null,"@Event")," ",h("ad-api-name",null,this.event.event)),h("p",null,this.event.docs)]},Object.defineProperty(e,"is",{get:function(){return"ad-event-def"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"properties",{get:function(){return{event:{type:"Any",attr:"event"}}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){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}"},enumerable:!0,configurable:!0}),e}(),InputDef=function(){function e(){}return e.prototype.render=function(){return[h("h4",null,h("ad-decorator",null,"@Input "),h("ad-api-name",null,this.input.name),h("ad-type-def",null,this.input.type)),h("p",null,this.input.docs)]},Object.defineProperty(e,"is",{get:function(){return"ad-input-def"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"properties",{get:function(){return{input:{type:"Any",attr:"input"}}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){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}"},enumerable:!0,configurable:!0}),e}(),MethodDef=function(){function e(){}return e.prototype.nameless=function(e){return"("+e.split("(")[1]},e.prototype.render=function(){return[h("h4",null,h("ad-decorator",null,"@Method "),h("ad-api-name",null,this.method.name),h("ad-type-def",null,this.nameless(this.method.signature))),h("p",null,this.method.docs)]},Object.defineProperty(e,"is",{get:function(){return"ad-method-def"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"properties",{get:function(){return{method:{type:"Any",attr:"method"}}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){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}"},enumerable:!0,configurable:!0}),e}(),OutputDef=function(){function e(){}return e.prototype.render=function(){return[h("h4",null,h("ad-decorator",null,"@Output "),h("ad-api-name",null,this.output.name),h("ad-type-def",null,this.output.type)),h("p",null,this.output.docs)]},Object.defineProperty(e,"is",{get:function(){return"ad-output-def"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"properties",{get:function(){return{output:{type:"Any",attr:"output"}}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){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}"},enumerable:!0,configurable:!0}),e}(),PropDef=function(){function e(){}return e.prototype.render=function(){return[h("h4",null,h("ad-decorator",null,"@Prop "),h("ad-api-name",null,this.prop.name),h("ad-type-def",null,this.prop.type)),h("p",null,this.prop.docs)]},Object.defineProperty(e,"is",{get:function(){return"ad-prop-def"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"properties",{get:function(){return{prop:{type:"Any",attr:"prop"}}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){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}"},enumerable:!0,configurable:!0}),e}(),RealTime=function(){function e(){}return Object.defineProperty(e,"is",{get:function(){return"ad-real-time"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){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%}"},enumerable:!0,configurable:!0}),e}(),Toc=function(){function e(){this.activeId="#overview",this.docs={}}return e.prototype.onDemosChange=function(){this.sectionIds=["#overview"].concat(this.demos.map(function(e){return"#"+e.usage})).concat("#api")},e.prototype.componentDidLoad=function(){this.navigate=debounce(this.navigate.bind(this),50),this.onScroll=debounce(this.onScroll.bind(this),10),this.onDemosChange(),window.location.hash&&this.navigate()},e.prototype.onScroll=function(){var e=this.sectionIds.map(function(e){return document.querySelector(e)}),t=e[0];e.slice(1).forEach(function(e){e&&Math.abs(window.scrollY-e.offsetTop)<Math.abs(window.scrollY-t.offsetTop)&&(t=e)}),this.activeId="#"+t.getAttribute("id")},e.prototype.parseTitle=function(e){var t=e.replace("#",""),n=this.docs[t];return n?n.split(/##(.*?)\n/).find(function(e){return""!==e}).trim():t},e.prototype.anchorClass=function(e){return e===this.activeId?"anj-active":""},e.prototype.navigate=function(){var e=this;return new Promise(function(t){window.setTimeout(function(){e.activeId=window.location.hash;var n=document.querySelector(e.activeId);window.scrollTo(0,n.offsetTop),t()},500)})},e.prototype.render=function(){var e=this;if(this.sectionIds){var t=window.location.pathname;return h("div",{class:"anj-toc"},this.sectionIds.map(function(n){return h("a",{href:""+t+n,onClick:function(){return e.activeId=n},class:e.anchorClass(n)},e.parseTitle(n))}))}},Object.defineProperty(e,"is",{get:function(){return"ad-toc"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"properties",{get:function(){return{activeId:{state:!0},demos:{type:"Any",attr:"demos",watchCallbacks:["onDemosChange"]},docs:{type:"Any",attr:"docs"},sectionIds:{state:!0}}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"listeners",{get:function(){return[{name:"window:scroll",method:"onScroll",passive:!0}]},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){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.anj-active,ad-toc a.anj-active:hover{color:var(--anj-primary);text-decoration:none}"},enumerable:!0,configurable:!0}),e}(),debounce=function(e,t){var n;return void 0===t&&(t=0),function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];clearTimeout(n),n=setTimeout.apply(void 0,[e,t].concat(r))}},TypeDef=function(){function e(){}return Object.defineProperty(e,"is",{get:function(){return"ad-type-def"},enumerable:!0,configurable:!0}),Object.defineProperty(e,"style",{get:function(){return"ad-type-def{color:var(--anj-neutral);font-size:.75rem}"},enumerable:!0,configurable:!0}),e}();export{ApiName as AdApiName,ArgDef as AdArgDef,Decorator as AdDecorator,EventDef as AdEventDef,InputDef as AdInputDef,MethodDef as AdMethodDef,OutputDef as AdOutputDef,PropDef as AdPropDef,RealTime as AdRealTime,Toc as AdToc,TypeDef as AdTypeDef};