{"version":3,"sources":["Navigator.tsx"],"sourcesContent":["import { Datex } from \"unyt_core/datex.ts\";\nimport { Component } from \"uix/components/Component.ts\";\nimport { template } from \"uix/html/template.ts\";\nimport { Icon } from \"./Icon.tsx\";\nimport { content, include } from \"uix/base/decorators.ts\";\n\n@template(function() {\n\treturn <>\n\t\t<a id=\"navigatorTitle\" href='/' class=\"navigation active\">\n\t\t\t{this.$.navigation}\n\t\t</a>\n\t\t<Icon id=\"expandButton\" name=\"fa-chevron-down\"/>\n\t\t<div id=\"body\"/>\n\t</>\n})\nexport class Navigator extends Component {\n\t@id navigatorTitle!: HTMLAnchorElement;\n\t@id expandButton!: HTMLDivElement;\n\t@id body!: HTMLDivElement;\n\t\n\tprivate isCollapsed = true;\n\t@include links!: {name: string, link: string}[]\n\t@include strings!: Record<string, Datex.RefOrValue<string>>\n\n\t@property navigation: string = '';\n\n\tpublic onRefresh() {}\n\n\n\tprivate createLinks() {\n\t\tthis.links.forEach(item => {\n\t\t\tthis.body.append(\n\t\t\t\t<a data-ref={item.link} class=\"navigation\" href={`#${item.link}`} onclick={()=>{this.onCollapse();this.onSection?.(item.link)}}>{item.name}</a>\n\t\t\t)\n\t\t});\n\n\t\tthis.body.append(\n\t\t\t<div class=\"buttons\">\n\t\t\t\t<a href=\"https://unyt.org/beta\">\n\t\t\t\t\t{this.strings.buttonBeta} <Icon name=\"fa-chevron-right\"/>\n\t\t\t\t</a>\n\t\t\t\t<a href=\"mailto:hello@unyt.org\">\n\t\t\t\t\t{this.strings.buttonContact} <Icon name=\"fa-chevron-right\"/>\n\t\t\t\t</a>\n\t\t\t</div>\n\t\t)\n\t}\n\n\tpublic stop(): void {\n\t\tthis.classList.add(\"hidden\");\n\t}\n\t\n\tpublic start(identifier: string): void {\n\t\tconst name = this.links.find(e => e.link === `${identifier.replace(\"#\", '')}`)?.name;\n\t\tthis.navigatorTitle.setAttribute(\"href\", `${identifier}`);\n\t\t//@ts-ignore $\n\t\tthis.navigation = val(name);\n\t\tthis.classList.remove(\"hidden\");\n\n\t\tthis.body.querySelectorAll(`a[data-ref]`).forEach(e => e.classList.remove(\"hidden\"));\n\t\tthis.body.querySelector(`a[data-ref='${identifier.replace(\"#\", '')}']`)?.classList.add(\"hidden\");\n\t}\n\n\tprivate onExpand() {\n\t\tthis.expandButton.classList.remove(\"fa-chevron-down\");\n\t\tthis.expandButton.classList.add(\"fa-times\");\n\t\tthis.body.classList.add(\"active\");\n\t}\n\tprivate onCollapse() {\n\t\tthis.expandButton.classList.remove(\"fa-times\");\n\t\tthis.expandButton.classList.add(\"fa-chevron-down\");\n\t\tthis.body.classList.remove(\"active\");\n\t}\n\n\n\t// only workaround for routing - must be fixed at some point\n\tpublic onSection?:(section:string)=>void\n\n\tprotected override onCreateLayout(){\n\t\tthis.stop()\n\t}\n\n\toverride onCreate() {\n\t\tthis.navigatorTitle.onclick = () => {\n\t\t\tthis.onCollapse();\n\t\t\tthis.onRefresh();\n\t\t}\n\t\tthis.expandButton.onclick = () => {\n\t\t\tthis.isCollapsed = !this.isCollapsed;\n\t\t\tif (this.isCollapsed)\t\n\t\t\t\tthis.onCollapse();\n\t\t\telse this.onExpand();\n\t\t}\n\t\tthis.createLinks();\n\t}\n}\n"],"names":["Component","navigatorTitle","expandButton","body","links","strings","navigation","template","Icon","include","a","id","href","class","$","name","div","Navigator","property","isCollapsed","onRefresh","createLinks","forEach","item","append","data-ref","link","onclick","onCollapse","onSection","buttonBeta","buttonContact","stop","classList","add","start","identifier","find","e","replace","setAttribute","val","remove","querySelectorAll","querySelector","onExpand","onCreateLayout","onCreate"],"mappings":"sBAe+BA,YAC9B,AAAIC,sBACJ,AAAIC,oBACJ,AAAIC,YAGJ,AAASC,aACT,AAASC,eAET,AAAUC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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