@mxtommy/kip
Version:
An advanced and versatile marine instrumentation package to display Signal K data.
2 lines (1 loc) • 9.57 kB
JavaScript
import{a as X}from"./chunk-C23GLDFH.js";import{a as B,b as q,c as U,d as J,e as K}from"./chunk-JMZYPL54.js";import{c as z,e as O}from"./chunk-VFJD3XKT.js";import{a as G,b as W}from"./chunk-HF7V6XFA.js";import{$b as A,Ba as H,Bb as x,Cb as M,Cc as g,Db as d,Eb as a,Fb as r,Ga as T,Gb as k,Gd as D,Ha as S,Nb as C,Pb as c,Rb as l,Re as N,Te as Q,Ue as j,Wa as p,ac as $,ec as s,ee as P,fc as F,gb as I,gc as b,ie as L,le as R,mb as V,qa as w,va as f,wa as h,xb as _,yb as u,z as E}from"./chunk-LEY6MANN.js";var Y=(t,o)=>o.title,Z=(t,o)=>o.file;function ee(t,o){t&1&&s(0," Loading... ")}function te(t,o){t&1&&s(0," Table of Content ")}function ne(t,o){t&1&&(a(0,"button",12),s(1,"Error loading menu"),r())}function ie(t,o){t&1&&(a(0,"button",12),s(1,"No help entries"),r())}function oe(t,o){if(t&1){let e=C();a(0,"button",15),c("click",function(){let i=f(e).$implicit,m=l(5);return h(m.selectFile(i.file))}),s(1),r()}if(t&2){let e=o.$implicit,n=l(5);d("disabled",n.selectedFile()===e.file),p(),b(" ",e.title," ")}}function ae(t,o){if(t&1&&(a(0,"button",14),s(1),r(),x(2,oe,2,2,"button",13,Z)),t&2){let e=l().$implicit;p(),F(e.title),p(),M(e.items)}}function le(t,o){if(t&1){let e=C();a(0,"button",15),c("click",function(){f(e);let i=l().$implicit,m=l(3);return h(m.selectFile(i.file))}),s(1),r()}if(t&2){let e=l().$implicit,n=l(3);d("disabled",n.selectedFile()===e.file),p(),b(" ",e.title," ")}}function re(t,o){if(t&1&&_(0,ae,4,1)(1,le,2,2,"button",13),t&2){let e=o.$implicit,n=l(3);u(n.isGroup(e)?0:1)}}function me(t,o){if(t&1&&x(0,re,2,1,null,null,Y),t&2){let e=l(2);M(e.helpMenuItems())}}function pe(t,o){if(t&1){let e=C();a(0,"button",15),c("click",function(){let i=f(e).$implicit,m=l(5);return h(m.selectFile(i.file))}),s(1),r()}if(t&2){let e=o.$implicit,n=l(5);d("disabled",n.selectedFile()===e.file),p(),b(" ",e.title," ")}}function se(t,o){if(t&1&&(a(0,"button",16),s(1),r(),a(2,"mat-menu",17,1),x(4,pe,2,2,"button",13,Z),r()),t&2){let e=A(3),n=l().$implicit;d("matMenuTriggerFor",e),p(),F(n.title),p(),d("overlapTrigger",!1),p(2),M(n.items)}}function de(t,o){if(t&1){let e=C();a(0,"button",15),c("click",function(){f(e);let i=l().$implicit,m=l(3);return h(m.selectFile(i.file))}),s(1),r()}if(t&2){let e=l().$implicit,n=l(3);d("disabled",n.selectedFile()===e.file),p(),b(" ",e.title," ")}}function ce(t,o){if(t&1&&_(0,se,6,3)(1,de,2,2,"button",13),t&2){let e=o.$implicit,n=l(3);u(n.isGroup(e)?0:1)}}function _e(t,o){if(t&1&&x(0,ce,2,1,null,null,Y),t&2){let e=l(2);M(e.helpMenuItems())}}function ue(t,o){if(t&1&&_(0,ne,2,0,"button",12)(1,ie,2,0,"button",12)(2,me,2,0)(3,_e,2,0),t&2){let e=l();u(e.hasError()?0:!e.isLoading()&&e.helpFiles().length===0?1:e.isMobileMenuMode()?2:3)}}function ge(t,o){t&1&&(a(0,"div",11),s(1,"Unable to load help content."),r())}function fe(t,o){t&1&&(a(0,"div",11),s(1,"Loading help..."),r())}function he(t,o){if(t&1&&(a(0,"div",11),k(1,"markdown",18),r()),t&2){let e=l();p(),d("src",`assets/help-docs/${e.selectedFile()}`)}}var $e=(()=>{class t{pageTitle="Help";_router=w(O);_route=w(z);_destroyRef=w(H);_isMobileMenuMode=T(this.detectMobileMenuMode());_selectedPageFromRoute=N(this._route.paramMap.pipe(E(e=>e.get("page"))),{initialValue:null});constructor(){let e=this.getMobileMenuMediaQuery();if(e===null)return;this._isMobileMenuMode.set(e.matches);let n=i=>{this._isMobileMenuMode.set(i.matches)};e.addEventListener("change",n),this._destroyRef.onDestroy(()=>{e.removeEventListener("change",n)})}_helpMenuRes=D(()=>"assets/help-docs/menu.json");helpMenuItems=g(()=>this._helpMenuRes.hasValue()?this.normalizeMenu(this._helpMenuRes.value()??[]):[]);helpFiles=g(()=>{let e=this.helpMenuItems();return e.length===0?[]:e.flatMap(n=>this.isGroup(n)?n.items:[n])});selectedFile=T("");_syncEffect=S(()=>{let e=this.helpFiles(),n=this._selectedPageFromRoute();if(e.length===0)return;let i=this.resolveSelectedFile(n,e);this.selectedFile()!==i&&this.selectedFile.set(i)});hasError=g(()=>this._helpMenuRes.error()!=null);isLoading=g(()=>this._helpMenuRes.isLoading());isMobileMenuMode=g(()=>this._isMobileMenuMode());isGroup(e){return"items"in e}selectFile(e){this.selectedFile.set(e),this._router.navigate(["/help",this.toPageSegment(e)])}backPage(){this._router.navigate(["/settings"])}closePage(){this._router.navigate(["/dashboard"])}resolveSelectedFile(e,n){if(e){let i=e.endsWith(".md")?e:`${e}.md`,m=n.find(v=>v.file===i);if(m)return m.file}return n[0].file}toPageSegment(e){return e.endsWith(".md")?e.slice(0,-3):e}normalizeMenu(e){let n=[];return e.forEach(i=>{let m=(i.title??"").trim();if(Array.isArray(i.items)){let v=i.items.filter(this.isValidLeaf).filter(y=>y.file.endsWith(".md")).map(y=>({title:y.title.trim(),file:y.file.trim()}));if(!m||v.length===0)return;n.push({title:m,items:v});return}this.isValidLeaf(i)&&i.file.endsWith(".md")&&n.push({title:i.title.trim(),file:i.file.trim()})}),n}isValidLeaf(e){return typeof e.title=="string"&&e.title.trim().length>0&&typeof e.file=="string"&&e.file.trim().length>0}detectMobileMenuMode(){return this.getMobileMenuMediaQuery()?.matches??!1}getMobileMenuMediaQuery(){return typeof window>"u"||typeof window.matchMedia!="function"?null:window.matchMedia("(max-width: 900px), (hover: none) and (pointer: coarse)")}static \u0275fac=function(n){return new(n||t)};static \u0275cmp=I({type:t,selectors:[["app-help"]],decls:22,vars:9,consts:[["helpMenu","matMenu"],["childMenu","matMenu"],[1,"fullpage-header"],[1,"page-icon"],["svgIcon","help-center","aria-hidden","false"],[1,"page-title"],["mat-flat-button","",3,"matMenuTriggerFor","disabled"],[1,"help-menu-panel"],["matMenuContent",""],[1,"dialog-close-icon"],["mat-icon-button","",3,"click"],[1,"markdown-content"],["mat-menu-item","","disabled",""],["mat-menu-item","",3,"disabled"],["mat-menu-item","","disabled","",1,"help-menu-group-title"],["mat-menu-item","",3,"click","disabled"],["mat-menu-item","",3,"matMenuTriggerFor"],[1,"help-menu-panel",3,"overlapTrigger"],["clipboard","",3,"src"]],template:function(n,i){if(n&1&&(a(0,"div",2)(1,"div",3),k(2,"mat-icon",4),a(3,"h6",5),s(4),r()(),a(5,"button",6),_(6,ee,1,0)(7,te,1,0),r(),a(8,"mat-menu",7,0),V(10,ue,4,1,"ng-template",8),r(),a(11,"div",9)(12,"button",10),c("click",function(){return i.backPage()}),a(13,"mat-icon"),s(14,"arrow_back_ios"),r()(),a(15,"button",10),c("click",function(){return i.closePage()}),a(16,"mat-icon"),s(17,"close"),r()()()(),k(18,"mat-divider"),_(19,ge,2,0,"div",11)(20,fe,2,0,"div",11)(21,he,2,1,"div",11)),n&2){let m=A(9);p(2),$("width",24,"px")("height",24,"px"),p(2),F(i.pageTitle),p(),d("matMenuTriggerFor",m)("disabled",i.isLoading()||i.hasError()||i.helpFiles().length===0),p(),u(i.isLoading()?6:7),p(13),u(i.hasError()?19:i.isLoading()&&i.helpFiles().length===0?20:i.selectedFile()?21:-1)}},dependencies:[X,R,L,P,K,U,B,q,J,W,G,j,Q],styles:[".fullpage-header[_ngcontent-%COMP%]{display:flex;justify-content:space-between;align-items:center}.page-icon[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:nowrap;justify-content:flex-start;align-items:center;margin-left:15px}.page-title[_ngcontent-%COMP%]{margin-block-start:0px;margin-block-end:0px;padding:18px 0 13px 5px;color:var(--mat-dialog-subhead-color, var(--mat-sys-on-surface, rgba(0, 0, 0, .87)));font-family:var(--mat-dialog-subhead-font, var(--mat-sys-headline-small-font, inherit));line-height:var(--mat-dialog-subhead-line-height, var(--mat-sys-headline-small-line-height, 1.5rem));font-size:var(--mat-dialog-subhead-size, var(--mat-sys-headline-small-size, 1rem));font-weight:var(--mat-dialog-subhead-weight, var(--mat-sys-headline-small-weight, 400));letter-spacing:var(--mat-dialog-subhead-tracking, var(--mat-sys-headline-small-tracking, .03125em))}.mat-mdc-dialog-content[_ngcontent-%COMP%]{max-height:max-content}.dialog-close-icon[_ngcontent-%COMP%]{display:flex;flex-direction:row;flex-wrap:nowrap;gap:5px;padding-right:15px}.help-menu-group-title[_ngcontent-%COMP%]{font-weight:600;opacity:.9} .mat-mdc-menu-panel.help-menu-panel{border:1px solid var(--mat-sys-outline);background:var(--mat-sys-surface-container-high)} .markdown-content{display:block;height:calc(100% - 75px);width:100%;overflow-x:scroll;padding:25px;font-size:1.1rem;line-height:1.7;background:var(--mat-sys-surface-container, #fff);color:var(--mat-sys-on-surface, #222);border-radius:12px;box-shadow:0 2px 8px #00000012;max-width:900px;margin:0 auto} .markdown-content h1, .markdown-content h2, .markdown-content h3, .markdown-content h4{color:var(--mat-sys-primary, #1976d2);margin-top:1.5em;margin-bottom:.5em;font-weight:600} .markdown-content pre{padding:1em;overflow-x:auto} .markdown-content table{border:1px solid var(--mat-sys-on-background);border-collapse:collapse;width:100%;margin:1em 0} .markdown-content table td{border:1px solid var(--mat-sys-on-background);padding:8px;text-align:left} .markdown-content th{color:var(--mat-sys-primary, #1976d2);font-weight:600;padding:.5em 1em;border:2px solid var(--mat-sys-primary, #1976d2);text-align:left} .markdown-content table tr:nth-child(2n){background-color:var(--mat-sys-surface-container-high)} .markdown-content a{color:var(--mat-sys-primary, #1976d2);text-decoration:underline} .markdown-content a:hover{text-decoration:none;color:var(--mat-sys-secondary, #005fa3)} .markdown-content ul, .markdown-content ol{margin-left:2em;margin-bottom:1em} .markdown-content blockquote{border-left:4px solid var(--mat-sys-tertiary);background:var(--mat-sys-on-tertiary-fixed-variant);padding:.5em 1em;color:var(--mat-sys-on-surface-variant, #555);margin:1em 0}"]})}return t})();export{$e as AppHelpComponent};