diff --git a/assets/index-4YoSXlt2.js b/assets/index-4YoSXlt2.js new file mode 100644 index 0000000..7060771 --- /dev/null +++ b/assets/index-4YoSXlt2.js @@ -0,0 +1,31 @@ +var ae=(n,e,t)=>{if(!e.has(n))throw TypeError("Cannot "+t)};var ce=(n,e,t)=>(ae(n,e,"read from private field"),t?t.call(n):e.get(n)),he=(n,e,t)=>{if(e.has(n))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(n):e.set(n,t)},X=(n,e,t,r)=>(ae(n,e,"write to private field"),r?r.call(n,t):e.set(n,t),t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();/** + * @license + * Copyright 2019 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const F=globalThis,re=F.ShadowRoot&&(F.ShadyCSS===void 0||F.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ne=Symbol(),le=new WeakMap;let Ee=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==ne)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(re&&e===void 0){const r=t!==void 0&&t.length===1;r&&(e=le.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&le.set(t,e))}return e}toString(){return this.cssText}};const Oe=n=>new Ee(typeof n=="string"?n:n+"",void 0,ne),Ne=(n,...e)=>{const t=n.length===1?n[0]:e.reduce((r,i,s)=>r+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[s+1],n[0]);return new Ee(t,n,ne)},Ue=(n,e)=>{if(re)n.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const t of e){const r=document.createElement("style"),i=F.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=t.cssText,n.appendChild(r)}},de=re?n=>n:n=>n instanceof CSSStyleSheet?(e=>{let t="";for(const r of e.cssRules)t+=r.cssText;return Oe(t)})(n):n;/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const{is:He,defineProperty:Me,getOwnPropertyDescriptor:Le,getOwnPropertyNames:De,getOwnPropertySymbols:Ie,getPrototypeOf:ze}=Object,A=globalThis,ue=A.trustedTypes,je=ue?ue.emptyScript:"",Y=A.reactiveElementPolyfillSupport,I=(n,e)=>n,K={toAttribute(n,e){switch(e){case Boolean:n=n?je:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,e){let t=n;switch(e){case Boolean:t=n!==null;break;case Number:t=n===null?null:Number(n);break;case Object:case Array:try{t=JSON.parse(n)}catch{t=null}}return t}},se=(n,e)=>!He(n,e),pe={attribute:!0,type:String,converter:K,reflect:!1,hasChanged:se};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),A.litPropertyMetadata??(A.litPropertyMetadata=new WeakMap);class T extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??(this.l=[])).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=pe){if(t.state&&(t.attribute=!1),this._$Ei(),this.elementProperties.set(e,t),!t.noAccessor){const r=Symbol(),i=this.getPropertyDescriptor(e,r,t);i!==void 0&&Me(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){const{get:i,set:s}=Le(this.prototype,e)??{get(){return this[t]},set(o){this[t]=o}};return{get(){return i==null?void 0:i.call(this)},set(o){const c=i==null?void 0:i.call(this);s.call(this,o),this.requestUpdate(e,c,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??pe}static _$Ei(){if(this.hasOwnProperty(I("elementProperties")))return;const e=ze(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(I("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(I("properties"))){const t=this.properties,r=[...De(t),...Ie(t)];for(const i of r)this.createProperty(i,t[i])}const e=this[Symbol.metadata];if(e!==null){const t=litPropertyMetadata.get(e);if(t!==void 0)for(const[r,i]of t)this.elementProperties.set(r,i)}this._$Eh=new Map;for(const[t,r]of this.elementProperties){const i=this._$Eu(t,r);i!==void 0&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const r=new Set(e.flat(1/0).reverse());for(const i of r)t.unshift(de(i))}else e!==void 0&&t.push(de(e));return t}static _$Eu(e,t){const r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){var e;this._$Eg=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$ES(),this.requestUpdate(),(e=this.constructor.l)==null||e.forEach(t=>t(this))}addController(e){var t;(this._$E_??(this._$E_=new Set)).add(e),this.renderRoot!==void 0&&this.isConnected&&((t=e.hostConnected)==null||t.call(e))}removeController(e){var t;(t=this._$E_)==null||t.delete(e)}_$ES(){const e=new Map,t=this.constructor.elementProperties;for(const r of t.keys())this.hasOwnProperty(r)&&(e.set(r,this[r]),delete this[r]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ue(e,this.constructor.elementStyles),e}connectedCallback(){var e;this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$E_)==null||e.forEach(t=>{var r;return(r=t.hostConnected)==null?void 0:r.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$E_)==null||e.forEach(t=>{var r;return(r=t.hostDisconnected)==null?void 0:r.call(t)})}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EO(e,t){var s;const r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(i!==void 0&&r.reflect===!0){const o=(((s=r.converter)==null?void 0:s.toAttribute)!==void 0?r.converter:K).toAttribute(t,r.type);this._$Em=e,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(e,t){var s;const r=this.constructor,i=r._$Eh.get(e);if(i!==void 0&&this._$Em!==i){const o=r.getPropertyOptions(i),c=typeof o.converter=="function"?{fromAttribute:o.converter}:((s=o.converter)==null?void 0:s.fromAttribute)!==void 0?o.converter:K;this._$Em=i,this[i]=c.fromAttribute(t,o.type),this._$Em=null}}requestUpdate(e,t,r,i=!1,s){if(e!==void 0){if(r??(r=this.constructor.getPropertyOptions(e)),!(r.hasChanged??se)(i?s:this[e],t))return;this.C(e,t,r)}this.isUpdatePending===!1&&(this._$Eg=this._$EP())}C(e,t,r){this._$AL.has(e)||this._$AL.set(e,t),r.reflect===!0&&this._$Em!==e&&(this._$Ej??(this._$Ej=new Set)).add(e)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}catch(t){Promise.reject(t)}const e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var r;if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(const[s,o]of this._$Ep)this[s]=o;this._$Ep=void 0}const i=this.constructor.elementProperties;if(i.size>0)for(const[s,o]of i)o.wrapped!==!0||this._$AL.has(s)||this[s]===void 0||this.C(s,this[s],o)}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),(r=this._$E_)==null||r.forEach(i=>{var s;return(s=i.hostUpdate)==null?void 0:s.call(i)}),this.update(t)):this._$ET()}catch(i){throw e=!1,this._$ET(),i}e&&this._$AE(t)}willUpdate(e){}_$AE(e){var t;(t=this._$E_)==null||t.forEach(r=>{var i;return(i=r.hostUpdated)==null?void 0:i.call(r)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(e){return!0}update(e){this._$Ej&&(this._$Ej=this._$Ej.forEach(t=>this._$EO(t,this[t]))),this._$ET()}updated(e){}firstUpdated(e){}}T.elementStyles=[],T.shadowRootOptions={mode:"open"},T[I("elementProperties")]=new Map,T[I("finalized")]=new Map,Y==null||Y({ReactiveElement:T}),(A.reactiveElementVersions??(A.reactiveElementVersions=[])).push("2.0.2");/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const z=globalThis,J=z.trustedTypes,fe=J?J.createPolicy("lit-html",{createHTML:n=>n}):void 0,be="$lit$",y=`lit$${(Math.random()+"").slice(9)}$`,we="?"+y,Be=`<${we}>`,C=document,B=()=>C.createComment(""),W=n=>n===null||typeof n!="object"&&typeof n!="function",xe=Array.isArray,We=n=>xe(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",ee=`[ +\f\r]`,L=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ge=/-->/g,$e=/>/g,x=RegExp(`>|${ee}(?:([^\\s"'>=/]+)(${ee}*=${ee}*(?:[^ +\f\r"'\`<>=]|("|')|))|$)`,"g"),ve=/'/g,me=/"/g,Se=/^(?:script|style|textarea|title)$/i,qe=n=>(e,...t)=>({_$litType$:n,strings:e,values:t}),D=qe(1),N=Symbol.for("lit-noChange"),g=Symbol.for("lit-nothing"),_e=new WeakMap,S=C.createTreeWalker(C,129);function Ce(n,e){if(!Array.isArray(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return fe!==void 0?fe.createHTML(e):e}const ke=(n,e)=>{const t=n.length-1,r=[];let i,s=e===2?"":"",o=L;for(let c=0;c"?(o=i??L,d=-1):h[1]===void 0?d=-2:(d=o.lastIndex-h[2].length,l=h[1],o=h[3]===void 0?x:h[3]==='"'?me:ve):o===me||o===ve?o=x:o===ge||o===$e?o=L:(o=x,i=void 0);const p=o===x&&n[c+1].startsWith("/>")?" ":"";s+=o===L?a+Be:d>=0?(r.push(l),a.slice(0,d)+be+a.slice(d)+y+p):a+y+(d===-2?c:p)}return[Ce(n,s+(n[t]||"")+(e===2?"":"")),r]};class q{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,o=0;const c=e.length-1,a=this.parts,[l,h]=ke(e,t);if(this.el=q.createElement(l,r),S.currentNode=this.el.content,t===2){const d=this.el.content.firstChild;d.replaceWith(...d.childNodes)}for(;(i=S.nextNode())!==null&&a.length0){i.textContent=J?J.emptyScript:"";for(let p=0;p2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=g}_$AI(e,t=this,r,i){const s=this.strings;let o=!1;if(s===void 0)e=U(this,e,t,0),o=!W(e)||e!==this._$AH&&e!==N,o&&(this._$AH=e);else{const c=e;let a,l;for(e=s[0],a=0;a{const r=(t==null?void 0:t.renderBefore)??e;let i=r._$litPart$;if(i===void 0){const s=(t==null?void 0:t.renderBefore)??null;r._$litPart$=i=new V(e.insertBefore(B(),s),s,void 0,t??{})}return i._$AI(n),i};/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */class j extends T{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t;const e=super.createRenderRoot();return(t=this.renderOptions).renderBefore??(t.renderBefore=e.firstChild),e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Qe(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)==null||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)==null||e.setConnected(!1)}render(){return N}}var ye;j._$litElement$=!0,j.finalized=!0,(ye=globalThis.litElementHydrateSupport)==null||ye.call(globalThis,{LitElement:j});const ie=globalThis.litElementPolyfillSupport;ie==null||ie({LitElement:j});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.0.2");/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const Ze=n=>(e,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(n,e)}):customElements.define(n,e)};/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */const Xe={attribute:!0,type:String,converter:K,reflect:!1,hasChanged:se},Ye=(n=Xe,e,t)=>{const{kind:r,metadata:i}=t;let s=globalThis.litPropertyMetadata.get(i);if(s===void 0&&globalThis.litPropertyMetadata.set(i,s=new Map),s.set(t.name,n),r==="accessor"){const{name:o}=t;return{set(c){const a=e.get.call(this);e.set.call(this,c),this.requestUpdate(o,a,n)},init(c){return c!==void 0&&this.C(o,void 0,n),c}}}if(r==="setter"){const{name:o}=t;return function(c){const a=this[o];e.call(this,c),this.requestUpdate(o,a,n)}}throw Error("Unsupported decorator location: "+r)};function Pe(n){return(e,t)=>typeof t=="object"?Ye(n,e,t):((r,i,s)=>{const o=i.hasOwnProperty(s);return i.constructor.createProperty(s,o?{...r,wrapped:!0}:r),o?Object.getOwnPropertyDescriptor(i,s):void 0})(n,e,t)}/** + * @license + * Copyright 2017 Google LLC + * SPDX-License-Identifier: BSD-3-Clause + */function et(n){return Pe({...n,state:!0,attribute:!1})}function tt(n){for(var e=[],t=0;t=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122||o===95){i+=n[s++];continue}break}if(!i)throw new TypeError("Missing parameter name at ".concat(t));e.push({type:"NAME",index:t,value:i}),t=s;continue}if(r==="("){var c=1,a="",s=t+1;if(n[s]==="?")throw new TypeError('Pattern cannot start with "?" at '.concat(s));for(;s)?(?!\?)/g,r=0,i=t.exec(n.source);i;)e.push({name:i[1]||r++,prefix:"",suffix:"",modifier:"",pattern:""}),i=t.exec(n.source);return n}function ot(n,e,t){var r=n.map(function(i){return Re(i,e,t).source});return new RegExp("(?:".concat(r.join("|"),")"),Te(t))}function at(n,e,t){return ct(it(n,t),e,t)}function ct(n,e,t){t===void 0&&(t={});for(var r=t.strict,i=r===void 0?!1:r,s=t.start,o=s===void 0?!0:s,c=t.end,a=c===void 0?!0:c,l=t.encode,h=l===void 0?function(Z){return Z}:l,d=t.delimiter,f=d===void 0?"/#?":d,p=t.endsWith,m=p===void 0?"":p,P="[".concat(R(m),"]|$"),_="[".concat(R(f),"]"),$=o?"^":"",H=0,M=n;H-1:w===void 0;i||($+="(?:".concat(_,"(?=").concat(P,"))?")),Q||($+="(?=".concat(_,"|").concat(P,")"))}return new RegExp($,Te(t))}function Re(n,e,t){return n instanceof RegExp?st(n,e):Array.isArray(n)?ot(n,e,t):at(n,e,t)}var ht=Object.defineProperty,lt=Object.getOwnPropertyDescriptor,oe=(n,e,t,r)=>{for(var i=r>1?void 0:r?lt(e,t):e,s=n.length-1,o;s>=0;s--)(o=n[s])&&(i=(r?o(e,t,i):o(i))||i);return r&&i&&ht(e,t,i),i};async function dt(n){return fetch(n).then(e=>e.json())}var O,Ae;let k=(Ae=class extends j{constructor(){super(...arguments);he(this,O,void 0);X(this,O,"/nav-config.json"),this.config=null,this.logo=null}get src(){return ce(this,O)}set src(e){X(this,O,e)}async connectedCallback(){super.connectedCallback();const e=await dt(this.src);this.config=e}drawLogo(){var t;const e=((t=this.config)==null?void 0:t.logo)??null;return e?D``:""}drawMenu(){var r;const e=(r=this.config)==null?void 0:r.navigation,t=i=>i?!!rt(i,{decode:decodeURIComponent})(window.location.pathname):!1;return e?D``:""}render(){return D`
${this.drawMenu()}
`}},O=new WeakMap,Ae);k.styles=Ne`:host{display:flex;flex-flow:column nowrap;width:100%}.header{padding:0 8px;background-color:#fff;color:#000;box-shadow:5px 5px 5px 0 #00000020}.logo{height:31px;width:94px;margin-right:1em;display:inline-block;padding:8px;background-image:var(--logo-img);background-size:contain;background-position:center;background-repeat:no-repeat;box-sizing:border-box}.navigation{display:flex;flex-flow:row nowrap;align-items:stretch;gap:1em;width:100%;margin:0 auto;max-width:var(--qg-nav-max-width,auto);min-height:var(--qg-nav-min-height,4.75rem)}.navigation .link{text-decoration:none;color:inherit;padding:.5rem 1.75rem;display:flex;align-items:center}.navigation .active{color:#fff}button{border-radius:4px;border:1px solid transparent;padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;cursor:pointer;transition:border-color .25s;background-color:transparent;color:inherit}button:hover{border-color:#646cff}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}`;oe([Pe({type:String})],k.prototype,"src",1);oe([et()],k.prototype,"config",2);k=oe([Ze("qg-top-nav")],k); diff --git a/assets/index-O9bfoJKQ.css b/assets/index-O9bfoJKQ.css new file mode 100644 index 0000000..69b8226 --- /dev/null +++ b/assets/index-O9bfoJKQ.css @@ -0,0 +1 @@ +:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#213547;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}@media screen and (min-width: 768px){:root{--qg-nav-max-width: 720px}}@media screen and (min-width: 1024px){:root{--qg-nav-max-width: 960px}}@media screen and (min-width: 1280px){:root{--qg-nav-max-width: 1140px}}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:0;display:flex;place-items:start center;min-width:320px;min-height:100vh}@media (prefers-color-scheme: light){:root{background-color:#fff}} diff --git a/index.html b/index.html new file mode 100644 index 0000000..5320234 --- /dev/null +++ b/index.html @@ -0,0 +1,14 @@ + + + + + + + Qgis navigation component demo + + + + + + + diff --git a/logo.png b/logo.png new file mode 100644 index 0000000..0b0f2ad Binary files /dev/null and b/logo.png differ diff --git a/nav-config.json b/nav-config.json new file mode 100644 index 0000000..ff9a854 --- /dev/null +++ b/nav-config.json @@ -0,0 +1,44 @@ +{ + "logo": { + "icon": "/logo.png", + "link": "/" + }, + "navigation": [ + { + "type": "link", + "settings": { + "name": "Foo", + "href": "/foo", + "activeTest": "/foo" + } + }, + { + "type": "link", + "settings": { + "name": "Bar", + "href": "/bar", + "activeTest": "/bar" + } + }, + { + "type": "menu", + "settings": { + "name": "I am menu", + "child": [ + { + "type": "link", + "settings": { + "href": "https://example.com" + } + }, + { + "type": "button", + "settings": { + "href": "https://example.com" + } + } + ] + } + } + ] +} \ No newline at end of file