@nordhealth/components 5.0.2 → 5.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Aside.js CHANGED
@@ -1,4 +1,4 @@
1
- import{_ as e}from"./tslib.es6-CmLYFWVC.js";import{css as t,LitElement as i,html as r,nothing as a}from"lit";import{property as n,state as s,query as o,customElement as l}from"lit/decorators.js";import{classMap as d}from"lit/directives/class-map.js";import{S as c}from"./SlotController-Z6eG7LSZ.js";import{o as h}from"./observe-D0n0zOfU.js";import{N as u}from"./events-Bv6wNHwJ.js";import{g as p}from"./focus-D8oSvIcN.js";import{s as v}from"./Component-BJ5O5n8k.js";import"./Tooltip.js";import"./EventController-BBOmvfLa.js";import"./positioning-D-K8Mueq.js";import"./fsm-Bq5jMQrK.js";let w=0,g=0,b=null;function f(){if("undefined"==typeof document)return;if(0===w)return;if(w--,w>0)return;const e=document.body;b&&(e.style.position=b.position,e.style.top=b.top,e.style.insetInlineStart=b.insetInlineStart,e.style.insetInlineEnd=b.insetInlineEnd,e.style.inlineSize=b.inlineSize,e.style.overflow=b.overflow,b=null),window.scrollTo(0,g)}const y=t`:host{--_n-aside-rail-width:var(--n-aside-rail-width,48px);--_n-aside-rail-gap:var(--n-aside-rail-gap,0);--_n-aside-rail-padding-inline:var(--n-aside-rail-padding-inline,8px);--_n-aside-rail-padding-block:var(--n-aside-rail-padding-block,8px);--_n-aside-rail-border-color:var(--n-aside-rail-border-color,var(--n-color-border));--_n-aside-rail-border-width:var(--n-aside-rail-border-width,1px);--_n-aside-rail-box-shadow:var(--n-aside-rail-box-shadow,none);--_n-aside-rail-background-color:var(--n-aside-rail-background-color,var(--n-color-surface));--_n-aside-background-color:var(--n-aside-background-color,var(--n-color-background));--_n-aside-drawers-margin-inline-start:var(--n-aside-drawers-margin-inline-start,0px);--_n-aside-resize-block-size:var(--n-aside-resize-block-size,100%);--_n-aside-resize-color:var(--n-aside-resize-color,var(--n-layout-resize-color,var(--n-color-accent)));--_n-aside-z-index:var(--n-aside-z-index,var(--n-index-nav));--_n-aside-z-index-fullscreen:var(--n-aside-z-index-fullscreen,var(--n-index-top-bar,1000));--_n-aside-rail-narrow-block-size:var(--n-aside-rail-narrow-block-size,56px);--_n-aside-rail-narrow-padding-inline:var(--n-aside-rail-narrow-padding-inline,var(--n-space-m,16px));--_n-aside-rail-narrow-padding-block:var(--n-aside-rail-narrow-padding-block,var(--n-space-s,8px));--_n-aside-rail-narrow-border-block-start-width:var(--n-aside-rail-narrow-border-block-start-width,1px);--_n-aside-rail-narrow-border-color:var(--n-aside-rail-narrow-border-color,var(--_n-aside-rail-border-color));--_n-aside-drawer-floating-inset-block-start:var(
1
+ import{_ as e}from"./tslib.es6-CmLYFWVC.js";import{css as t,LitElement as i,html as r,nothing as a}from"lit";import{property as n,state as s,query as o,customElement as l}from"lit/decorators.js";import{classMap as d}from"lit/directives/class-map.js";import{S as c}from"./SlotController-Z6eG7LSZ.js";import{o as h}from"./observe-D0n0zOfU.js";import{N as u}from"./events-Bv6wNHwJ.js";import{g as p}from"./focus-Dsbrvxj1.js";import{s as v}from"./Component-BJ5O5n8k.js";import"./Tooltip.js";import"./EventController-BBOmvfLa.js";import"./positioning-D-K8Mueq.js";import"./fsm-Bq5jMQrK.js";let w=0,g=0,b=null;function f(){if("undefined"==typeof document)return;if(0===w)return;if(w--,w>0)return;const e=document.body;b&&(e.style.position=b.position,e.style.top=b.top,e.style.insetInlineStart=b.insetInlineStart,e.style.insetInlineEnd=b.insetInlineEnd,e.style.inlineSize=b.inlineSize,e.style.overflow=b.overflow,b=null),window.scrollTo(0,g)}const y=t`:host{--_n-aside-rail-width:var(--n-aside-rail-width,48px);--_n-aside-rail-gap:var(--n-aside-rail-gap,0);--_n-aside-rail-padding-inline:var(--n-aside-rail-padding-inline,8px);--_n-aside-rail-padding-block:var(--n-aside-rail-padding-block,8px);--_n-aside-rail-border-color:var(--n-aside-rail-border-color,var(--n-color-border));--_n-aside-rail-border-width:var(--n-aside-rail-border-width,1px);--_n-aside-rail-box-shadow:var(--n-aside-rail-box-shadow,none);--_n-aside-rail-background-color:var(--n-aside-rail-background-color,var(--n-color-surface));--_n-aside-background-color:var(--n-aside-background-color,var(--n-color-background));--_n-aside-drawers-margin-inline-start:var(--n-aside-drawers-margin-inline-start,0px);--_n-aside-resize-block-size:var(--n-aside-resize-block-size,100%);--_n-aside-resize-color:var(--n-aside-resize-color,var(--n-layout-resize-color,var(--n-color-accent)));--_n-aside-z-index:var(--n-aside-z-index,var(--n-index-nav));--_n-aside-z-index-fullscreen:var(--n-aside-z-index-fullscreen,var(--n-index-top-bar,1000));--_n-aside-rail-narrow-block-size:var(--n-aside-rail-narrow-block-size,56px);--_n-aside-rail-narrow-padding-inline:var(--n-aside-rail-narrow-padding-inline,var(--n-space-m,16px));--_n-aside-rail-narrow-padding-block:var(--n-aside-rail-narrow-padding-block,var(--n-space-s,8px));--_n-aside-rail-narrow-border-block-start-width:var(--n-aside-rail-narrow-border-block-start-width,1px);--_n-aside-rail-narrow-border-color:var(--n-aside-rail-narrow-border-color,var(--_n-aside-rail-border-color));--_n-aside-drawer-floating-inset-block-start:var(
2
2
  --n-aside-drawer-floating-inset-block-start,var(--n-layout-header-block-size,60px)
3
3
  );--_n-aside-drawer-floating-inset-inline:var(--n-aside-drawer-floating-inset-inline,0px);--_n-aside-drawer-floating-bottom-offset:var(--n-aside-drawer-floating-bottom-offset,0px);--_n-aside-drawer-floating-inset-block-end:var(
4
4
  --n-aside-drawer-floating-inset-block-end,calc(var(--_n-aside-rail-narrow-block-size) - var(--_n-aside-drawer-floating-bottom-offset))
@@ -1,2 +1,2 @@
1
- import{_ as e}from"./tslib.es6-CmLYFWVC.js";import{css as t,LitElement as o,html as i,nothing as n}from"lit";import{property as r,state as s,customElement as a}from"lit/decorators.js";import{classMap as l}from"lit/directives/class-map.js";import{ifDefined as c}from"lit/directives/if-defined.js";import{createRef as d,ref as p}from"lit/directives/ref.js";import{repeat as m}from"lit/directives/repeat.js";import{g as h}from"./collection-Dvg2XbxV.js";import{L as u}from"./LightDismissController-wcL1ziJa.js";import{o as v}from"./observe-D0n0zOfU.js";import{c as f}from"./cond-CI1KbneT.js";import{N as b}from"./events-Bv6wNHwJ.js";import{g as x}from"./focus-D8oSvIcN.js";import{w as g}from"./number-Dg2vCfGd.js";import{s as y}from"./Component-BJ5O5n8k.js";import z from"./Icon.js";import{LocalizeController as w}from"./LocalizeController.js";import{KeyboardController as j}from"./KeyboardController.js";import{SelectEvent as k}from"./SelectEvent.js";import"./VisuallyHidden.js";import"./CommandMenuAction.js";import"./EventController-BBOmvfLa.js";import"./ShortcutController-CV5b0BZl.js";import"./tinykeys-DwvDXsEb.js";import"lit/directives/unsafe-html.js";import"./IconManager.js";import"./translation.js";import"./en-us.js";import"./localization.js";import"./localization2.js";import"./localization3.js";import"./localization4.js";import"./localization5.js";import"./localization6.js";import"./localization7.js";import"./localization8.js";import"./localization9.js";import"./localization10.js";import"./localization11.js";import"./localization12.js";import"./localization13.js";import"./localization14.js";import"./localization15.js";import"./localization16.js";import"./localization17.js";import"./localization18.js";import"./localization19.js";import"./localization20.js";import"./localization21.js";import"./localization22.js";import"./localization23.js";import"./localization24.js";import"./DirectionController-ChvNGESZ.js";const $="keyboard-arrow-up-down";var C=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m8.29008 12.3413 1.41 1.42-3.96 3.95c-.2.19-.45.29-.71.29s-.51-.1-.71-.29l-3.990002-4 1.410002-1.42 2.26 2.25v-12.54002h2v12.63002zm11.38002-6.05002-4.01-4c-.39-.39-1.02-.39-1.41 0l-3.96 3.95 1.41 1.42 2.29-2.29v12.63002h2v-12.54002l2.26 2.25 1.41-1.42z" fill="currentColor"/></svg>',tags:"nordicon keyboard keys arrow up down shortcut",title:$});const _="keyboard-backspace";var I=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m18 2h-10.54c-.58 0-1.14.25-1.52.7l-5.14 6c-.65.75-.65 1.85 0 2.6l5.14 6c.38.44.93.7 1.52.7h10.54c1.1 0 2-.9 2-2v-12c0-1.1-.9-2-2-2zm0 14h-10.54l-5.14-6 5.14-6h10.54zm-9.54-3.88 2.12-2.12-2.12-2.12 1.41-1.41 2.12 2.12 2.12-2.12 1.41 1.41-2.12 2.12 2.12 2.12-1.41 1.41-2.12-2.12-2.12 2.12z" fill="currentColor"/></svg>',tags:"nordicon keyboard backspace back delete key shortcut",title:_});const B="keyboard-return";var O=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m18.0025 4v8c0 1.1-.9 2-2 2h-12.59l3 3-1.41 1.41-4.71-4.7c-.39-.39-.39-1.02 0-1.41l4.71-4.71 1.41 1.41-3 3h12.59v-8h-4v-2h4c1.1 0 2 .9 2 2z" fill="currentColor"/></svg>',tags:"nordicon keyboard return key shortcut",title:B});const S=t`:host{--_n-command-menu-inline-size:var(--n-command-menu-inline-size,640px);--_n-command-menu-block-size:var(--n-command-menu-block-size,290px);--_n-command-menu-block-start:var(--n-command-menu-block-start,16%)}.n-modal{block-size:100%;display:none;inline-size:100%;inset-block-start:0;inset-inline-start:0;overflow:auto;pointer-events:none;position:fixed;z-index:var(--n-index-modal)}.n-modal.n-visible{display:block}.n-modal-content{background:var(--n-color-surface);border-radius:var(--n-border-radius);box-shadow:var(--n-box-shadow-modal);display:flex;flex-direction:column;inset-block-start:var(--_n-command-menu-block-start);margin:auto;max-inline-size:var(--_n-command-menu-inline-size);min-inline-size:0;overflow:hidden;pointer-events:all;position:relative}.n-bump{animation:zoom-in-zoom-out var(--n-transition-slowly)}@keyframes zoom-in-zoom-out{0%{opacity:0;transform:translateY(-10px) scale(.97)}to{opacity:1;transform:translateY(0) scale(1.0001)}}.n-modal-footer{color:var(--n-color-text-weaker);display:flex;font-size:calc(var(--n-font-size-s) - 1px);gap:var(--n-space-s);padding:var(--n-space-s) var(--n-space-m)}.n-help{align-items:center;display:flex;gap:2px}.n-help+.n-help{border-inline-start:1px solid var(--n-color-border-strong);padding-inline-start:var(--n-space-s)}.n-help nord-icon{--_n-icon-size:10px;color:currentColor;margin:3px 4px}.n-help.n-backspace nord-icon{--_n-icon-size:12px}.n-search-wrapper{border-block-end:1px solid var(--n-color-border);display:flex}[role=combobox]{appearance:none;background:#0000;border:none;border-radius:0;color:var(--n-color-text);flex:1;font-family:inherit;font-size:var(--n-font-size-l);font-weight:var(--n-font-weight);margin:0;outline:none;padding:var(--n-space-m)}[role=combobox]::-webkit-input-placeholder{color:var(--n-color-text-weaker);opacity:.6!important}[role=combobox]::-moz-placeholder{color:var(--n-color-text-weaker);opacity:.6!important}[role=combobox]::-ms-input-placeholder{color:var(--n-color-text-weaker);opacity:.6!important}[role=listbox]{margin:0;max-block-size:var(--_n-command-menu-block-size);overflow:auto;padding:0}.n-group-header{background:var(--n-color-surface-raised);color:var(--n-color-text-weaker);font-size:var(--n-font-size-s);font-weight:var(--n-font-weight-active);line-height:var(--n-line-height);overflow:hidden;padding:calc(var(--n-space-s)/1.4) var(--n-space-m);text-overflow:ellipsis;white-space:nowrap}.n-command-empty,.n-group-header{border-block-end:1px solid var(--n-color-border)}.n-command-empty{align-items:flex-start;border-inline-start:2px solid #0000;color:var(--n-color-text);display:flex;flex:1;flex-direction:column;padding:calc(var(--n-space-m)/1.5) var(--n-space-m)}.n-command-empty .n-title{flex:1;font-size:var(--n-font-size-m);margin-block-start:var(--n-space-s);margin-inline-end:var(--n-space-xs);max-inline-size:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.n-command-empty .n-tip{color:var(--n-color-text-weaker);flex:1;font-size:var(--n-font-size-s);margin-block-end:var(--n-space-m);margin-block-start:var(--n-space-s)}`;z.registerIcon(C),z.registerIcon(O),z.registerIcon(I);let E=class extends o{constructor(){super(...arguments),this.inputRef=d(),this.listRef=d(),this.localize=new w(this),this.dismissController=new u(this,{isOpen:()=>this.open,onDismiss:()=>this.close()}),this.keyboardController=new j(this,{trigger:()=>this.select(),goBack:()=>this.goBack(),end:()=>this.end(),start:()=>this.start(),next:()=>this.next(),previous:()=>this.previous(),toggleOpen:()=>this.toggleOpen()}),this.open=!1,this.externalFiltering=!1,this.exitNestedOnSearch=!1,this.commands=[],this.searchQuery="",this.bump=!0,this.selectedIndex=0,this.filteredCommands=[]}get selected(){return this.filteredCommands[this.selectedIndex]}show(e={}){this.dispatchEvent(new b("open",{cancelable:!0}))&&(this.open=!0,this.setParent(e.parent))}close(){var e;this.open=!1,null===(e=this.previousFocus)||void 0===e||e.focus(),this.previousFocus=void 0,this.dispatchEvent(new b("close"))}toggleOpen(){this.open?this.close():this.show()}focus(){var e;null===(e=this.inputRef.value)||void 0===e||e.focus()}render(){var e;const t=h(this.filteredCommands,"section"),o=0===this.filteredCommands.length?"no-results":null===(e=this.selected)||void 0===e?void 0:e.id;return i`<div class="${l({"n-visible":this.open,"n-modal":!0})}"><div @animationend="${this.handleAnimationEnd}" class="${l({"n-bump":this.bump,"n-modal-content":!0})}"><div class="n-search-wrapper"><nord-visually-hidden id="instructions">${this.localize.term("instructions")}</nord-visually-hidden><input type="text" id="search" @input="${this.handleInput}" @blur="${this.handleBlur}" ${p(this.inputRef)} placeholder="${this.localize.term("placeholder")}" .value="${this.searchQuery}" spellcheck="false" autocomplete="off" autocapitalize="off" aria-label="${this.localize.term("inputLabel")}" aria-autocomplete="list" aria-haspopup="listbox" role="combobox" aria-controls="list" aria-expanded="true" aria-activedescendant="${c(o)}" aria-describedby="instructions"></div><div class="n-modal-body"><div id="list" ${p(this.listRef)} role="listbox" aria-label="${this.localize.term("inputLabel")}">${0===this.filteredCommands.length?this.renderNoResults():Array.from(t,(([e,t])=>this.renderSection(e,t)))}</div></div><slot name="footer"><div class="n-modal-footer"><span class="n-help"><nord-icon label="Arrow keys" name="${$}"></nord-icon>${this.localize.term("footerArrowKeys")} </span><span class="n-help"><nord-icon label="Enter key" name="${B}"></nord-icon>${this.localize.term("footerEnterKey")} </span><span class="n-help">${this.localize.term("footerEscapeKey")}</span> <span class="n-help n-backspace"><nord-icon label="Backspace key" name="${_}"></nord-icon>${this.localize.term("footerBackspaceKey")}</span></div></slot></div></div>`}renderNoResults(){return i`<div id="no-results" class="n-command-empty" role="option" aria-selected="true"><div class="n-title">${this.localize.term("noResults",this.searchQuery)}</div><div class="n-tip">${this.localize.term("tip")}</div></div>`}renderSection(e,t){const o=`section-${e}`;return i`<div role="group" aria-labelledby="${f(e,o)}">${e?i`<div class="n-group-header" role="presentation" id="${o}">${e}</div>`:n} ${m(t,(e=>e.id),(e=>{var t,o;return i`<nord-command-menu-action id="${e.id}" .command="${e}" ?selected="${this.open&&e.id===(null===(t=this.selected)||void 0===t?void 0:t.id)}" @click="${()=>this.select(e)}" role="option" aria-selected="${f(e.id===(null===(o=this.selected)||void 0===o?void 0:o.id),"true")}"></nord-command-menu-action>`}))}</div>`}handleCommandsChange(){this.keyboardController.registerCommandShortcuts()}handleBump(){this.open&&(this.bump=!0)}focusOnOpen(){this.open&&(this.previousFocus=x(document),this.focus(),this.listRef.value&&(this.listRef.value.scrollTop=0))}handleAnimationEnd(){this.bump=!1}handleBlur(){this.open&&this.focus()}handleInput(e){e.stopPropagation();const t=e.target;this.setSearch(t.value),this.exitNestedOnSearch&&t.value&&this.parent&&(this.parent=void 0),this.dispatchEvent(new b("input"))}select(e=this.selected){var t;this.commands.some((t=>t.parent===e.id))?(this.setParent(e.id),this.bump=!0,this.focus()):this.close(),this.setSearch(""),null===(t=e.handler)||void 0===t||t.call(e,this);const o=new k(e);this.dispatchEvent(o)}start(){this.selectedIndex=0}end(){this.selectedIndex=this.filteredCommands.length-1}next(){this.selectedIndex=g(this.selectedIndex+1,0,this.filteredCommands.length-1)}previous(){this.selectedIndex=g(this.selectedIndex-1,0,this.filteredCommands.length-1)}goBack(){if(!this.searchQuery&&this.parent){const e=this.commands.find((e=>e.id===this.parent));this.setParent(null==e?void 0:e.parent)}}setParent(e){this.parent=e,this.setSearch("")}setSearch(e){this.searchQuery=e,this.selectedIndex=0}filterCommands(){const e=[...h(this.commands,"section").values()].flat();if(this.externalFiltering)return void(this.filteredCommands=e.filter((({parent:e})=>e==this.parent)));const t=this.searchQuery.toLocaleLowerCase().split(/\s+/);this.filteredCommands=e.filter((({title:e,keywords:o="",parent:i})=>{const n=`${e} ${o}`.toLocaleLowerCase(),r=t.every((e=>n.includes(e)));return!this.parent&&this.searchQuery?r&&!i:i==this.parent&&r}))}};E.styles=[y,S],e([r({reflect:!0,type:Boolean})],E.prototype,"open",void 0),e([r({reflect:!0,type:Boolean,attribute:"external-filtering"})],E.prototype,"externalFiltering",void 0),e([r({reflect:!0,type:Boolean,attribute:"exit-nested-on-search"})],E.prototype,"exitNestedOnSearch",void 0),e([r({type:Array,attribute:!1})],E.prototype,"commands",void 0),e([r({type:String,attribute:!1})],E.prototype,"searchQuery",void 0),e([s()],E.prototype,"parent",void 0),e([s()],E.prototype,"bump",void 0),e([s()],E.prototype,"selectedIndex",void 0),e([s()],E.prototype,"filteredCommands",void 0),e([v("commands")],E.prototype,"handleCommandsChange",null),e([v("open")],E.prototype,"handleBump",null),e([v("open","updated")],E.prototype,"focusOnOpen",null),e([v("searchQuery"),v("parent"),v("commands"),v("externalFiltering")],E.prototype,"filterCommands",null),E=e([a("nord-command-menu")],E);var R=E;export{R as default};
1
+ import{_ as e}from"./tslib.es6-CmLYFWVC.js";import{css as t,LitElement as o,html as i,nothing as n}from"lit";import{property as r,state as s,customElement as a}from"lit/decorators.js";import{classMap as l}from"lit/directives/class-map.js";import{ifDefined as c}from"lit/directives/if-defined.js";import{createRef as d,ref as p}from"lit/directives/ref.js";import{repeat as m}from"lit/directives/repeat.js";import{g as h}from"./collection-Dvg2XbxV.js";import{L as u}from"./LightDismissController-wcL1ziJa.js";import{o as v}from"./observe-D0n0zOfU.js";import{c as f}from"./cond-CI1KbneT.js";import{N as b}from"./events-Bv6wNHwJ.js";import{g as x}from"./focus-Dsbrvxj1.js";import{w as g}from"./number-Dg2vCfGd.js";import{s as y}from"./Component-BJ5O5n8k.js";import z from"./Icon.js";import{LocalizeController as w}from"./LocalizeController.js";import{KeyboardController as j}from"./KeyboardController.js";import{SelectEvent as k}from"./SelectEvent.js";import"./VisuallyHidden.js";import"./CommandMenuAction.js";import"./EventController-BBOmvfLa.js";import"./ShortcutController-CV5b0BZl.js";import"./tinykeys-DwvDXsEb.js";import"lit/directives/unsafe-html.js";import"./IconManager.js";import"./translation.js";import"./en-us.js";import"./localization.js";import"./localization2.js";import"./localization3.js";import"./localization4.js";import"./localization5.js";import"./localization6.js";import"./localization7.js";import"./localization8.js";import"./localization9.js";import"./localization10.js";import"./localization11.js";import"./localization12.js";import"./localization13.js";import"./localization14.js";import"./localization15.js";import"./localization16.js";import"./localization17.js";import"./localization18.js";import"./localization19.js";import"./localization20.js";import"./localization21.js";import"./localization22.js";import"./localization23.js";import"./localization24.js";import"./DirectionController-ChvNGESZ.js";const $="keyboard-arrow-up-down";var C=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m8.29008 12.3413 1.41 1.42-3.96 3.95c-.2.19-.45.29-.71.29s-.51-.1-.71-.29l-3.990002-4 1.410002-1.42 2.26 2.25v-12.54002h2v12.63002zm11.38002-6.05002-4.01-4c-.39-.39-1.02-.39-1.41 0l-3.96 3.95 1.41 1.42 2.29-2.29v12.63002h2v-12.54002l2.26 2.25 1.41-1.42z" fill="currentColor"/></svg>',tags:"nordicon keyboard keys arrow up down shortcut",title:$});const _="keyboard-backspace";var I=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m18 2h-10.54c-.58 0-1.14.25-1.52.7l-5.14 6c-.65.75-.65 1.85 0 2.6l5.14 6c.38.44.93.7 1.52.7h10.54c1.1 0 2-.9 2-2v-12c0-1.1-.9-2-2-2zm0 14h-10.54l-5.14-6 5.14-6h10.54zm-9.54-3.88 2.12-2.12-2.12-2.12 1.41-1.41 2.12 2.12 2.12-2.12 1.41 1.41-2.12 2.12 2.12 2.12-1.41 1.41-2.12-2.12-2.12 2.12z" fill="currentColor"/></svg>',tags:"nordicon keyboard backspace back delete key shortcut",title:_});const B="keyboard-return";var O=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="m18.0025 4v8c0 1.1-.9 2-2 2h-12.59l3 3-1.41 1.41-4.71-4.7c-.39-.39-.39-1.02 0-1.41l4.71-4.71 1.41 1.41-3 3h12.59v-8h-4v-2h4c1.1 0 2 .9 2 2z" fill="currentColor"/></svg>',tags:"nordicon keyboard return key shortcut",title:B});const S=t`:host{--_n-command-menu-inline-size:var(--n-command-menu-inline-size,640px);--_n-command-menu-block-size:var(--n-command-menu-block-size,290px);--_n-command-menu-block-start:var(--n-command-menu-block-start,16%)}.n-modal{block-size:100%;display:none;inline-size:100%;inset-block-start:0;inset-inline-start:0;overflow:auto;pointer-events:none;position:fixed;z-index:var(--n-index-modal)}.n-modal.n-visible{display:block}.n-modal-content{background:var(--n-color-surface);border-radius:var(--n-border-radius);box-shadow:var(--n-box-shadow-modal);display:flex;flex-direction:column;inset-block-start:var(--_n-command-menu-block-start);margin:auto;max-inline-size:var(--_n-command-menu-inline-size);min-inline-size:0;overflow:hidden;pointer-events:all;position:relative}.n-bump{animation:zoom-in-zoom-out var(--n-transition-slowly)}@keyframes zoom-in-zoom-out{0%{opacity:0;transform:translateY(-10px) scale(.97)}to{opacity:1;transform:translateY(0) scale(1.0001)}}.n-modal-footer{color:var(--n-color-text-weaker);display:flex;font-size:calc(var(--n-font-size-s) - 1px);gap:var(--n-space-s);padding:var(--n-space-s) var(--n-space-m)}.n-help{align-items:center;display:flex;gap:2px}.n-help+.n-help{border-inline-start:1px solid var(--n-color-border-strong);padding-inline-start:var(--n-space-s)}.n-help nord-icon{--_n-icon-size:10px;color:currentColor;margin:3px 4px}.n-help.n-backspace nord-icon{--_n-icon-size:12px}.n-search-wrapper{border-block-end:1px solid var(--n-color-border);display:flex}[role=combobox]{appearance:none;background:#0000;border:none;border-radius:0;color:var(--n-color-text);flex:1;font-family:inherit;font-size:var(--n-font-size-l);font-weight:var(--n-font-weight);margin:0;outline:none;padding:var(--n-space-m)}[role=combobox]::-webkit-input-placeholder{color:var(--n-color-text-weaker);opacity:.6!important}[role=combobox]::-moz-placeholder{color:var(--n-color-text-weaker);opacity:.6!important}[role=combobox]::-ms-input-placeholder{color:var(--n-color-text-weaker);opacity:.6!important}[role=listbox]{margin:0;max-block-size:var(--_n-command-menu-block-size);overflow:auto;padding:0}.n-group-header{background:var(--n-color-surface-raised);color:var(--n-color-text-weaker);font-size:var(--n-font-size-s);font-weight:var(--n-font-weight-active);line-height:var(--n-line-height);overflow:hidden;padding:calc(var(--n-space-s)/1.4) var(--n-space-m);text-overflow:ellipsis;white-space:nowrap}.n-command-empty,.n-group-header{border-block-end:1px solid var(--n-color-border)}.n-command-empty{align-items:flex-start;border-inline-start:2px solid #0000;color:var(--n-color-text);display:flex;flex:1;flex-direction:column;padding:calc(var(--n-space-m)/1.5) var(--n-space-m)}.n-command-empty .n-title{flex:1;font-size:var(--n-font-size-m);margin-block-start:var(--n-space-s);margin-inline-end:var(--n-space-xs);max-inline-size:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.n-command-empty .n-tip{color:var(--n-color-text-weaker);flex:1;font-size:var(--n-font-size-s);margin-block-end:var(--n-space-m);margin-block-start:var(--n-space-s)}`;z.registerIcon(C),z.registerIcon(O),z.registerIcon(I);let E=class extends o{constructor(){super(...arguments),this.inputRef=d(),this.listRef=d(),this.localize=new w(this),this.dismissController=new u(this,{isOpen:()=>this.open,onDismiss:()=>this.close()}),this.keyboardController=new j(this,{trigger:()=>this.select(),goBack:()=>this.goBack(),end:()=>this.end(),start:()=>this.start(),next:()=>this.next(),previous:()=>this.previous(),toggleOpen:()=>this.toggleOpen()}),this.open=!1,this.externalFiltering=!1,this.exitNestedOnSearch=!1,this.commands=[],this.searchQuery="",this.bump=!0,this.selectedIndex=0,this.filteredCommands=[]}get selected(){return this.filteredCommands[this.selectedIndex]}show(e={}){this.dispatchEvent(new b("open",{cancelable:!0}))&&(this.open=!0,this.setParent(e.parent))}close(){var e;this.open=!1,null===(e=this.previousFocus)||void 0===e||e.focus(),this.previousFocus=void 0,this.dispatchEvent(new b("close"))}toggleOpen(){this.open?this.close():this.show()}focus(){var e;null===(e=this.inputRef.value)||void 0===e||e.focus()}render(){var e;const t=h(this.filteredCommands,"section"),o=0===this.filteredCommands.length?"no-results":null===(e=this.selected)||void 0===e?void 0:e.id;return i`<div class="${l({"n-visible":this.open,"n-modal":!0})}"><div @animationend="${this.handleAnimationEnd}" class="${l({"n-bump":this.bump,"n-modal-content":!0})}"><div class="n-search-wrapper"><nord-visually-hidden id="instructions">${this.localize.term("instructions")}</nord-visually-hidden><input type="text" id="search" @input="${this.handleInput}" @blur="${this.handleBlur}" ${p(this.inputRef)} placeholder="${this.localize.term("placeholder")}" .value="${this.searchQuery}" spellcheck="false" autocomplete="off" autocapitalize="off" aria-label="${this.localize.term("inputLabel")}" aria-autocomplete="list" aria-haspopup="listbox" role="combobox" aria-controls="list" aria-expanded="true" aria-activedescendant="${c(o)}" aria-describedby="instructions"></div><div class="n-modal-body"><div id="list" ${p(this.listRef)} role="listbox" aria-label="${this.localize.term("inputLabel")}">${0===this.filteredCommands.length?this.renderNoResults():Array.from(t,(([e,t])=>this.renderSection(e,t)))}</div></div><slot name="footer"><div class="n-modal-footer"><span class="n-help"><nord-icon label="Arrow keys" name="${$}"></nord-icon>${this.localize.term("footerArrowKeys")} </span><span class="n-help"><nord-icon label="Enter key" name="${B}"></nord-icon>${this.localize.term("footerEnterKey")} </span><span class="n-help">${this.localize.term("footerEscapeKey")}</span> <span class="n-help n-backspace"><nord-icon label="Backspace key" name="${_}"></nord-icon>${this.localize.term("footerBackspaceKey")}</span></div></slot></div></div>`}renderNoResults(){return i`<div id="no-results" class="n-command-empty" role="option" aria-selected="true"><div class="n-title">${this.localize.term("noResults",this.searchQuery)}</div><div class="n-tip">${this.localize.term("tip")}</div></div>`}renderSection(e,t){const o=`section-${e}`;return i`<div role="group" aria-labelledby="${f(e,o)}">${e?i`<div class="n-group-header" role="presentation" id="${o}">${e}</div>`:n} ${m(t,(e=>e.id),(e=>{var t,o;return i`<nord-command-menu-action id="${e.id}" .command="${e}" ?selected="${this.open&&e.id===(null===(t=this.selected)||void 0===t?void 0:t.id)}" @click="${()=>this.select(e)}" role="option" aria-selected="${f(e.id===(null===(o=this.selected)||void 0===o?void 0:o.id),"true")}"></nord-command-menu-action>`}))}</div>`}handleCommandsChange(){this.keyboardController.registerCommandShortcuts()}handleBump(){this.open&&(this.bump=!0)}focusOnOpen(){this.open&&(this.previousFocus=x(document),this.focus(),this.listRef.value&&(this.listRef.value.scrollTop=0))}handleAnimationEnd(){this.bump=!1}handleBlur(){this.open&&this.focus()}handleInput(e){e.stopPropagation();const t=e.target;this.setSearch(t.value),this.exitNestedOnSearch&&t.value&&this.parent&&(this.parent=void 0),this.dispatchEvent(new b("input"))}select(e=this.selected){var t;this.commands.some((t=>t.parent===e.id))?(this.setParent(e.id),this.bump=!0,this.focus()):this.close(),this.setSearch(""),null===(t=e.handler)||void 0===t||t.call(e,this);const o=new k(e);this.dispatchEvent(o)}start(){this.selectedIndex=0}end(){this.selectedIndex=this.filteredCommands.length-1}next(){this.selectedIndex=g(this.selectedIndex+1,0,this.filteredCommands.length-1)}previous(){this.selectedIndex=g(this.selectedIndex-1,0,this.filteredCommands.length-1)}goBack(){if(!this.searchQuery&&this.parent){const e=this.commands.find((e=>e.id===this.parent));this.setParent(null==e?void 0:e.parent)}}setParent(e){this.parent=e,this.setSearch("")}setSearch(e){this.searchQuery=e,this.selectedIndex=0}filterCommands(){const e=[...h(this.commands,"section").values()].flat();if(this.externalFiltering)return void(this.filteredCommands=e.filter((({parent:e})=>e==this.parent)));const t=this.searchQuery.toLocaleLowerCase().split(/\s+/);this.filteredCommands=e.filter((({title:e,keywords:o="",parent:i})=>{const n=`${e} ${o}`.toLocaleLowerCase(),r=t.every((e=>n.includes(e)));return!this.parent&&this.searchQuery?r&&!i:i==this.parent&&r}))}};E.styles=[y,S],e([r({reflect:!0,type:Boolean})],E.prototype,"open",void 0),e([r({reflect:!0,type:Boolean,attribute:"external-filtering"})],E.prototype,"externalFiltering",void 0),e([r({reflect:!0,type:Boolean,attribute:"exit-nested-on-search"})],E.prototype,"exitNestedOnSearch",void 0),e([r({type:Array,attribute:!1})],E.prototype,"commands",void 0),e([r({type:String,attribute:!1})],E.prototype,"searchQuery",void 0),e([s()],E.prototype,"parent",void 0),e([s()],E.prototype,"bump",void 0),e([s()],E.prototype,"selectedIndex",void 0),e([s()],E.prototype,"filteredCommands",void 0),e([v("commands")],E.prototype,"handleCommandsChange",null),e([v("open")],E.prototype,"handleBump",null),e([v("open","updated")],E.prototype,"focusOnOpen",null),e([v("searchQuery"),v("parent"),v("commands"),v("externalFiltering")],E.prototype,"filterCommands",null),E=e([a("nord-command-menu")],E);var R=E;export{R as default};
2
2
  //# sourceMappingURL=CommandMenu.js.map
@@ -1,2 +1,2 @@
1
- const e=e=>fetch(`https://nordcdn.net/ds/icons/3.17.1/assets/${e}.svg`).then((t=>{if(!t.ok)throw new TypeError(`NORD: unknown icon: '${e}'`);return t.text()}));class t{constructor(){this.cache=new Map,this.resolver=e}resolve(e,t){let r=this.cache.get(e);"string"!=typeof r?(r||(r=this.resolver(e).catch((()=>"")).then((t=>(this.cache.set(e,t),t))),this.cache.set(e,r)),r.then(t)):t(r)}registerIcon(e,t){let r,s;if("string"==typeof e?(r=e,s=t):(r=e.title,s=e.default),!r)throw new Error("name is required when registering an icon");if(!s)throw new Error("icon must not be empty");this.cache.set(r,s)}clear(){this.cache.clear()}}export{t as IconManager};
1
+ const e=e=>fetch(`https://nordcdn.net/ds/icons/3.17.2/assets/${e}.svg`).then((t=>{if(!t.ok)throw new TypeError(`NORD: unknown icon: '${e}'`);return t.text()}));class t{constructor(){this.cache=new Map,this.resolver=e}resolve(e,t){let r=this.cache.get(e);"string"!=typeof r?(r||(r=this.resolver(e).catch((()=>"")).then((t=>(this.cache.set(e,t),t))),this.cache.set(e,r)),r.then(t)):t(r)}registerIcon(e,t){let r,s;if("string"==typeof e?(r=e,s=t):(r=e.title,s=e.default),!r)throw new Error("name is required when registering an icon");if(!s)throw new Error("icon must not be empty");this.cache.set(r,s)}clear(){this.cache.clear()}}export{t as IconManager};
2
2
  //# sourceMappingURL=IconManager.js.map
@@ -1,2 +1,2 @@
1
- import{S as t}from"./ShortcutController-CV5b0BZl.js";import"./tinykeys-DwvDXsEb.js";function o(t){return o=>{o.preventDefault(),t(o)}}class r{constructor(r,s){this.host=r,r.addController(this),this.commandShortcuts=new t(r),this.globalShortcuts=new t(r,{"$mod+k":o(s.toggleOpen)}),this.navigationShortcuts=new t(r,{Enter:o(s.trigger),Backspace:s.goBack,End:o(s.end),Home:o(s.start),ArrowDown:o(s.next),ArrowUp:o(s.previous)},r)}registerCommandShortcuts(){const t={};for(const o of this.host.commands)o.shortcut&&(t[o.shortcut]=t=>{var r;o.forceShortcut&&t.preventDefault(),null===(r=o.handler)||void 0===r||r.call(o,this.host)});this.commandShortcuts.bind(t)}}export{r as KeyboardController};
1
+ import{S as t}from"./ShortcutController-CV5b0BZl.js";import{i as o,g as r}from"./focus-Dsbrvxj1.js";import"./tinykeys-DwvDXsEb.js";function s(t){return o=>{o.preventDefault(),t(o)}}class n{constructor(o,r){this.host=o,o.addController(this),this.commandShortcuts=new t(o),this.globalShortcuts=new t(o,{"$mod+k":s(r.toggleOpen)}),this.navigationShortcuts=new t(o,{Enter:s(r.trigger),Backspace:r.goBack,End:s(r.end),Home:s(r.start),ArrowDown:s(r.next),ArrowUp:s(r.previous)},o)}registerCommandShortcuts(){const t={};for(const s of this.host.commands)s.shortcut&&(t[s.shortcut]=t=>{var n;s.ignoreWhileTyping&&o(r(document))||(s.forceShortcut&&t.preventDefault(),null===(n=s.handler)||void 0===n||n.call(s,this.host))});this.commandShortcuts.bind(t)}}export{n as KeyboardController};
2
2
  //# sourceMappingURL=KeyboardController.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"KeyboardController.js","sources":["../src/command-menu/KeyboardController.ts"],"sourcesContent":["import type { ReactiveController } from 'lit'\nimport type { ShortcutMap } from '../common/controllers/ShortcutController.js'\nimport type CommandMenu from './CommandMenu.js'\nimport { ShortcutController } from '../common/controllers/ShortcutController.js'\n\ninterface KeyboardActions {\n trigger: () => void\n goBack: () => void\n start: () => void\n end: () => void\n next: () => void\n previous: () => void\n toggleOpen: () => void\n}\n\nfunction preventDefault(fn: (e: Event) => void) {\n return (e: Event) => {\n e.preventDefault()\n fn(e)\n }\n}\n\nexport class KeyboardController {\n private globalShortcuts: ShortcutController\n private navigationShortcuts: ShortcutController\n private commandShortcuts: ShortcutController\n\n constructor(\n private host: CommandMenu,\n actions: KeyboardActions,\n ) {\n host.addController(this as ReactiveController)\n\n this.commandShortcuts = new ShortcutController(host)\n this.globalShortcuts = new ShortcutController(host, { '$mod+k': preventDefault(actions.toggleOpen) })\n this.navigationShortcuts = new ShortcutController(\n host,\n {\n Enter: preventDefault(actions.trigger),\n Backspace: actions.goBack, // we don't want to prevent default, since that would stop backspace deleting chars\n End: preventDefault(actions.end),\n Home: preventDefault(actions.start),\n ArrowDown: preventDefault(actions.next),\n ArrowUp: preventDefault(actions.previous),\n },\n host,\n )\n }\n\n registerCommandShortcuts() {\n const shortcuts: ShortcutMap = {}\n\n for (const command of this.host.commands) {\n if (command.shortcut) {\n shortcuts[command.shortcut] = (event: Event) => {\n // The handler always fires. Only override the browser default when the\n // command explicitly opts in via `forceShortcut`, acknowledging it is\n // reclaiming a combo the browser may reserve (e.g. Alt+D = address bar).\n if (command.forceShortcut) {\n event.preventDefault()\n }\n command.handler?.(this.host)\n }\n }\n }\n\n this.commandShortcuts.bind(shortcuts)\n }\n}\n"],"names":["preventDefault","fn","e","KeyboardController","constructor","host","actions","this","addController","commandShortcuts","ShortcutController","globalShortcuts","toggleOpen","navigationShortcuts","Enter","trigger","Backspace","goBack","End","end","Home","start","ArrowDown","next","ArrowUp","previous","registerCommandShortcuts","shortcuts","command","commands","shortcut","event","forceShortcut","_a","handler","call","bind"],"mappings":"oFAeA,SAASA,EAAeC,GACtB,OAAQC,IACNA,EAAEF,iBACFC,EAAGC,EAAE,CAET,OAEaC,EAKX,WAAAC,CACUC,EACRC,GADQC,KAAIF,KAAJA,EAGRA,EAAKG,cAAcD,MAEnBA,KAAKE,iBAAmB,IAAIC,EAAmBL,GAC/CE,KAAKI,gBAAkB,IAAID,EAAmBL,EAAM,CAAE,SAAUL,EAAeM,EAAQM,cACvFL,KAAKM,oBAAsB,IAAIH,EAC7BL,EACA,CACES,MAAOd,EAAeM,EAAQS,SAC9BC,UAAWV,EAAQW,OACnBC,IAAKlB,EAAeM,EAAQa,KAC5BC,KAAMpB,EAAeM,EAAQe,OAC7BC,UAAWtB,EAAeM,EAAQiB,MAClCC,QAASxB,EAAeM,EAAQmB,WAElCpB,EAEH,CAED,wBAAAqB,GACE,MAAMC,EAAyB,CAAA,EAE/B,IAAK,MAAMC,KAAWrB,KAAKF,KAAKwB,SAC1BD,EAAQE,WACVH,EAAUC,EAAQE,UAAaC,UAIzBH,EAAQI,eACVD,EAAM/B,iBAEO,QAAfiC,EAAAL,EAAQM,eAAO,IAAAD,GAAAA,EAAAE,KAAAP,EAAGrB,KAAKF,KAAK,GAKlCE,KAAKE,iBAAiB2B,KAAKT,EAC5B"}
1
+ {"version":3,"file":"KeyboardController.js","sources":["../src/command-menu/KeyboardController.ts"],"sourcesContent":["import type { ReactiveController } from 'lit'\nimport type { ShortcutMap } from '../common/controllers/ShortcutController.js'\nimport type CommandMenu from './CommandMenu.js'\nimport { ShortcutController } from '../common/controllers/ShortcutController.js'\nimport { getFocusedElement, isEditableElement } from '../common/focus.js'\n\ninterface KeyboardActions {\n trigger: () => void\n goBack: () => void\n start: () => void\n end: () => void\n next: () => void\n previous: () => void\n toggleOpen: () => void\n}\n\nfunction preventDefault(fn: (e: Event) => void) {\n return (e: Event) => {\n e.preventDefault()\n fn(e)\n }\n}\n\nexport class KeyboardController {\n private globalShortcuts: ShortcutController\n private navigationShortcuts: ShortcutController\n private commandShortcuts: ShortcutController\n\n constructor(\n private host: CommandMenu,\n actions: KeyboardActions,\n ) {\n host.addController(this as ReactiveController)\n\n this.commandShortcuts = new ShortcutController(host)\n this.globalShortcuts = new ShortcutController(host, { '$mod+k': preventDefault(actions.toggleOpen) })\n this.navigationShortcuts = new ShortcutController(\n host,\n {\n Enter: preventDefault(actions.trigger),\n Backspace: actions.goBack, // we don't want to prevent default, since that would stop backspace deleting chars\n End: preventDefault(actions.end),\n Home: preventDefault(actions.start),\n ArrowDown: preventDefault(actions.next),\n ArrowUp: preventDefault(actions.previous),\n },\n host,\n )\n }\n\n registerCommandShortcuts() {\n const shortcuts: ShortcutMap = {}\n\n for (const command of this.host.commands) {\n if (command.shortcut) {\n shortcuts[command.shortcut] = (event: Event) => {\n // Command shortcuts bind to `window`, so an Alt+letter combo (e.g.\n // Alt+L → ¬, Alt+S → ß on some layouts) can fire the command instead\n // of typing into the focused field. Commands opting into\n // `ignoreWhileTyping` are skipped while an editable element is focused.\n // `getFocusedElement` resolves through shadow roots so Nord's own form\n // hosts (e.g. `nord-input`) are matched via their inner native field.\n if (command.ignoreWhileTyping && isEditableElement(getFocusedElement(document))) {\n return\n }\n\n // The handler always fires. Only override the browser default when the\n // command explicitly opts in via `forceShortcut`, acknowledging it is\n // reclaiming a combo the browser may reserve (e.g. Alt+D = address bar).\n if (command.forceShortcut) {\n event.preventDefault()\n }\n command.handler?.(this.host)\n }\n }\n }\n\n this.commandShortcuts.bind(shortcuts)\n }\n}\n"],"names":["preventDefault","fn","e","KeyboardController","constructor","host","actions","this","addController","commandShortcuts","ShortcutController","globalShortcuts","toggleOpen","navigationShortcuts","Enter","trigger","Backspace","goBack","End","end","Home","start","ArrowDown","next","ArrowUp","previous","registerCommandShortcuts","shortcuts","command","commands","shortcut","event","ignoreWhileTyping","isEditableElement","getFocusedElement","document","forceShortcut","_a","handler","call","bind"],"mappings":"mIAgBA,SAASA,EAAeC,GACtB,OAAQC,IACNA,EAAEF,iBACFC,EAAGC,EAAE,CAET,OAEaC,EAKX,WAAAC,CACUC,EACRC,GADQC,KAAIF,KAAJA,EAGRA,EAAKG,cAAcD,MAEnBA,KAAKE,iBAAmB,IAAIC,EAAmBL,GAC/CE,KAAKI,gBAAkB,IAAID,EAAmBL,EAAM,CAAE,SAAUL,EAAeM,EAAQM,cACvFL,KAAKM,oBAAsB,IAAIH,EAC7BL,EACA,CACES,MAAOd,EAAeM,EAAQS,SAC9BC,UAAWV,EAAQW,OACnBC,IAAKlB,EAAeM,EAAQa,KAC5BC,KAAMpB,EAAeM,EAAQe,OAC7BC,UAAWtB,EAAeM,EAAQiB,MAClCC,QAASxB,EAAeM,EAAQmB,WAElCpB,EAEH,CAED,wBAAAqB,GACE,MAAMC,EAAyB,CAAA,EAE/B,IAAK,MAAMC,KAAWrB,KAAKF,KAAKwB,SAC1BD,EAAQE,WACVH,EAAUC,EAAQE,UAAaC,UAOzBH,EAAQI,mBAAqBC,EAAkBC,EAAkBC,aAOjEP,EAAQQ,eACVL,EAAM/B,iBAEO,QAAfqC,EAAAT,EAAQU,eAAO,IAAAD,GAAAA,EAAAE,KAAAX,EAAGrB,KAAKF,MAAK,GAKlCE,KAAKE,iBAAiB+B,KAAKb,EAC5B"}
package/lib/Layout.js CHANGED
@@ -1,2 +1,2 @@
1
- import{_ as e}from"./tslib.es6-CmLYFWVC.js";import{l as t}from"./NavToggle-ROsuaJkW.js";import{css as a,LitElement as n,html as o,nothing as i}from"lit";import{query as s,state as r,property as l,customElement as d}from"lit/decorators.js";import{classMap as h}from"lit/directives/class-map.js";import{styleMap as c}from"lit/directives/style-map.js";import{D as v}from"./DirectionController-ChvNGESZ.js";import{E as p}from"./EventController-BBOmvfLa.js";import{L as u}from"./LightDismissController-wcL1ziJa.js";import{S as m}from"./SlotController-Z6eG7LSZ.js";import{o as y}from"./observe-D0n0zOfU.js";import{c as g}from"./cond-CI1KbneT.js";import{f as b}from"./fsm-Bq5jMQrK.js";import{c as f}from"./number-Dg2vCfGd.js";import{s as z}from"./storage-CGZ-YX4-.js";import{s as w}from"./Component-BJ5O5n8k.js";import{s as k}from"./Sticky-CZImMrGj.js";import x from"./Icon.js";import{LocalizeController as N}from"./LocalizeController.js";import{NavOpenChangeEvent as S}from"./NavOpenChangeEvent.js";import{NavResizeEvent as _}from"./NavResizeEvent.js";import"./Tooltip.js";import"lit/directives/ref.js";import"./FocusableMixin-BlQLNPdJ.js";import"./Button.js";import"./LightDomController-DIwtVelV.js";import"./InputMixin-LetXsCyv.js";import"./Spinner.js";import"lit/directives/if-defined.js";import"./VisuallyHidden.js";import"./ShortcutController-CV5b0BZl.js";import"./tinykeys-DwvDXsEb.js";import"lit/directives/unsafe-html.js";import"./IconManager.js";import"./translation.js";import"./en-us.js";import"./localization.js";import"./localization2.js";import"./localization3.js";import"./localization4.js";import"./localization5.js";import"./localization6.js";import"./localization7.js";import"./localization8.js";import"./localization9.js";import"./localization10.js";import"./localization11.js";import"./localization12.js";import"./localization13.js";import"./localization14.js";import"./localization15.js";import"./localization16.js";import"./localization17.js";import"./localization18.js";import"./localization19.js";import"./localization20.js";import"./localization21.js";import"./localization22.js";import"./localization23.js";import"./localization24.js";import"./events-Bv6wNHwJ.js";import"./positioning-D-K8Mueq.js";const C=()=>!0;class W{constructor(e,t){e.addController(this),this.options={enabled:C,...t}}hostConnected(){"undefined"!=typeof BroadcastChannel&&(this.channel=new BroadcastChannel(this.options.channelName),this.channel.addEventListener("message",this))}hostDisconnected(){var e,t;null===(e=this.channel)||void 0===e||e.removeEventListener("message",this),null===(t=this.channel)||void 0===t||t.close()}handleEvent(e){this.options.enabled()&&this.options.onMessage(e.data)}post(e){var t;this.options.enabled()&&(null===(t=this.channel)||void 0===t||t.postMessage(e))}}const j=a`:host{--_n-layout-padding:var(--n-layout-padding,var(--n-space-l));--_n-layout-drawer-inline-size:var(--n-layout-drawer-inline-size,320px);--_n-layout-drawer-min-inline-size:var(--n-layout-drawer-min-inline-size,0px);--_n-layout-background-color:var(--n-layout-background-color,var(--n-color-background));--_n-layout-nav-border-color:var(--n-layout-nav-border-color,var(--n-color-border));--_n-layout-nav-transition-duration:var(--n-transition-mobile);--_n-layout-header-size:var(--n-layout-header-size,var(--n-space-xxl));--_n-layout-header-size-s:calc(var(--n-space-xl) + var(--n-space-m));--_n-layout-footer-size:var(--n-space-xxl);--n-layout-main-min-inline-size:0;background:var(--_n-layout-background-color);color:var(--n-color-text);min-block-size:100vh}.n-layout{block-size:calc(100vh - var(--n-sticky-top) - var(--n-layout-block-size-offset, 0px))}.n-layout-main,.n-layout-nav{background:var(--_n-layout-background-color);min-block-size:100%}.n-layout-nav{box-shadow:var(--n-box-shadow-nav);inline-size:var(--_n-layout-nav-width);inset-block-end:0;inset-block-start:0;inset-inline-start:0;position:fixed;transform:translateX(var(--n-nav-transform));user-select:none;z-index:var(--n-layout-nav-z-index,var(--n-index-top-bar))}[data-screen=wide][data-collapse-mode=hide]:is(:not([data-nav=opened],[data-nav=closed])) .n-layout-nav{inline-size:fit-content;max-inline-size:min(var(--_n-layout-nav-max-width),100dvw);min-inline-size:var(--_n-layout-nav-min-width)}[data-screen=wide][data-collapse-mode=hide]:is(:not([data-nav=opened],[data-nav=closed])) .n-layout-nav>slot[name=nav]::slotted(*){inline-size:100%}.n-layout-main{position:relative}main{padding:var(--_n-layout-padding)}.n-has-top-bar{--_n-sticky-top:var(--_n-layout-header-size)}:host([sticky]) .n-has-header{--_n-sticky-size:var(--_n-layout-header-size)}:host([sticky-footer]) .n-has-footer slot[name=footer]::slotted(*){display:block;inset-inline-end:0;inset-inline-start:0;position:fixed;z-index:var(--n-layout-sticky-footer-z-index,calc(var(--n-index-top-bar, 1000) + 1))}[data-screen=wide]:host([sticky-footer]) .n-has-footer .n-layout-nav{z-index:var(--n-layout-nav-z-index,calc(var(--n-index-top-bar, 1000) + 2))}:host([sticky-footer][nav-open]) .n-has-footer slot[name=footer]::slotted(*){inset-inline-start:var(--_n-layout-nav-width,250px)}@media (min-width:768px){:host([sticky-footer]) .n-has-drawer.n-has-footer slot[name=footer]::slotted(*){--n-footer-padding-inline-end:calc(var(--n-footer-padding-inline, var(--n-space-l)) + var(--_n-layout-drawer-min-inline-size, 0px))}}aside{background:var(--n-layout-drawer-background-color,var(--n-color-surface));inline-size:var(--_n-layout-drawer-inline-size);inset-block:0;inset-inline-end:0;max-inline-size:100%;position:fixed;z-index:var(--n-index-nav)}:host([sticky-footer]) .n-has-footer aside{inset-block-end:var(--n-layout-footer-block-size,var(--_n-layout-footer-size))}.n-has-drawer .n-layout-content{margin-inline-end:var(--_n-layout-drawer-min-inline-size)}@media (min-width:1240px){:host{--n-layout-main-min-inline-size:600px}.n-has-drawer .n-layout-content{margin-inline-end:var(--_n-layout-drawer-inline-size)}aside{border-inline-start:var(--n-layout-drawer-border-inline-start-width,0) solid var(--n-layout-drawer-border-inline-start-color,var(--n-color-border))}}slot[name=drawer]::slotted(*){block-size:100%!important}.n-has-top-bar aside{inset-block-start:var(--_n-layout-header-size)}:is(.n-has-top-bar,.n-has-header) ::slotted(nord-notification-group){inset-block-start:var(--_n-layout-header-size)}:is([data-nav=closed],[data-nav=unpeek]) .n-layout-nav{transform:translateX(-110%)}.n-rtl:is([data-nav=closed],[data-nav=unpeek]) .n-layout-nav{transform:translateX(110%)}[data-screen=wide][data-collapse-mode=rail]:is([data-nav=closed],[data-nav=peek],[data-nav=unpeek],[data-nav=wait]) .n-layout-nav{border-end-end-radius:0;border-inline-end:1px solid var(--_n-layout-nav-border-color);border-start-end-radius:0;box-shadow:none;inline-size:var(--_n-layout-nav-rail-width);inset-block:0;overflow:visible;transform:none}[data-screen=wide][data-collapse-mode=rail]:not([data-nav=opened]) .n-layout-main{margin-inline-start:var(--_n-layout-nav-rail-width)}[data-screen=wide][data-collapse-mode=rail]:not([data-nav=opened]) .n-top-bar-container{inset-inline-start:var(--_n-layout-nav-rail-width)}[data-screen=wide][data-collapse-mode=rail]:not([data-nav=opened]) slot[name=footer]::slotted(*){inset-inline-start:var(--_n-layout-nav-rail-width)}[data-screen=wide][data-collapse-mode=rail]:not([data-nav=opened]) .n-collapse-btn{display:flex}[data-screen=wide][data-collapse-mode=rail]:not([data-nav=opened]) .n-collapse-btn nord-icon{transform:rotate(0)}.n-rtl[data-screen=wide][data-collapse-mode=rail]:not([data-nav=opened]) .n-collapse-btn nord-icon{transform:rotate(180deg)}[data-screen=narrow] .n-layout-nav{transition:transform var(--_n-layout-nav-transition-duration);z-index:var(--n-index-popout)}[data-screen=wide]:is(:not([data-nav=opened],[data-nav=closed])) .n-layout-nav{border-end-end-radius:var(--n-border-radius);border-start-end-radius:var(--n-border-radius);inset-block-end:var(--n-space-l);inset-block-start:calc(var(--n-space-m)*4);min-block-size:0;transition:transform var(--_n-layout-nav-transition-duration)}[data-screen=wide][data-nav=opened] .n-layout-nav{border-inline-end:1px solid var(--_n-layout-nav-border-color);box-shadow:none}[data-screen=wide][data-nav=opened]:not(.n-has-top-bar) .n-layout-nav{--n-navigation-header-padding-inline:calc(var(--n-space-l)/1.5)}.n-has-top-bar[data-screen=wide][data-nav=opened] .n-layout-nav{--n-navigation-header-background:var(--n-color-accent-secondary);--n-navigation-header-color:var(--n-color-text-on-accent);--n-navigation-header-divider:none;--n-navigation-header-toggle-icon-color:#ffffffd9;--n-navigation-header-focus-style:0 0 0 1px #fff inset,inset 0 0 0 100px #fff3;background:var(--n-color-accent-secondary);border-color:#0000;border-image-slice:1;border-image-source:linear-gradient(to bottom,#ffffff29 calc(var(--_n-layout-header-size) + 1px),var(--_n-layout-nav-border-color) calc(var(--_n-layout-header-size) + 1px));box-shadow:0 0 #0000}[data-screen=wide]:not([data-nav=opened]) .n-layout-nav{--n-navigation-header-block-size:var(--_n-layout-header-size-s);overflow:hidden}[data-screen=wide][data-nav=opened] .n-layout-main{margin-inline-start:var(--_n-layout-nav-width)}[data-screen=narrow] .n-layout-main:after{background:var(--n-color-overlay);content:"";inset:0;position:fixed;transition:opacity var(--n-transition-mobile),visibility var(--n-transition-mobile);z-index:var(--n-index-overlay)}[data-screen=narrow]:not([data-nav=opened],[data-nav=peek],[data-nav=blocked]) .n-layout-main:after{opacity:0;visibility:hidden}.n-resize{background:#0000;block-size:var(--n-layout-resize-block-size,100%);inline-size:10px;inset-block:0;inset-inline-end:-8px;margin-block:auto;position:absolute;touch-action:none}[data-nav=opened] .n-resize,[data-screen=wide][data-collapse-mode=rail]:not([data-nav=opened]) .n-resize{cursor:col-resize}.n-resize:after{background:var(--n-layout-resize-color,var(--n-color-accent));content:"";inline-size:3px;inset-block:0;inset-inline-end:5px;opacity:0;position:absolute;transition:opacity var(--n-transition-slowly);z-index:var(--n-index-sticky)}.n-resize:focus{outline:none}.n-dragging .n-resize:after,.n-resize:focus:after,[data-nav=opened] .n-resize:hover:after,[data-screen=wide][data-collapse-mode=rail]:not([data-nav=opened]) .n-resize:hover:after{opacity:1;transition-delay:.15s}@supports selector(:focus-visible){.n-resize:focus:after{opacity:0}.n-resize:focus-visible:after{opacity:1}}.n-dragging{cursor:col-resize!important;user-select:none}.n-resize-tooltip{transform:translateY(var(--n-resize-tooltip-y,0))}.n-dragging .n-resize-tooltip{opacity:0!important;visibility:hidden!important}:host([padding=none]){--_n-layout-padding:var(--n-layout-padding,0)}.n-top-bar-container{inset-block-start:0;inset-inline-end:0;inset-inline-start:var(--_n-layout-nav-width);position:fixed;z-index:var(--n-index-top-bar)}[data-screen=narrow] .n-top-bar-container,[data-screen=wide]:not([data-nav=opened]) .n-top-bar-container{inset-inline-start:0}.n-has-top-bar{--_n-layout-header-size:var(--_n-layout-header-size-s);--n-navigation-header-block-size:var(--_n-layout-header-size)}.n-has-top-bar :is([name=header],[name=drawer])::slotted(*){--n-header-block-size:var(--_n-layout-header-size)}.n-has-top-bar .n-layout-main{inset-block-start:var(--_n-layout-header-size)}.n-nav-toggle-container{align-items:center;block-size:var(--_n-layout-header-size);display:flex;padding-inline-start:var(--n-space-s);position:absolute;z-index:calc(var(--n-index-top-bar) + 1)}[data-screen=narrow] .n-nav-toggle-container{padding-inline-start:var(--n-space-xs)}.n-has-top-bar .n-nav-toggle-container,:host([sticky]) .n-nav-toggle-container{inset-block-start:0;position:fixed}[data-screen=wide][data-nav=opened] .n-nav-toggle-container{display:none}:host(:not([hide-default-nav-toggle])) .n-has-nav[data-screen=wide]:not([data-nav=opened]) ::slotted(nord-top-bar),:host(:not([hide-default-nav-toggle])) .n-has-nav[data-screen=wide]:not([data-nav=opened],.n-has-top-bar) ::slotted(nord-header[slot=header]){--_n-header-gutter:calc(var(--n-space-l)*1.8)}:host(:not([hide-default-nav-toggle])) .n-has-nav[data-screen=narrow] ::slotted(nord-top-bar),:host(:not([hide-default-nav-toggle])) .n-has-nav[data-screen=narrow]:not(.n-has-top-bar) ::slotted(nord-header[slot=header]){--_n-header-gutter:var(--n-space-xl)}.n-has-top-bar :is(nord-nav-toggle,::slotted(nord-nav-toggle)){--n-button-background-color:#0000;color:#ffffffd9}.n-has-top-bar :is(nord-nav-toggle,::slotted(nord-nav-toggle)):focus{--n-button-background-color:#0003}.n-collapse-btn{--_n-collapse-btn-size:var(--n-space-l);align-items:center;background:var(--n-color-button);block-size:var(--_n-collapse-btn-size);border:0;border-radius:var(--n-border-radius-circle);box-shadow:var(--n-box-shadow-card);color:var(--n-color-icon);cursor:pointer;display:flex;inline-size:var(--_n-collapse-btn-size);inset-block-start:calc(var(--_n-layout-header-size) + (var(--_n-layout-header-size) - var(--_n-collapse-btn-size))/2);inset-inline-start:calc(var(--_n-layout-nav-width) - var(--_n-collapse-btn-size)/2);justify-content:center;position:fixed;transition:opacity var(--n-transition-slowly),visibility var(--n-transition-slowly),background-color var(--n-transition-quickly),color var(--n-transition-quickly);z-index:var(--n-index-sticky)}.n-collapse-btn:hover{background:var(--n-color-accent);color:var(--n-color-text-on-accent)}.n-collapse-btn:focus{box-shadow:0 0 0 2px var(--n-color-accent),var(--n-box-shadow);outline:0}[data-screen=narrow] .n-collapse-btn,[data-screen=wide]:not([data-nav=opened]) .n-collapse-btn{display:none}@media (hover:hover) and (pointer:fine){.n-collapse-btn{opacity:0;visibility:hidden}.n-collapse-btn:focus,.n-layout-nav:hover .n-collapse-btn{opacity:1;visibility:visible}}.n-collapse-btn nord-icon{transform:rotate(180deg)}.n-rtl .n-collapse-btn nord-icon{transform:rotate(0)}slot[name=footer]::slotted(*){inset-block-end:0;inset-inline-end:0;inset-inline-start:var(--_n-layout-nav-width)}@media (min-width:1240px){.n-has-drawer slot[name=footer]::slotted(*){inset-inline-end:var(--_n-layout-drawer-inline-size)}}[data-screen=narrow] slot[name=footer]::slotted(*),[data-screen=wide]:not([data-nav=opened]) slot[name=footer]::slotted(*){inset-inline-start:0}:host([sticky-footer]) .n-has-footer .n-layout-content{padding-block-end:var(--_n-layout-footer-size)}@media (max-width:767px){:host([data-narrow-floating-drawer]) aside,:host([data-narrow-rail-bottom]) aside{inline-size:0;pointer-events:none;z-index:var(--n-layout-aside-narrow-z-index,calc(var(--n-index-top-bar, 1000) + 5))}:host([sticky-footer][data-narrow-rail-bottom]) .n-has-footer slot[name=footer]::slotted(*){inset-block-end:var(--n-aside-rail-narrow-block-size,56px)}:host([data-narrow-rail-bottom]) .n-layout-content{padding-block-end:var(--n-aside-rail-narrow-block-size,56px)}:host([sticky-footer][data-narrow-rail-bottom]) .n-layout-content{padding-block-end:calc(var(--n-aside-rail-narrow-block-size, 56px) + var(--n-layout-footer-block-size, var(--_n-layout-footer-size, 0px)))}}`;x.registerIcon(t);let T=0;const E=250,M="undefined"!=typeof matchMedia?matchMedia("(min-width: 768px)"):{matches:!1,addEventListener(){}},$=z("nord-layout.navWidth",E),O=z("nord-layout.navWidthDefault",E),D=z("nord-layout.navOpen",!0);function L(e){for(const t of e)if(t instanceof HTMLElement&&"nord-nav-toggle"===t.localName)return t;return null}function R(e){return null!==L(e.composedPath())}const H=b({opened:{toggle:"closed",close:"closed"},closed:{toggle:"opened",open:"opened",focusin:"peek",pointerenter:"peek"},peek:{toggle:"opened",focusout:"unpeek",pointerleave:"wait",dropdownOpen:"blocked",click:"unpeek",open:"opened"},blocked:{dropdownClose:"peek",open:"opened"},wait:{toggle:"opened",focusin:"peek",pointerenter:"peek",timeout:"unpeek"},unpeek:{toggle:"opened",focusin:"peek",pointerenter:"peek",transitionend:"closed"}});let B=class extends n{constructor(){super(...arguments),this.resizeTooltipId="n-layout-resize-tip-"+ ++T,this.navSlot=new m(this,"nav"),this.drawerSlot=new m(this,"drawer"),this.topBarSlot=new m(this,"top-bar"),this.headerSlot=new m(this,"header"),this.footerSlot=new m(this,"footer"),this.dividerTooltipSlot=new m(this,"tooltip-divider"),this.direction=new v(this),this.events=new p(this),this.localization=new N(this),this.lightDismiss=new u(this,{isOpen:()=>"opened"===this.navState&&!this.wideScreen,onDismiss:()=>this.navTransition("close"),isDismissible:e=>e!==this.navEl}),this.applyingRemote=!1,this.broadcast=new W(this,{channelName:"nord-layout-nav-state",enabled:()=>this.syncNavState&&this.wideScreen,onMessage:e=>{this.applyingRemote=!0,"navOpen"in e&&(this.navOpen=e.navOpen),"navWidth"in e&&(this.navWidth=e.navWidth),this.updateComplete.then((()=>{this.applyingRemote=!1}))}}),this.navWidth=$.value,this.isDragging=!1,this.wideScreen=M.matches,this.persistNavState=!1,this.syncNavState=!1,this.defaultNavWidth=E,this.minNavWidth=220,this.maxNavWidth=400,this.navRailWidth=64,this.padding="m",this.sticky=!1,this.stickyFooter=!1,this.hideDefaultNavToggle=!1,this.hideCollapseButton=!1,this.toggleOnResizeClick=!1,this.collapseMode="hide",this.handleFooterSlotChange=()=>{var e,t;const a=null===(e=this.footerSlotEl)||void 0===e?void 0:e.assignedElements({flatten:!0})[0];a!==this.observedFooterElement&&(null===(t=this.footerSizeObserver)||void 0===t||t.disconnect(),this.observedFooterElement=a,a?(this.footerSizeObserver=new ResizeObserver((()=>this.publishFooterSize())),this.footerSizeObserver.observe(a),this.publishFooterSize()):this.style.removeProperty("--n-layout-footer-block-size"))},this.handleMediaQueryChange=()=>{this.wideScreen=M.matches,this.navTransition(this.wideScreen?"open":"close")},this.handleToggleClick=e=>{R(e)||this.navTransition("toggle")},this.handleHostClick=e=>{R(e)&&this.navTransition("toggle")},this.handleHostMouseOver=e=>{const t=L(e.composedPath());t&&(e.relatedTarget instanceof Node&&t.contains(e.relatedTarget)||this.handleMouseEnter())},this.handleHostMouseOut=e=>{const t=L(e.composedPath());t&&(e.relatedTarget instanceof Node&&t.contains(e.relatedTarget)||this.handleMouseLeave())},this.handleNavFocus=()=>{this.wideScreen&&"rail"===this.collapseMode||this.navTransition("focusin")},this.handleMainFocus=()=>{this.navTransition("focusout")},this.handleMouseEnter=()=>{this.wideScreen&&"rail"!==this.collapseMode&&this.navTransition("pointerenter")},this.handleMouseLeave=()=>{this.wideScreen&&"rail"===this.collapseMode||this.navTransition("pointerleave")},this.handleTransitionEnd=()=>{this.navTransition("transitionend")},this.dragStartX=0,this.hasDragged=!1,this.handleResizeHoverMove=e=>{const t=e.currentTarget;if(!t||!this.resizeTooltipEl)return;const a=t.getBoundingClientRect(),n=e.clientY-(a.top+a.height/2);this.resizeTooltipEl.style.setProperty("--n-resize-tooltip-y",`${n}px`)},this.handleResizePointerLeave=()=>{var e;this.stopDragging(),null===(e=this.resizeTooltipEl)||void 0===e||e.style.removeProperty("--n-resize-tooltip-y")}}get isNarrow(){return!this.wideScreen}connectedCallback(){super.connectedCallback(),this.events.listen(M,"change",this.handleMediaQueryChange),this.addEventListener("click",this.handleHostClick),this.addEventListener("mouseover",this.handleHostMouseOver),this.addEventListener("mouseout",this.handleHostMouseOut)}disconnectedCallback(){var e,t;super.disconnectedCallback(),this.removeEventListener("click",this.handleHostClick),this.removeEventListener("mouseover",this.handleHostMouseOver),this.removeEventListener("mouseout",this.handleHostMouseOut),null===(e=this.headerSizeObserver)||void 0===e||e.disconnect(),this.headerSizeObserver=void 0,null===(t=this.footerSizeObserver)||void 0===t||t.disconnect(),this.footerSizeObserver=void 0,this.observedFooterElement=void 0,this.style.removeProperty("--n-layout-header-block-size"),this.style.removeProperty("--n-layout-footer-block-size")}firstUpdated(){"undefined"!=typeof ResizeObserver&&(this.stickyHeaderEl&&(this.headerSizeObserver=new ResizeObserver((()=>this.publishHeaderSize())),this.headerSizeObserver.observe(this.stickyHeaderEl),this.publishHeaderSize()),this.footerSlotEl&&(this.footerSlotEl.addEventListener("slotchange",this.handleFooterSlotChange),this.handleFooterSlotChange()))}publishHeaderSize(){var e,t;const a=null!==(t=null===(e=this.stickyHeaderEl)||void 0===e?void 0:e.getBoundingClientRect().height)&&void 0!==t?t:0;a>0?this.style.setProperty("--n-layout-header-block-size",`${a}px`):this.style.removeProperty("--n-layout-header-block-size")}publishFooterSize(){var e,t;const a=null!==(t=null===(e=this.observedFooterElement)||void 0===e?void 0:e.getBoundingClientRect().height)&&void 0!==t?t:0;a>0?this.style.setProperty("--n-layout-footer-block-size",`${a}px`):this.style.removeProperty("--n-layout-footer-block-size")}willUpdate(){this.hasUpdated||(Number.isFinite(this.defaultNavWidth)||(this.defaultNavWidth=E),Number.isFinite(this.minNavWidth)||(this.minNavWidth=220),Number.isFinite(this.maxNavWidth)||(this.maxNavWidth=400),O.value!==this.defaultNavWidth?(this.setNavWidth(this.defaultNavWidth),$.value=this.navWidth,O.value=this.defaultNavWidth):this.setNavWidth(this.navWidth),this.isNarrow||this.persistNavState&&!1===D.value?this.navState="closed":this.navState="opened")}render(){const{navWidth:e,navState:t,navSlot:a,headerSlot:n,footerSlot:s,topBarSlot:r,drawerSlot:l,isDragging:d,direction:v}=this,p=this.wideScreen&&"rail"===this.collapseMode&&"opened"!==t,u="opened"===t&&this.wideScreen?e:p?64:this.defaultNavWidth;return o`<div class="${h({"n-layout":!0,"n-rtl":v.isRTL,"n-dragging":d,"n-has-header":n.hasContent,"n-has-footer":s.hasContent,"n-has-top-bar":r.hasContent,"n-has-drawer":l.hasContent,"n-has-nav":a.hasContent})}" style="${c({"--_n-layout-nav-width":`${u}px`,"--_n-layout-nav-rail-width":`var(--n-layout-nav-rail-width, ${this.navRailWidth}px)`,"--_n-layout-nav-min-width":`${this.minNavWidth}px`,"--_n-layout-nav-max-width":`${this.maxNavWidth}px`})}" data-nav="${a.hasContent?t:"closed"}" data-screen="${this.wideScreen?"wide":"narrow"}" data-collapse-mode="${this.collapseMode}"><div id="n-layout-nav" class="n-layout-nav" ?hidden="${a.isEmpty}" @focusin="${this.handleNavFocus}" @mouseenter="${this.handleMouseEnter}" @mouseleave="${this.handleMouseLeave}" @open="${this.handleDropdownOpen}" @close="${this.handleDropdownClose}"><slot name="nav" @click="${this.handleNavClick}"></slot><div class="n-resize" role="separator" aria-orientation="vertical" tabindex="0" aria-label="${this.localization.term("resizeNavigation")}" aria-controls="n-layout-nav" aria-valuemin="${this.minNavWidth}" aria-valuemax="${this.maxNavWidth}" aria-valuenow="${this.resizeValueNow}" aria-valuetext="${g("opened"!==t,this.localization.term("navigationCollapsed"))}" aria-describedby="${g(this.dividerTooltipSlot.hasContent&&!d,this.resizeTooltipId)}" @pointerdown="${g("opened"===t||p,this.startDragging)}" @pointermove="${d?this.handleDrag:this.handleResizeHoverMove}" @pointerleave="${this.handleResizePointerLeave}" @pointerup="${this.stopDragging}" @keydown="${this.handleKeyboardResize}" ?hidden="${this.isNarrow}"></div>${this.dividerTooltipSlot.hasContent?o`<nord-tooltip id="${this.resizeTooltipId}" position="inline-end" class="n-resize-tooltip"><slot name="tooltip-divider"></slot></nord-tooltip>`:i} ${this.hideCollapseButton?i:this.renderNavCollapse()}</div><div class="n-layout-main" @focusin="${this.handleMainFocus}" @click="${this.handleMainClick}">${a.hasContent&&!this.hideDefaultNavToggle?this.renderNavToggle():i}<div class="n-top-bar-container"><slot name="top-bar"></slot></div><div class="n-layout-content"><div class="n-sticky"><slot name="header"></slot></div><main><slot></slot></main><slot name="footer"></slot></div><aside ?hidden="${this.drawerSlot.isEmpty}"><slot name="drawer"></slot></aside></div></div>`}renderNavToggle(){return o`<div class="n-nav-toggle-container"><slot name="nav-toggle" @click="${this.handleToggleClick}" @mouseover="${this.handleMouseEnter}" @mouseout="${this.handleMouseLeave}"><nord-nav-toggle></nord-nav-toggle></slot></div>`}renderNavCollapse(){return o`<button class="n-collapse-btn" @click="${this.handleToggleClick}"><nord-icon name="navigation-toggle-lock" size="s"></nord-icon></button>`}handleNavWidthChange(e){if($.value=this.navWidth,null!=e){const e=this.navWidth;this.dispatchEvent(new _(e))}}handleNavStateChange(e){switch("wait"===e&&this.peekTimeoutId&&clearTimeout(this.peekTimeoutId),"unpeek"===e&&this.navEl.removeEventListener("transitionend",this.handleTransitionEnd),this.navState){case"closed":this.navOpen=!1;break;case"opened":this.navOpen=!0;break;case"wait":this.peekTimeoutId=setTimeout((()=>this.navTransition("timeout")),300);break;case"unpeek":this.navEl.addEventListener("transitionend",this.handleTransitionEnd,{once:!0})}}handleOpenChange(e){if(this.isDragging||this.setNavWidth(Math.max(this.navWidth,this.defaultNavWidth)),this.navTransition(this.navOpen?"open":"close"),this.persistNavState&&(D.value=this.navOpen),null!=e){const e=this.navOpen;this.applyingRemote||this.broadcast.post({navOpen:e}),this.dispatchEvent(new S(e))}}navTransition(e){this.navState=H.transition(this.navState,e)}handleNavClick(e){if(!e.defaultPrevented&&!this.wideScreen){const a=e.target;(e=>"nord-nav-item"===e.localName)(t=a)&&!t.hasSubNav&&this.navTransition("close")}var t}handleMainClick(){this.navTransition("click")}handleDropdownOpen(e){"nord-dropdown"===e.target.localName&&this.navTransition("dropdownOpen")}handleDropdownClose(e){"nord-dropdown"===e.target.localName&&this.navTransition("dropdownClose")}get resizeValueNow(){return"opened"!==this.navState?this.minNavWidth:f(Math.round(this.navWidth),this.minNavWidth,this.maxNavWidth)}handleKeyboardResize(e){const{navWidth:t,direction:{isLTR:a}}=this;switch(e.key){case"ArrowLeft":this.setNavWidth(t+(a?-30:30));break;case"ArrowRight":this.setNavWidth(t+(a?30:-30));break;case"Enter":this.navTransition("toggle");break;case"Home":this.setNavWidth(this.minNavWidth);break;case"End":this.setNavWidth(this.maxNavWidth);break;default:return}this.broadcast.post({navWidth:this.navWidth}),e.preventDefault()}setNavWidth(e){this.navWidth=f(Math.round(e),this.minNavWidth,this.maxNavWidth)}startDragging(e){if(0===e.button){e.target.setPointerCapture(e.pointerId),this.isDragging=!0,this.dragStartX=e.clientX,this.hasDragged=!1}}stopDragging(){this.isDragging&&this.toggleOnResizeClick&&!this.hasDragged&&this.navTransition("toggle"),this.isDragging=!1,this.hasDragged=!1,this.broadcast.post({navWidth:this.navWidth})}handleDrag(e){if(!this.hasDragged&&Math.abs(e.clientX-this.dragStartX)<4)return;this.hasDragged=!0;const t=this.direction.isRTL?this.clientWidth-e.clientX:e.clientX;this.setNavWidth(t),this.navTransition(t>=100?"open":"close")}};B.styles=[w,k,j],e([s(".n-layout-nav",!0)],B.prototype,"navEl",void 0),e([s(".n-resize-tooltip")],B.prototype,"resizeTooltipEl",void 0),e([s(".n-sticky")],B.prototype,"stickyHeaderEl",void 0),e([s('slot[name="footer"]')],B.prototype,"footerSlotEl",void 0),e([r()],B.prototype,"navWidth",void 0),e([r()],B.prototype,"isDragging",void 0),e([r()],B.prototype,"navState",void 0),e([r()],B.prototype,"wideScreen",void 0),e([l({reflect:!0,type:Boolean,attribute:"nav-open"})],B.prototype,"navOpen",void 0),e([l({reflect:!0,type:Boolean,attribute:"persist-nav-state"})],B.prototype,"persistNavState",void 0),e([l({type:Boolean,reflect:!0,attribute:"sync-nav-state"})],B.prototype,"syncNavState",void 0),e([l({type:Number,reflect:!0,attribute:"default-nav-width"})],B.prototype,"defaultNavWidth",void 0),e([l({type:Number,reflect:!0,attribute:"min-nav-width"})],B.prototype,"minNavWidth",void 0),e([l({type:Number,reflect:!0,attribute:"max-nav-width"})],B.prototype,"maxNavWidth",void 0),e([l({type:Number,reflect:!0,attribute:"nav-rail-width"})],B.prototype,"navRailWidth",void 0),e([l({reflect:!0})],B.prototype,"padding",void 0),e([l({type:Boolean,reflect:!0})],B.prototype,"sticky",void 0),e([l({type:Boolean,reflect:!0,attribute:"sticky-footer"})],B.prototype,"stickyFooter",void 0),e([l({type:Boolean,reflect:!0,attribute:"hide-default-nav-toggle"})],B.prototype,"hideDefaultNavToggle",void 0),e([l({type:Boolean,reflect:!0,attribute:"hide-collapse-button"})],B.prototype,"hideCollapseButton",void 0),e([l({type:Boolean,reflect:!0,attribute:"toggle-on-resize-click"})],B.prototype,"toggleOnResizeClick",void 0),e([l({reflect:!0,attribute:"collapse-mode"})],B.prototype,"collapseMode",void 0),e([y("navWidth","updated")],B.prototype,"handleNavWidthChange",null),e([y("navState")],B.prototype,"handleNavStateChange",null),e([y("navOpen","updated")],B.prototype,"handleOpenChange",null),B=e([d("nord-layout")],B);var F=B;export{F as default};
1
+ import{_ as e}from"./tslib.es6-CmLYFWVC.js";import{l as t}from"./NavToggle-ROsuaJkW.js";import{css as n,LitElement as a,html as i,nothing as o}from"lit";import{query as s,state as r,property as l,customElement as d}from"lit/decorators.js";import{classMap as h}from"lit/directives/class-map.js";import{styleMap as c}from"lit/directives/style-map.js";import{D as v}from"./DirectionController-ChvNGESZ.js";import{E as p}from"./EventController-BBOmvfLa.js";import{L as u}from"./LightDismissController-wcL1ziJa.js";import{S as m}from"./SlotController-Z6eG7LSZ.js";import{o as y}from"./observe-D0n0zOfU.js";import{c as g}from"./cond-CI1KbneT.js";import{f as b}from"./fsm-Bq5jMQrK.js";import{c as f}from"./number-Dg2vCfGd.js";import{s as z}from"./storage-CGZ-YX4-.js";import{s as w}from"./Component-BJ5O5n8k.js";import{s as k}from"./Sticky-CZImMrGj.js";import x from"./Icon.js";import{LocalizeController as N}from"./LocalizeController.js";import{NavOpenChangeEvent as S}from"./NavOpenChangeEvent.js";import{NavResizeEvent as C}from"./NavResizeEvent.js";import"./Tooltip.js";import"lit/directives/ref.js";import"./FocusableMixin-BlQLNPdJ.js";import"./Button.js";import"./LightDomController-DIwtVelV.js";import"./InputMixin-LetXsCyv.js";import"./Spinner.js";import"lit/directives/if-defined.js";import"./VisuallyHidden.js";import"./ShortcutController-CV5b0BZl.js";import"./tinykeys-DwvDXsEb.js";import"lit/directives/unsafe-html.js";import"./IconManager.js";import"./translation.js";import"./en-us.js";import"./localization.js";import"./localization2.js";import"./localization3.js";import"./localization4.js";import"./localization5.js";import"./localization6.js";import"./localization7.js";import"./localization8.js";import"./localization9.js";import"./localization10.js";import"./localization11.js";import"./localization12.js";import"./localization13.js";import"./localization14.js";import"./localization15.js";import"./localization16.js";import"./localization17.js";import"./localization18.js";import"./localization19.js";import"./localization20.js";import"./localization21.js";import"./localization22.js";import"./localization23.js";import"./localization24.js";import"./events-Bv6wNHwJ.js";import"./positioning-D-K8Mueq.js";const _=()=>!0,W=(e,t)=>t;class j{constructor(e,t){this.handleVisibilityChange=()=>{if("undefined"!=typeof document&&document.hidden)return;const e=this.pending;this.pending=void 0,e&&this.options.enabled()&&this.options.onMessage(e.value)},e.addController(this),this.options={enabled:_,coalesce:W,...t}}hostConnected(){"undefined"!=typeof BroadcastChannel&&(this.channel=new BroadcastChannel(this.options.channelName),this.channel.addEventListener("message",this)),"undefined"!=typeof document&&document.addEventListener("visibilitychange",this.handleVisibilityChange)}hostDisconnected(){var e,t;null===(e=this.channel)||void 0===e||e.removeEventListener("message",this),null===(t=this.channel)||void 0===t||t.close(),"undefined"!=typeof document&&document.removeEventListener("visibilitychange",this.handleVisibilityChange),this.pending=void 0}handleEvent(e){var t;this.options.enabled()&&("undefined"!=typeof document&&document.hidden?this.pending={value:this.options.coalesce(null===(t=this.pending)||void 0===t?void 0:t.value,e.data)}:this.options.onMessage(e.data))}post(e){var t;this.options.enabled()&&(null===(t=this.channel)||void 0===t||t.postMessage(e))}}const T=n`:host{--_n-layout-padding:var(--n-layout-padding,var(--n-space-l));--_n-layout-drawer-inline-size:var(--n-layout-drawer-inline-size,320px);--_n-layout-drawer-min-inline-size:var(--n-layout-drawer-min-inline-size,0px);--_n-layout-background-color:var(--n-layout-background-color,var(--n-color-background));--_n-layout-nav-border-color:var(--n-layout-nav-border-color,var(--n-color-border));--_n-layout-nav-transition-duration:var(--n-transition-mobile);--_n-layout-header-size:var(--n-layout-header-size,var(--n-space-xxl));--_n-layout-header-size-s:calc(var(--n-space-xl) + var(--n-space-m));--_n-layout-footer-size:var(--n-space-xxl);--n-layout-main-min-inline-size:0;background:var(--_n-layout-background-color);color:var(--n-color-text);min-block-size:100vh}.n-layout{block-size:calc(100vh - var(--n-sticky-top) - var(--n-layout-block-size-offset, 0px))}.n-layout-main,.n-layout-nav{background:var(--_n-layout-background-color);min-block-size:100%}.n-layout-nav{box-shadow:var(--n-box-shadow-nav);inline-size:var(--_n-layout-nav-width);inset-block-end:0;inset-block-start:0;inset-inline-start:0;position:fixed;transform:translateX(var(--n-nav-transform));user-select:none;z-index:var(--n-layout-nav-z-index,var(--n-index-top-bar))}[data-screen=wide][data-collapse-mode=hide]:is(:not([data-nav=opened],[data-nav=closed])) .n-layout-nav{inline-size:fit-content;max-inline-size:min(var(--_n-layout-nav-max-width),100dvw);min-inline-size:var(--_n-layout-nav-min-width)}[data-screen=wide][data-collapse-mode=hide]:is(:not([data-nav=opened],[data-nav=closed])) .n-layout-nav>slot[name=nav]::slotted(*){inline-size:100%}.n-layout-main{position:relative}main{padding:var(--_n-layout-padding)}.n-has-top-bar{--_n-sticky-top:var(--_n-layout-header-size)}:host([sticky]) .n-has-header{--_n-sticky-size:var(--_n-layout-header-size)}:host([sticky-footer]) .n-has-footer slot[name=footer]::slotted(*){display:block;inset-inline-end:0;inset-inline-start:0;position:fixed;z-index:var(--n-layout-sticky-footer-z-index,calc(var(--n-index-top-bar, 1000) + 1))}[data-screen=wide]:host([sticky-footer]) .n-has-footer .n-layout-nav{z-index:var(--n-layout-nav-z-index,calc(var(--n-index-top-bar, 1000) + 2))}:host([sticky-footer][nav-open]) .n-has-footer slot[name=footer]::slotted(*){inset-inline-start:var(--_n-layout-nav-width,250px)}@media (min-width:768px){:host([sticky-footer]) .n-has-drawer.n-has-footer slot[name=footer]::slotted(*){--n-footer-padding-inline-end:calc(var(--n-footer-padding-inline, var(--n-space-l)) + var(--_n-layout-drawer-min-inline-size, 0px))}}aside{background:var(--n-layout-drawer-background-color,var(--n-color-surface));inline-size:var(--_n-layout-drawer-inline-size);inset-block:0;inset-inline-end:0;max-inline-size:100%;position:fixed;z-index:var(--n-index-nav)}:host([sticky-footer]) .n-has-footer aside{inset-block-end:var(--n-layout-footer-block-size,var(--_n-layout-footer-size))}.n-has-drawer .n-layout-content{margin-inline-end:var(--_n-layout-drawer-min-inline-size)}@media (min-width:1240px){:host{--n-layout-main-min-inline-size:600px}.n-has-drawer .n-layout-content{margin-inline-end:var(--_n-layout-drawer-inline-size)}aside{border-inline-start:var(--n-layout-drawer-border-inline-start-width,0) solid var(--n-layout-drawer-border-inline-start-color,var(--n-color-border))}}slot[name=drawer]::slotted(*){block-size:100%!important}.n-has-top-bar aside{inset-block-start:var(--_n-layout-header-size)}:is(.n-has-top-bar,.n-has-header) ::slotted(nord-notification-group){inset-block-start:var(--_n-layout-header-size)}:is([data-nav=closed],[data-nav=unpeek]) .n-layout-nav{transform:translateX(-110%)}.n-rtl:is([data-nav=closed],[data-nav=unpeek]) .n-layout-nav{transform:translateX(110%)}[data-screen=wide][data-collapse-mode=rail]:is([data-nav=closed],[data-nav=peek],[data-nav=unpeek],[data-nav=wait]) .n-layout-nav{border-end-end-radius:0;border-inline-end:1px solid var(--_n-layout-nav-border-color);border-start-end-radius:0;box-shadow:none;inline-size:var(--_n-layout-nav-rail-width);inset-block:0;overflow:visible;transform:none}[data-screen=wide][data-collapse-mode=rail]:not([data-nav=opened]) .n-layout-main{margin-inline-start:var(--_n-layout-nav-rail-width)}[data-screen=wide][data-collapse-mode=rail]:not([data-nav=opened]) .n-top-bar-container{inset-inline-start:var(--_n-layout-nav-rail-width)}[data-screen=wide][data-collapse-mode=rail]:not([data-nav=opened]) slot[name=footer]::slotted(*){inset-inline-start:var(--_n-layout-nav-rail-width)}[data-screen=wide][data-collapse-mode=rail]:not([data-nav=opened]) .n-collapse-btn{display:flex}[data-screen=wide][data-collapse-mode=rail]:not([data-nav=opened]) .n-collapse-btn nord-icon{transform:rotate(0)}.n-rtl[data-screen=wide][data-collapse-mode=rail]:not([data-nav=opened]) .n-collapse-btn nord-icon{transform:rotate(180deg)}[data-screen=narrow] .n-layout-nav{transition:transform var(--_n-layout-nav-transition-duration);z-index:var(--n-index-popout)}[data-screen=wide]:is(:not([data-nav=opened],[data-nav=closed])) .n-layout-nav{border-end-end-radius:var(--n-border-radius);border-start-end-radius:var(--n-border-radius);inset-block-end:var(--n-space-l);inset-block-start:calc(var(--n-space-m)*4);min-block-size:0;transition:transform var(--_n-layout-nav-transition-duration)}[data-screen=wide][data-nav=opened] .n-layout-nav{border-inline-end:1px solid var(--_n-layout-nav-border-color);box-shadow:none}[data-screen=wide][data-nav=opened]:not(.n-has-top-bar) .n-layout-nav{--n-navigation-header-padding-inline:calc(var(--n-space-l)/1.5)}.n-has-top-bar[data-screen=wide][data-nav=opened] .n-layout-nav{--n-navigation-header-background:var(--n-color-accent-secondary);--n-navigation-header-color:var(--n-color-text-on-accent);--n-navigation-header-divider:none;--n-navigation-header-toggle-icon-color:#ffffffd9;--n-navigation-header-focus-style:0 0 0 1px #fff inset,inset 0 0 0 100px #fff3;background:var(--n-color-accent-secondary);border-color:#0000;border-image-slice:1;border-image-source:linear-gradient(to bottom,#ffffff29 calc(var(--_n-layout-header-size) + 1px),var(--_n-layout-nav-border-color) calc(var(--_n-layout-header-size) + 1px));box-shadow:0 0 #0000}[data-screen=wide]:not([data-nav=opened]) .n-layout-nav{--n-navigation-header-block-size:var(--_n-layout-header-size-s);overflow:hidden}[data-screen=wide][data-nav=opened] .n-layout-main{margin-inline-start:var(--_n-layout-nav-width)}[data-screen=narrow] .n-layout-main:after{background:var(--n-color-overlay);content:"";inset:0;position:fixed;transition:opacity var(--n-transition-mobile),visibility var(--n-transition-mobile);z-index:var(--n-index-overlay)}[data-screen=narrow]:not([data-nav=opened],[data-nav=peek],[data-nav=blocked]) .n-layout-main:after{opacity:0;visibility:hidden}.n-resize{background:#0000;block-size:var(--n-layout-resize-block-size,100%);inline-size:10px;inset-block:0;inset-inline-end:-8px;margin-block:auto;position:absolute;touch-action:none}[data-nav=opened] .n-resize,[data-screen=wide][data-collapse-mode=rail]:not([data-nav=opened]) .n-resize{cursor:col-resize}.n-resize:after{background:var(--n-layout-resize-color,var(--n-color-accent));content:"";inline-size:3px;inset-block:0;inset-inline-end:5px;opacity:0;position:absolute;transition:opacity var(--n-transition-slowly);z-index:var(--n-index-sticky)}.n-resize:focus{outline:none}.n-dragging .n-resize:after,.n-resize:focus:after,[data-nav=opened] .n-resize:hover:after,[data-screen=wide][data-collapse-mode=rail]:not([data-nav=opened]) .n-resize:hover:after{opacity:1;transition-delay:.15s}@supports selector(:focus-visible){.n-resize:focus:after{opacity:0}.n-resize:focus-visible:after{opacity:1}}.n-dragging{cursor:col-resize!important;user-select:none}.n-resize-tooltip{transform:translateY(var(--n-resize-tooltip-y,0))}.n-dragging .n-resize-tooltip{opacity:0!important;visibility:hidden!important}:host([padding=none]){--_n-layout-padding:var(--n-layout-padding,0)}.n-top-bar-container{inset-block-start:0;inset-inline-end:0;inset-inline-start:var(--_n-layout-nav-width);position:fixed;z-index:var(--n-index-top-bar)}[data-screen=narrow] .n-top-bar-container,[data-screen=wide]:not([data-nav=opened]) .n-top-bar-container{inset-inline-start:0}.n-has-top-bar{--_n-layout-header-size:var(--_n-layout-header-size-s);--n-navigation-header-block-size:var(--_n-layout-header-size)}.n-has-top-bar :is([name=header],[name=drawer])::slotted(*){--n-header-block-size:var(--_n-layout-header-size)}.n-has-top-bar .n-layout-main{inset-block-start:var(--_n-layout-header-size)}.n-nav-toggle-container{align-items:center;block-size:var(--_n-layout-header-size);display:flex;padding-inline-start:var(--n-space-s);position:absolute;z-index:calc(var(--n-index-top-bar) + 1)}[data-screen=narrow] .n-nav-toggle-container{padding-inline-start:var(--n-space-xs)}.n-has-top-bar .n-nav-toggle-container,:host([sticky]) .n-nav-toggle-container{inset-block-start:0;position:fixed}[data-screen=wide][data-nav=opened] .n-nav-toggle-container{display:none}:host(:not([hide-default-nav-toggle])) .n-has-nav[data-screen=wide]:not([data-nav=opened]) ::slotted(nord-top-bar),:host(:not([hide-default-nav-toggle])) .n-has-nav[data-screen=wide]:not([data-nav=opened],.n-has-top-bar) ::slotted(nord-header[slot=header]){--_n-header-gutter:calc(var(--n-space-l)*1.8)}:host(:not([hide-default-nav-toggle])) .n-has-nav[data-screen=narrow] ::slotted(nord-top-bar),:host(:not([hide-default-nav-toggle])) .n-has-nav[data-screen=narrow]:not(.n-has-top-bar) ::slotted(nord-header[slot=header]){--_n-header-gutter:var(--n-space-xl)}.n-has-top-bar :is(nord-nav-toggle,::slotted(nord-nav-toggle)){--n-button-background-color:#0000;color:#ffffffd9}.n-has-top-bar :is(nord-nav-toggle,::slotted(nord-nav-toggle)):focus{--n-button-background-color:#0003}.n-collapse-btn{--_n-collapse-btn-size:var(--n-space-l);align-items:center;background:var(--n-color-button);block-size:var(--_n-collapse-btn-size);border:0;border-radius:var(--n-border-radius-circle);box-shadow:var(--n-box-shadow-card);color:var(--n-color-icon);cursor:pointer;display:flex;inline-size:var(--_n-collapse-btn-size);inset-block-start:calc(var(--_n-layout-header-size) + (var(--_n-layout-header-size) - var(--_n-collapse-btn-size))/2);inset-inline-start:calc(var(--_n-layout-nav-width) - var(--_n-collapse-btn-size)/2);justify-content:center;position:fixed;transition:opacity var(--n-transition-slowly),visibility var(--n-transition-slowly),background-color var(--n-transition-quickly),color var(--n-transition-quickly);z-index:var(--n-index-sticky)}.n-collapse-btn:hover{background:var(--n-color-accent);color:var(--n-color-text-on-accent)}.n-collapse-btn:focus{box-shadow:0 0 0 2px var(--n-color-accent),var(--n-box-shadow);outline:0}[data-screen=narrow] .n-collapse-btn,[data-screen=wide]:not([data-nav=opened]) .n-collapse-btn{display:none}@media (hover:hover) and (pointer:fine){.n-collapse-btn{opacity:0;visibility:hidden}.n-collapse-btn:focus,.n-layout-nav:hover .n-collapse-btn{opacity:1;visibility:visible}}.n-collapse-btn nord-icon{transform:rotate(180deg)}.n-rtl .n-collapse-btn nord-icon{transform:rotate(0)}slot[name=footer]::slotted(*){inset-block-end:0;inset-inline-end:0;inset-inline-start:var(--_n-layout-nav-width)}@media (min-width:1240px){.n-has-drawer slot[name=footer]::slotted(*){inset-inline-end:var(--_n-layout-drawer-inline-size)}}[data-screen=narrow] slot[name=footer]::slotted(*),[data-screen=wide]:not([data-nav=opened]) slot[name=footer]::slotted(*){inset-inline-start:0}:host([sticky-footer]) .n-has-footer .n-layout-content{padding-block-end:var(--_n-layout-footer-size)}@media (max-width:767px){:host([data-narrow-floating-drawer]) aside,:host([data-narrow-rail-bottom]) aside{inline-size:0;pointer-events:none;z-index:var(--n-layout-aside-narrow-z-index,calc(var(--n-index-top-bar, 1000) + 5))}:host([sticky-footer][data-narrow-rail-bottom]) .n-has-footer slot[name=footer]::slotted(*){inset-block-end:var(--n-aside-rail-narrow-block-size,56px)}:host([data-narrow-rail-bottom]) .n-layout-content{padding-block-end:var(--n-aside-rail-narrow-block-size,56px)}:host([sticky-footer][data-narrow-rail-bottom]) .n-layout-content{padding-block-end:calc(var(--n-aside-rail-narrow-block-size, 56px) + var(--n-layout-footer-block-size, var(--_n-layout-footer-size, 0px)))}}`;x.registerIcon(t);let E=0;const M=250,O="undefined"!=typeof matchMedia?matchMedia("(min-width: 768px)"):{matches:!1,addEventListener(){}},$=z("nord-layout.navWidth",M),D=z("nord-layout.navWidthDefault",M),L=z("nord-layout.navOpen",!0);function R(e){for(const t of e)if(t instanceof HTMLElement&&"nord-nav-toggle"===t.localName)return t;return null}function H(e){return null!==R(e.composedPath())}const B=b({opened:{toggle:"closed",close:"closed"},closed:{toggle:"opened",open:"opened",focusin:"peek",pointerenter:"peek"},peek:{toggle:"opened",focusout:"unpeek",pointerleave:"wait",dropdownOpen:"blocked",click:"unpeek",open:"opened"},blocked:{dropdownClose:"peek",open:"opened"},wait:{toggle:"opened",focusin:"peek",pointerenter:"peek",timeout:"unpeek"},unpeek:{toggle:"opened",focusin:"peek",pointerenter:"peek",transitionend:"closed"}});let F=class extends a{constructor(){super(...arguments),this.resizeTooltipId="n-layout-resize-tip-"+ ++E,this.navSlot=new m(this,"nav"),this.drawerSlot=new m(this,"drawer"),this.topBarSlot=new m(this,"top-bar"),this.headerSlot=new m(this,"header"),this.footerSlot=new m(this,"footer"),this.dividerTooltipSlot=new m(this,"tooltip-divider"),this.direction=new v(this),this.events=new p(this),this.localization=new N(this),this.lightDismiss=new u(this,{isOpen:()=>"opened"===this.navState&&!this.wideScreen,onDismiss:()=>this.navTransition("close"),isDismissible:e=>e!==this.navEl}),this.applyingRemote=!1,this.broadcast=new j(this,{channelName:"nord-layout-nav-state",enabled:()=>this.syncNavState&&this.wideScreen,coalesce:(e,t)=>({...e,...t}),onMessage:e=>{this.applyingRemote=!0,void 0!==e.navOpen&&e.navOpen!==this.navOpen&&(this.navOpen=e.navOpen),void 0!==e.navWidth&&e.navWidth!==this.navWidth&&(this.navWidth=e.navWidth),this.updateComplete.then((()=>{this.applyingRemote=!1}))}}),this.navWidth=$.value,this.isDragging=!1,this.wideScreen=O.matches,this.persistNavState=!1,this.syncNavState=!1,this.defaultNavWidth=M,this.minNavWidth=220,this.maxNavWidth=400,this.navRailWidth=64,this.padding="m",this.sticky=!1,this.stickyFooter=!1,this.hideDefaultNavToggle=!1,this.hideCollapseButton=!1,this.toggleOnResizeClick=!1,this.collapseMode="hide",this.handleFooterSlotChange=()=>{var e,t;const n=null===(e=this.footerSlotEl)||void 0===e?void 0:e.assignedElements({flatten:!0})[0];n!==this.observedFooterElement&&(null===(t=this.footerSizeObserver)||void 0===t||t.disconnect(),this.observedFooterElement=n,n?(this.footerSizeObserver=new ResizeObserver((()=>this.publishFooterSize())),this.footerSizeObserver.observe(n),this.publishFooterSize()):this.style.removeProperty("--n-layout-footer-block-size"))},this.handleMediaQueryChange=()=>{this.wideScreen=O.matches,this.navTransition(this.wideScreen?"open":"close")},this.handleToggleClick=e=>{H(e)||this.navTransition("toggle")},this.handleHostClick=e=>{H(e)&&this.navTransition("toggle")},this.handleHostMouseOver=e=>{const t=R(e.composedPath());t&&(e.relatedTarget instanceof Node&&t.contains(e.relatedTarget)||this.handleMouseEnter())},this.handleHostMouseOut=e=>{const t=R(e.composedPath());t&&(e.relatedTarget instanceof Node&&t.contains(e.relatedTarget)||this.handleMouseLeave())},this.handleNavFocus=()=>{this.wideScreen&&"rail"===this.collapseMode||this.navTransition("focusin")},this.handleMainFocus=()=>{this.navTransition("focusout")},this.handleMouseEnter=()=>{this.wideScreen&&"rail"!==this.collapseMode&&this.navTransition("pointerenter")},this.handleMouseLeave=()=>{this.wideScreen&&"rail"===this.collapseMode||this.navTransition("pointerleave")},this.handleTransitionEnd=()=>{this.navTransition("transitionend")},this.dragStartX=0,this.hasDragged=!1,this.handleResizeHoverMove=e=>{const t=e.currentTarget;if(!t||!this.resizeTooltipEl)return;const n=t.getBoundingClientRect(),a=e.clientY-(n.top+n.height/2);this.resizeTooltipEl.style.setProperty("--n-resize-tooltip-y",`${a}px`)},this.handleResizePointerLeave=()=>{var e;this.stopDragging(),null===(e=this.resizeTooltipEl)||void 0===e||e.style.removeProperty("--n-resize-tooltip-y")}}get isNarrow(){return!this.wideScreen}connectedCallback(){super.connectedCallback(),this.events.listen(O,"change",this.handleMediaQueryChange),this.addEventListener("click",this.handleHostClick),this.addEventListener("mouseover",this.handleHostMouseOver),this.addEventListener("mouseout",this.handleHostMouseOut)}disconnectedCallback(){var e,t;super.disconnectedCallback(),this.removeEventListener("click",this.handleHostClick),this.removeEventListener("mouseover",this.handleHostMouseOver),this.removeEventListener("mouseout",this.handleHostMouseOut),null===(e=this.headerSizeObserver)||void 0===e||e.disconnect(),this.headerSizeObserver=void 0,null===(t=this.footerSizeObserver)||void 0===t||t.disconnect(),this.footerSizeObserver=void 0,this.observedFooterElement=void 0,this.style.removeProperty("--n-layout-header-block-size"),this.style.removeProperty("--n-layout-footer-block-size")}firstUpdated(){"undefined"!=typeof ResizeObserver&&(this.stickyHeaderEl&&(this.headerSizeObserver=new ResizeObserver((()=>this.publishHeaderSize())),this.headerSizeObserver.observe(this.stickyHeaderEl),this.publishHeaderSize()),this.footerSlotEl&&(this.footerSlotEl.addEventListener("slotchange",this.handleFooterSlotChange),this.handleFooterSlotChange()))}publishHeaderSize(){var e,t;const n=null!==(t=null===(e=this.stickyHeaderEl)||void 0===e?void 0:e.getBoundingClientRect().height)&&void 0!==t?t:0;n>0?this.style.setProperty("--n-layout-header-block-size",`${n}px`):this.style.removeProperty("--n-layout-header-block-size")}publishFooterSize(){var e,t;const n=null!==(t=null===(e=this.observedFooterElement)||void 0===e?void 0:e.getBoundingClientRect().height)&&void 0!==t?t:0;n>0?this.style.setProperty("--n-layout-footer-block-size",`${n}px`):this.style.removeProperty("--n-layout-footer-block-size")}willUpdate(){this.hasUpdated||(Number.isFinite(this.defaultNavWidth)||(this.defaultNavWidth=M),Number.isFinite(this.minNavWidth)||(this.minNavWidth=220),Number.isFinite(this.maxNavWidth)||(this.maxNavWidth=400),D.value!==this.defaultNavWidth?(this.setNavWidth(this.defaultNavWidth),$.value=this.navWidth,D.value=this.defaultNavWidth):this.setNavWidth(this.navWidth),this.isNarrow||this.persistNavState&&!1===L.value?this.navState="closed":this.navState="opened")}render(){const{navWidth:e,navState:t,navSlot:n,headerSlot:a,footerSlot:s,topBarSlot:r,drawerSlot:l,isDragging:d,direction:v}=this,p=this.wideScreen&&"rail"===this.collapseMode&&"opened"!==t,u="opened"===t&&this.wideScreen?e:p?64:this.defaultNavWidth;return i`<div class="${h({"n-layout":!0,"n-rtl":v.isRTL,"n-dragging":d,"n-has-header":a.hasContent,"n-has-footer":s.hasContent,"n-has-top-bar":r.hasContent,"n-has-drawer":l.hasContent,"n-has-nav":n.hasContent})}" style="${c({"--_n-layout-nav-width":`${u}px`,"--_n-layout-nav-rail-width":`var(--n-layout-nav-rail-width, ${this.navRailWidth}px)`,"--_n-layout-nav-min-width":`${this.minNavWidth}px`,"--_n-layout-nav-max-width":`${this.maxNavWidth}px`})}" data-nav="${n.hasContent?t:"closed"}" data-screen="${this.wideScreen?"wide":"narrow"}" data-collapse-mode="${this.collapseMode}"><div id="n-layout-nav" class="n-layout-nav" ?hidden="${n.isEmpty}" @focusin="${this.handleNavFocus}" @mouseenter="${this.handleMouseEnter}" @mouseleave="${this.handleMouseLeave}" @open="${this.handleDropdownOpen}" @close="${this.handleDropdownClose}"><slot name="nav" @click="${this.handleNavClick}"></slot><div class="n-resize" role="separator" aria-orientation="vertical" tabindex="0" aria-label="${this.localization.term("resizeNavigation")}" aria-controls="n-layout-nav" aria-valuemin="${this.minNavWidth}" aria-valuemax="${this.maxNavWidth}" aria-valuenow="${this.resizeValueNow}" aria-valuetext="${g("opened"!==t,this.localization.term("navigationCollapsed"))}" aria-describedby="${g(this.dividerTooltipSlot.hasContent&&!d,this.resizeTooltipId)}" @pointerdown="${g("opened"===t||p,this.startDragging)}" @pointermove="${d?this.handleDrag:this.handleResizeHoverMove}" @pointerleave="${this.handleResizePointerLeave}" @pointerup="${this.stopDragging}" @keydown="${this.handleKeyboardResize}" ?hidden="${this.isNarrow}"></div>${this.dividerTooltipSlot.hasContent?i`<nord-tooltip id="${this.resizeTooltipId}" position="inline-end" class="n-resize-tooltip"><slot name="tooltip-divider"></slot></nord-tooltip>`:o} ${this.hideCollapseButton?o:this.renderNavCollapse()}</div><div class="n-layout-main" @focusin="${this.handleMainFocus}" @click="${this.handleMainClick}">${n.hasContent&&!this.hideDefaultNavToggle?this.renderNavToggle():o}<div class="n-top-bar-container"><slot name="top-bar"></slot></div><div class="n-layout-content"><div class="n-sticky"><slot name="header"></slot></div><main><slot></slot></main><slot name="footer"></slot></div><aside ?hidden="${this.drawerSlot.isEmpty}"><slot name="drawer"></slot></aside></div></div>`}renderNavToggle(){return i`<div class="n-nav-toggle-container"><slot name="nav-toggle" @click="${this.handleToggleClick}" @mouseover="${this.handleMouseEnter}" @mouseout="${this.handleMouseLeave}"><nord-nav-toggle></nord-nav-toggle></slot></div>`}renderNavCollapse(){return i`<button class="n-collapse-btn" @click="${this.handleToggleClick}"><nord-icon name="navigation-toggle-lock" size="s"></nord-icon></button>`}handleNavWidthChange(e){if($.value=this.navWidth,null!=e){const e=this.navWidth;this.dispatchEvent(new C(e))}}handleNavStateChange(e){switch("wait"===e&&this.peekTimeoutId&&clearTimeout(this.peekTimeoutId),"unpeek"===e&&this.navEl.removeEventListener("transitionend",this.handleTransitionEnd),this.navState){case"closed":this.navOpen=!1;break;case"opened":this.navOpen=!0;break;case"wait":this.peekTimeoutId=setTimeout((()=>this.navTransition("timeout")),300);break;case"unpeek":this.navEl.addEventListener("transitionend",this.handleTransitionEnd,{once:!0})}}handleOpenChange(e){if(this.isDragging||this.setNavWidth(Math.max(this.navWidth,this.defaultNavWidth)),this.navTransition(this.navOpen?"open":"close"),this.persistNavState&&(L.value=this.navOpen),null!=e){const e=this.navOpen;this.applyingRemote||this.broadcast.post({navOpen:e}),this.dispatchEvent(new S(e))}}navTransition(e){this.navState=B.transition(this.navState,e)}handleNavClick(e){if(!e.defaultPrevented&&!this.wideScreen){const n=e.target;(e=>"nord-nav-item"===e.localName)(t=n)&&!t.hasSubNav&&this.navTransition("close")}var t}handleMainClick(){this.navTransition("click")}handleDropdownOpen(e){"nord-dropdown"===e.target.localName&&this.navTransition("dropdownOpen")}handleDropdownClose(e){"nord-dropdown"===e.target.localName&&this.navTransition("dropdownClose")}get resizeValueNow(){return"opened"!==this.navState?this.minNavWidth:f(Math.round(this.navWidth),this.minNavWidth,this.maxNavWidth)}handleKeyboardResize(e){const{navWidth:t,direction:{isLTR:n}}=this;switch(e.key){case"ArrowLeft":this.setNavWidth(t+(n?-30:30));break;case"ArrowRight":this.setNavWidth(t+(n?30:-30));break;case"Enter":this.navTransition("toggle");break;case"Home":this.setNavWidth(this.minNavWidth);break;case"End":this.setNavWidth(this.maxNavWidth);break;default:return}this.broadcast.post({navWidth:this.navWidth}),e.preventDefault()}setNavWidth(e){this.navWidth=f(Math.round(e),this.minNavWidth,this.maxNavWidth)}startDragging(e){if(0===e.button){e.target.setPointerCapture(e.pointerId),this.isDragging=!0,this.dragStartX=e.clientX,this.hasDragged=!1}}stopDragging(){this.isDragging&&this.toggleOnResizeClick&&!this.hasDragged&&this.navTransition("toggle"),this.isDragging=!1,this.hasDragged=!1,this.broadcast.post({navWidth:this.navWidth})}handleDrag(e){if(!this.hasDragged&&Math.abs(e.clientX-this.dragStartX)<4)return;this.hasDragged=!0;const t=this.direction.isRTL?this.clientWidth-e.clientX:e.clientX;this.setNavWidth(t),this.navTransition(t>=100?"open":"close")}};F.styles=[w,k,T],e([s(".n-layout-nav",!0)],F.prototype,"navEl",void 0),e([s(".n-resize-tooltip")],F.prototype,"resizeTooltipEl",void 0),e([s(".n-sticky")],F.prototype,"stickyHeaderEl",void 0),e([s('slot[name="footer"]')],F.prototype,"footerSlotEl",void 0),e([r()],F.prototype,"navWidth",void 0),e([r()],F.prototype,"isDragging",void 0),e([r()],F.prototype,"navState",void 0),e([r()],F.prototype,"wideScreen",void 0),e([l({reflect:!0,type:Boolean,attribute:"nav-open"})],F.prototype,"navOpen",void 0),e([l({reflect:!0,type:Boolean,attribute:"persist-nav-state"})],F.prototype,"persistNavState",void 0),e([l({type:Boolean,reflect:!0,attribute:"sync-nav-state"})],F.prototype,"syncNavState",void 0),e([l({type:Number,reflect:!0,attribute:"default-nav-width"})],F.prototype,"defaultNavWidth",void 0),e([l({type:Number,reflect:!0,attribute:"min-nav-width"})],F.prototype,"minNavWidth",void 0),e([l({type:Number,reflect:!0,attribute:"max-nav-width"})],F.prototype,"maxNavWidth",void 0),e([l({type:Number,reflect:!0,attribute:"nav-rail-width"})],F.prototype,"navRailWidth",void 0),e([l({reflect:!0})],F.prototype,"padding",void 0),e([l({type:Boolean,reflect:!0})],F.prototype,"sticky",void 0),e([l({type:Boolean,reflect:!0,attribute:"sticky-footer"})],F.prototype,"stickyFooter",void 0),e([l({type:Boolean,reflect:!0,attribute:"hide-default-nav-toggle"})],F.prototype,"hideDefaultNavToggle",void 0),e([l({type:Boolean,reflect:!0,attribute:"hide-collapse-button"})],F.prototype,"hideCollapseButton",void 0),e([l({type:Boolean,reflect:!0,attribute:"toggle-on-resize-click"})],F.prototype,"toggleOnResizeClick",void 0),e([l({reflect:!0,attribute:"collapse-mode"})],F.prototype,"collapseMode",void 0),e([y("navWidth","updated")],F.prototype,"handleNavWidthChange",null),e([y("navState")],F.prototype,"handleNavStateChange",null),e([y("navOpen","updated")],F.prototype,"handleOpenChange",null),F=e([d("nord-layout")],F);var P=F;export{P as default};
2
2
  //# sourceMappingURL=Layout.js.map
package/lib/Layout.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Layout.js","sources":["../src/common/controllers/BroadcastChannelController.ts","../src/layout/Layout.ts"],"sourcesContent":["import type { ReactiveController, ReactiveControllerHost } from 'lit'\n\ninterface Options<T> {\n channelName: string\n onMessage: (message: T) => void\n enabled?: () => boolean\n}\n\nconst defaultEnabled = () => true\n\nexport class BroadcastChannelController<T> implements ReactiveController {\n private channel?: BroadcastChannel\n private options: Required<Options<T>>\n\n constructor(host: ReactiveControllerHost, options: Options<T>) {\n host.addController(this)\n this.options = { enabled: defaultEnabled, ...options }\n }\n\n hostConnected(): void {\n if (typeof BroadcastChannel !== 'undefined') {\n this.channel = new BroadcastChannel(this.options.channelName)\n this.channel.addEventListener('message', this)\n }\n }\n\n hostDisconnected(): void {\n this.channel?.removeEventListener('message', this)\n this.channel?.close()\n }\n\n handleEvent(event: MessageEvent<T>) {\n if (this.options.enabled()) {\n this.options.onMessage(event.data)\n }\n }\n\n post(message: T) {\n if (this.options.enabled()) {\n this.channel?.postMessage(message)\n }\n }\n}\n","import type { Events, States } from '../common/fsm.js'\nimport type NavItem from '../nav-item/NavItem.js'\nimport * as lockIcon from '@nordhealth/icons/lib/assets/navigation-toggle-lock.js'\nimport { html, LitElement, nothing } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { styleMap } from 'lit/directives/style-map.js'\nimport { BroadcastChannelController } from '../common/controllers/BroadcastChannelController.js'\nimport { DirectionController } from '../common/controllers/DirectionController.js'\nimport { EventController } from '../common/controllers/EventController.js'\nimport { LightDismissController } from '../common/controllers/LightDismissController.js'\nimport { SlotController } from '../common/controllers/SlotController.js'\nimport { observe } from '../common/decorators/observe.js'\nimport { cond } from '../common/directives/cond.js'\nimport { fsm } from '../common/fsm.js'\nimport { clamp } from '../common/number.js'\nimport { storage } from '../common/storage.js'\n\nimport componentStyle from '../common/styles/Component.css'\nimport stickyStyle from '../common/styles/Sticky.css'\n\nimport Icon from '../icon/Icon.js'\nimport { LocalizeController } from '../localization/LocalizeController.js'\nimport style from './Layout.css'\nimport { NavOpenChangeEvent } from './NavOpenChangeEvent.js'\nimport { NavResizeEvent } from './NavResizeEvent.js'\nimport '../nav-toggle/NavToggle.js'\nimport '../tooltip/Tooltip.js'\n\nIcon.registerIcon(lockIcon)\n\nlet resizeTooltipIdCounter = 0\n\nconst NAV_DEFAULT_WIDTH = 250\nconst NAV_MIN_WIDTH = 220\nconst NAV_MAX_WIDTH = 400\nconst NAV_COLLAPSE_WIDTH = 100\nconst NAV_RAIL_WIDTH = 64\nconst NAV_RESIZE_STEP = 30\nconst NAV_PEEK_DELAY = 300\nconst NAV_RESIZE_DRAG_THRESHOLD = 4\n\nconst mediaQuery\n = typeof matchMedia !== 'undefined'\n ? matchMedia('(min-width: 768px)')\n : ({\n matches: false,\n addEventListener() {\n /* noop */\n },\n } as unknown as MediaQueryList)\n\nconst navWidthStore = storage('nord-layout.navWidth', NAV_DEFAULT_WIDTH)\n// Tracks the last `default-nav-width` we wrote, so we can re-seed the\n// stored width when consumers change the default between loads.\n// Initial default matches NAV_DEFAULT_WIDTH so existing consumers that\n// never set `default-nav-width` get no re-seed on upgrade — their users'\n// persisted widths are preserved.\nconst navWidthDefaultStore = storage('nord-layout.navWidthDefault', NAV_DEFAULT_WIDTH)\nconst navOpenStore = storage('nord-layout.navOpen', true)\n\nfunction findNavToggleInPath(path: EventTarget[]): HTMLElement | null {\n for (const target of path) {\n if (target instanceof HTMLElement && target.localName === 'nord-nav-toggle') {\n return target\n }\n }\n return null\n}\n\nfunction isNavToggleClick(e: Event): boolean {\n return findNavToggleInPath(e.composedPath()) !== null\n}\n\nconst navMachine = fsm({\n opened: {\n toggle: 'closed',\n close: 'closed',\n },\n closed: {\n toggle: 'opened',\n open: 'opened',\n focusin: 'peek',\n pointerenter: 'peek',\n },\n peek: {\n toggle: 'opened',\n focusout: 'unpeek',\n pointerleave: 'wait',\n dropdownOpen: 'blocked',\n click: 'unpeek',\n open: 'opened',\n },\n blocked: {\n dropdownClose: 'peek',\n open: 'opened',\n },\n wait: {\n toggle: 'opened',\n focusin: 'peek',\n pointerenter: 'peek',\n timeout: 'unpeek',\n },\n unpeek: {\n toggle: 'opened',\n focusin: 'peek',\n pointerenter: 'peek',\n transitionend: 'closed',\n },\n})\n\ntype NavState = States<typeof navMachine>\ntype NavEvent = Events<typeof navMachine>\n\nconst isNavItem = (el: HTMLElement): el is NavItem => el.localName === 'nord-nav-item'\nconst isNavItemLeaf = (el: HTMLElement) => isNavItem(el) && !el.hasSubNav\n\n/**\n * Layout component is used to create the main layout of an app. Layout\n * currently comes with one main configuration: two-column.\n *\n * @status ready\n * @category layout\n * @slot - The default main section content.\n * @slot nav - Used to place content inside the navigation sidebar.\n * @slot top-bar - Used to place the [Top Bar](/components/top-bar/) component.\n * @slot header - Used to place content inside the header section. This slot can be made sticky by utilizing the `sticky` property on the layout component.\n * @slot footer - Used to place content inside the footer section. This slot can be made sticky by utilizing the `stickyFooter` property on the layout component.\n * @slot drawer - Used to place additional content/details relating to a selected item.\n * @slot nav-toggle - Used to place a own nav-toggle component, for cases where you might need to add a tooltip. As an alternative, `<nord-nav-toggle>` can be placed anywhere inside `<nord-layout>` (e.g. inside a `<nord-header>`) — the layout listens for clicks and hover on any descendant `<nord-nav-toggle>` and drives toggle / peek behaviour accordingly. When using that placement, set `hide-default-nav-toggle` to suppress the layout's built-in fallback toggle.\n *\n * @fires {NavOpenChangeEvent} nav-open-change - Dispatched when the navigation open state changes, regardless of the trigger (user toggle, peek, focus, programmatic). The event's `navOpen` property contains the new state.\n * @fires {NavResizeEvent} nav-resize - Dispatched when the navigation sidebar width changes. The event's `width` property contains the new width in pixels.\n *\n * @cssprop [--n-layout-padding=var(--n-space-l)] - Controls the padding around the main layout area (the main slot), using our [spacing tokens](/tokens/#space).\n * @cssprop [--n-layout-drawer-inline-size=320px] - Controls the width of the drawer area, when used.\n * @cssprop [--n-layout-background-color=var(--n-color-background)] - Controls the background color of the layout, using [color tokens](/tokens/#color).\n * @cssprop [--n-layout-nav-border-color=var(--n-color-border)] - Controls the color of the border between the navigation and the main content area when the nav is open on wide screens.\n * @cssprop [--n-layout-resize-color=var(--n-color-accent)] - Controls the colour of the resize handle's accent bar (shown on hover, focus, and while dragging).\n * @cssprop [--n-layout-resize-block-size=100%] - Controls the block-axis (vertical) size of the resize handle. Set to a fixed length (e.g. `200px`) to constrain the handle so it doesn't span the full nav height.\n * @cssprop [--n-layout-resize-inset-inline-end=5px] - Controls the inline-end offset of the resize handle's accent bar (the visible vertical line shown on hover/focus/drag).\n * @cssprop [--n-layout-nav-rail-width=64px] - Controls the width of the navigation column when `collapse-mode=\"rail\"` is active and the nav is closed. Equivalent to the `nav-rail-width` attribute / `navRailWidth` property; the CSS custom property takes precedence when set.\n * @cssprop [--n-layout-header-size=var(--n-space-xxl)] - Controls the block-axis (height) of the layout's header area. Also drives the size of the nav-toggle container and sticky-positioning offsets.\n * @cssprop [--n-layout-drawer-box-shadow=var(--n-box-shadow-nav)] - Controls the box-shadow applied to the drawer (aside) on narrow viewports.\n * @cssprop [--n-layout-drawer-box-shadow-wide=var(--n-box-shadow-header)] - Controls the box-shadow applied to the drawer (aside) on wide viewports (≥1240px).\n * @cssprop [--n-layout-drawer-border-inline-start-width=1px] - Controls the inline-start border width of the drawer on wide viewports.\n * @cssprop [--n-layout-drawer-border-inline-start-color=var(--n-color-border)] - Controls the inline-start border color of the drawer on wide viewports.\n *\n * @localization resizeNavigation - Accessible label for the nav resize separator.\n * @localization navigationCollapsed - Announced by the nav resize separator (`aria-valuetext`) while the navigation is collapsed.\n */\n@customElement('nord-layout')\nexport default class Layout extends LitElement {\n static styles = [componentStyle, stickyStyle, style]\n\n private peekTimeoutId?: ReturnType<typeof setTimeout>\n private readonly resizeTooltipId = `n-layout-resize-tip-${++resizeTooltipIdCounter}`\n\n private navSlot = new SlotController(this, 'nav')\n private drawerSlot = new SlotController(this, 'drawer')\n private topBarSlot = new SlotController(this, 'top-bar')\n private headerSlot = new SlotController(this, 'header')\n private footerSlot = new SlotController(this, 'footer')\n private dividerTooltipSlot = new SlotController(this, 'tooltip-divider')\n private direction = new DirectionController(this)\n private events = new EventController(this)\n private localization = new LocalizeController<'nord-layout'>(this)\n private lightDismiss = new LightDismissController(this, {\n isOpen: () => this.navState === 'opened' && !this.wideScreen,\n onDismiss: () => this.navTransition('close'),\n isDismissible: node => node !== this.navEl,\n })\n\n // Set while applying an incoming BroadcastChannel message. The navOpen\n // observer checks this and skips re-broadcasting so that received changes\n // don't echo back across tabs. Without this gate the two tabs ping-pong\n // on Safari, where microtask scheduling lets their updates interleave\n // past Lit's property equality check.\n private applyingRemote = false\n\n private broadcast = new BroadcastChannelController<{ navOpen: boolean } | { navWidth: number }>(this, {\n channelName: 'nord-layout-nav-state',\n enabled: () => this.syncNavState && this.wideScreen,\n onMessage: (data) => {\n this.applyingRemote = true\n if ('navOpen' in data) {\n this.navOpen = data.navOpen\n }\n if ('navWidth' in data) {\n this.navWidth = data.navWidth\n }\n this.updateComplete.then(() => {\n this.applyingRemote = false\n })\n },\n })\n\n @query('.n-layout-nav', true) private navEl!: HTMLDivElement\n @query('.n-resize-tooltip') private resizeTooltipEl?: HTMLElement\n @query('.n-sticky') private stickyHeaderEl?: HTMLElement\n @query('slot[name=\"footer\"]') private footerSlotEl?: HTMLSlotElement\n\n // Track the actual rendered block-size of header/footer so consumers\n // (e.g. <nord-aside>) can offset overlay positioning against the real\n // values, not just the static defaults. Single ResizeObserver per\n // dimension, written as public CSS custom properties on the host.\n private headerSizeObserver?: ResizeObserver\n private footerSizeObserver?: ResizeObserver\n private observedFooterElement?: Element\n\n @state() private navWidth = navWidthStore.value\n @state() private isDragging = false\n @state() private navState!: NavState\n @state() private wideScreen = mediaQuery.matches\n\n /**\n * Controls whether the navigation is hidden off-screen or not.\n * Defaults to `true` for wide viewports, and `false` otherwise.\n */\n @property({ reflect: true, type: Boolean, attribute: 'nav-open' }) navOpen!: boolean\n\n /**\n * Controls whether the navigation's open/closed state is persisted across page loads.\n * This is useful for multi-page apps, where clicks on links trigger a full page load.\n */\n @property({ reflect: true, type: Boolean, attribute: 'persist-nav-state' }) persistNavState = false\n\n /**\n * Controls whether the navigation's open/closed state and width is synced across tabs/windows on the same origin.\n * This is useful for long-lived app sessions where you may have multiple tabs/windows open at once.\n */\n @property({ type: Boolean, reflect: true, attribute: 'sync-nav-state' }) syncNavState = false\n\n /**\n * Initial width (in pixels) of the navigation sidebar when no value has been persisted.\n * Changing this value between loads also re-seeds the persisted width for existing users,\n * so design changes propagate without manual localStorage resets.\n */\n @property({ type: Number, reflect: true, attribute: 'default-nav-width' }) defaultNavWidth = NAV_DEFAULT_WIDTH\n\n /**\n * Minimum width (in pixels) the navigation sidebar can be resized to via drag or keyboard.\n */\n @property({ type: Number, reflect: true, attribute: 'min-nav-width' }) minNavWidth = NAV_MIN_WIDTH\n\n /**\n * Maximum width (in pixels) the navigation sidebar can be resized to via drag or keyboard.\n */\n @property({ type: Number, reflect: true, attribute: 'max-nav-width' }) maxNavWidth = NAV_MAX_WIDTH\n\n /**\n * Width (in pixels) of the rail column when `collapse-mode=\"rail\"` is active\n * and the nav is closed. Default 64.\n */\n @property({ type: Number, reflect: true, attribute: 'nav-rail-width' }) navRailWidth = NAV_RAIL_WIDTH\n\n /**\n * Controls the padding of the default main section slot. When set to “none”,\n * the nav and header slots will still have padding.\n */\n @property({ reflect: true }) padding: 'm' | 'none' = 'm'\n\n /**\n * Controls whether the layout's header has sticky positioning.\n */\n @property({ type: Boolean, reflect: true }) sticky: boolean = false\n\n /**\n * Controls whether the layout's footer has sticky positioning.\n */\n @property({ type: Boolean, reflect: true, attribute: 'sticky-footer' }) stickyFooter: boolean = false\n\n /**\n * Suppresses the built-in `<nord-nav-toggle>` rendered as the fallback for\n * the `nav-toggle` slot. Set this when you've placed your own\n * `<nord-nav-toggle>` elsewhere inside the layout (e.g. inside\n * `<nord-header>`) and want the layout's default one hidden.\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-default-nav-toggle' })\n hideDefaultNavToggle: boolean = false\n\n /**\n * Suppresses the built-in collapse button rendered inside the nav (the\n * lock-icon button that toggles the sidebar between opened and the\n * collapsed state defined by `collapse-mode`). Set this when you've\n * placed your own collapse control elsewhere.\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-collapse-button' })\n hideCollapseButton: boolean = false\n\n /**\n * When set, clicking the resize handle (without dragging) toggles the\n * nav between opened and the collapsed state defined by `collapse-mode`.\n * Dragging the handle still resizes the sidebar as usual; the click\n * behaviour only fires when the pointer barely moves between down and up.\n */\n @property({ type: Boolean, reflect: true, attribute: 'toggle-on-resize-click' })\n toggleOnResizeClick: boolean = false\n\n /**\n * Controls how the navigation renders when closed on wide viewports.\n * `hide` (default) slides the nav off-screen entirely. `rail` keeps a\n * narrow icon-only column visible, with tooltips for labels and flyout\n * popovers for items that have a `subnav` slot.\n *\n * Narrow viewports always use the off-screen behaviour regardless of\n * this setting.\n */\n @property({ reflect: true, attribute: 'collapse-mode' }) collapseMode: 'hide' | 'rail' = 'hide'\n\n /**\n * A getter whose values reflects whether the layout component considers the viewport to be narrow or not.\n * A narrow viewport is considered to be less than 768px wide.\n */\n get isNarrow(): boolean {\n return !this.wideScreen\n }\n\n connectedCallback(): void {\n super.connectedCallback()\n this.events.listen(mediaQuery, 'change', this.handleMediaQueryChange)\n this.addEventListener('click', this.handleHostClick)\n this.addEventListener('mouseover', this.handleHostMouseOver)\n this.addEventListener('mouseout', this.handleHostMouseOut)\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback()\n this.removeEventListener('click', this.handleHostClick)\n this.removeEventListener('mouseover', this.handleHostMouseOver)\n this.removeEventListener('mouseout', this.handleHostMouseOut)\n this.headerSizeObserver?.disconnect()\n this.headerSizeObserver = undefined\n this.footerSizeObserver?.disconnect()\n this.footerSizeObserver = undefined\n this.observedFooterElement = undefined\n this.style.removeProperty('--n-layout-header-block-size')\n this.style.removeProperty('--n-layout-footer-block-size')\n }\n\n protected firstUpdated() {\n if (typeof ResizeObserver === 'undefined')\n return\n if (this.stickyHeaderEl) {\n this.headerSizeObserver = new ResizeObserver(() => this.publishHeaderSize())\n this.headerSizeObserver.observe(this.stickyHeaderEl)\n this.publishHeaderSize()\n }\n if (this.footerSlotEl) {\n this.footerSlotEl.addEventListener('slotchange', this.handleFooterSlotChange)\n this.handleFooterSlotChange()\n }\n }\n\n private publishHeaderSize() {\n const size = this.stickyHeaderEl?.getBoundingClientRect().height ?? 0\n if (size > 0)\n this.style.setProperty('--n-layout-header-block-size', `${size}px`)\n else\n this.style.removeProperty('--n-layout-header-block-size')\n }\n\n private handleFooterSlotChange = () => {\n const next = this.footerSlotEl?.assignedElements({ flatten: true })[0]\n if (next === this.observedFooterElement)\n return\n this.footerSizeObserver?.disconnect()\n this.observedFooterElement = next\n if (!next) {\n this.style.removeProperty('--n-layout-footer-block-size')\n return\n }\n this.footerSizeObserver = new ResizeObserver(() => this.publishFooterSize())\n this.footerSizeObserver.observe(next)\n this.publishFooterSize()\n }\n\n private publishFooterSize() {\n const size = this.observedFooterElement?.getBoundingClientRect().height ?? 0\n if (size > 0)\n this.style.setProperty('--n-layout-footer-block-size', `${size}px`)\n else\n this.style.removeProperty('--n-layout-footer-block-size')\n }\n\n willUpdate() {\n // we only want this logic to run once, before first render\n if (this.hasUpdated) {\n return\n }\n\n // fall back to the built-in constants when consumer-provided attributes\n // are non-numeric (e.g. `min-nav-width=\"abc\"` produces NaN). reflect:true\n // also rewrites the attribute in the DOM to the sanitized value\n if (!Number.isFinite(this.defaultNavWidth)) {\n this.defaultNavWidth = NAV_DEFAULT_WIDTH\n }\n if (!Number.isFinite(this.minNavWidth)) {\n this.minNavWidth = NAV_MIN_WIDTH\n }\n if (!Number.isFinite(this.maxNavWidth)) {\n this.maxNavWidth = NAV_MAX_WIDTH\n }\n\n // re-seed persisted width when the consumer-provided default-nav-width\n // differs from the last default we applied. This lets apps roll out a\n // new sidebar default without manual localStorage migrations.\n if (navWidthDefaultStore.value !== this.defaultNavWidth) {\n this.setNavWidth(this.defaultNavWidth)\n navWidthStore.value = this.navWidth\n // store the raw consumer-provided default so mismatch detection is\n // independent of the min/max clamp\n navWidthDefaultStore.value = this.defaultNavWidth\n }\n else {\n // ensure a previously-persisted width still respects current min/max\n this.setNavWidth(this.navWidth)\n }\n\n // on mobile it should always start closed\n if (this.isNarrow) {\n this.navState = 'closed'\n }\n // if nav state is persisted, and it was previously closed, start closed\n else if (this.persistNavState && navOpenStore.value === false) {\n this.navState = 'closed'\n }\n // otherwise start open\n else {\n this.navState = 'opened'\n }\n }\n\n render() {\n const { navWidth, navState, navSlot, headerSlot, footerSlot, topBarSlot, drawerSlot, isDragging, direction } = this\n const isRailCollapsed = this.wideScreen && this.collapseMode === 'rail' && navState !== 'opened'\n const adjustedNavWidth = navState === 'opened' && this.wideScreen\n ? navWidth\n : isRailCollapsed\n ? NAV_RAIL_WIDTH\n : this.defaultNavWidth\n\n return html`\n <div\n class=${classMap({\n 'n-layout': true,\n 'n-rtl': direction.isRTL,\n 'n-dragging': isDragging,\n 'n-has-header': headerSlot.hasContent,\n 'n-has-footer': footerSlot.hasContent,\n 'n-has-top-bar': topBarSlot.hasContent,\n 'n-has-drawer': drawerSlot.hasContent,\n 'n-has-nav': navSlot.hasContent,\n })}\n style=${styleMap({\n '--_n-layout-nav-width': `${adjustedNavWidth}px`,\n '--_n-layout-nav-rail-width': `var(--n-layout-nav-rail-width, ${this.navRailWidth}px)`,\n // Mirror the min/max nav-width props as px so the hide-mode peek\n // flyout can clamp its intrinsic (`fit-content`) width in CSS.\n '--_n-layout-nav-min-width': `${this.minNavWidth}px`,\n '--_n-layout-nav-max-width': `${this.maxNavWidth}px`,\n })}\n data-nav=${navSlot.hasContent ? navState : 'closed'}\n data-screen=${this.wideScreen ? 'wide' : 'narrow'}\n data-collapse-mode=${this.collapseMode}\n >\n <div\n id=\"n-layout-nav\"\n class=\"n-layout-nav\"\n ?hidden=${navSlot.isEmpty}\n @focusin=${this.handleNavFocus}\n @mouseenter=${this.handleMouseEnter}\n @mouseleave=${this.handleMouseLeave}\n @open=${this.handleDropdownOpen}\n @close=${this.handleDropdownClose}\n >\n <slot name=\"nav\" @click=${this.handleNavClick}></slot>\n <div\n class=\"n-resize\"\n role=\"separator\"\n aria-orientation=\"vertical\"\n tabindex=\"0\"\n aria-label=${this.localization.term('resizeNavigation')}\n aria-controls=\"n-layout-nav\"\n aria-valuemin=${this.minNavWidth}\n aria-valuemax=${this.maxNavWidth}\n aria-valuenow=${this.resizeValueNow}\n aria-valuetext=${cond(navState !== 'opened', this.localization.term('navigationCollapsed'))}\n aria-describedby=${cond(this.dividerTooltipSlot.hasContent && !isDragging, this.resizeTooltipId)}\n @pointerdown=${cond(navState === 'opened' || isRailCollapsed, this.startDragging)}\n @pointermove=${isDragging ? this.handleDrag : this.handleResizeHoverMove}\n @pointerleave=${this.handleResizePointerLeave}\n @pointerup=${this.stopDragging}\n @keydown=${this.handleKeyboardResize}\n ?hidden=${this.isNarrow}\n ></div>\n ${this.dividerTooltipSlot.hasContent\n ? html`\n <nord-tooltip id=${this.resizeTooltipId} position=\"inline-end\" class=\"n-resize-tooltip\">\n <slot name=\"tooltip-divider\"></slot>\n </nord-tooltip>\n `\n : nothing}\n ${this.hideCollapseButton ? nothing : this.renderNavCollapse()}\n </div>\n\n <div class=\"n-layout-main\" @focusin=${this.handleMainFocus} @click=${this.handleMainClick}>\n ${navSlot.hasContent && !this.hideDefaultNavToggle ? this.renderNavToggle() : nothing}\n\n <div class=\"n-top-bar-container\">\n <slot name=\"top-bar\"></slot>\n </div>\n\n <div class=\"n-layout-content\">\n <div class=\"n-sticky\">\n <slot name=\"header\"></slot>\n </div>\n <main>\n <slot></slot>\n </main>\n <slot name=\"footer\"></slot>\n </div>\n\n <aside ?hidden=${this.drawerSlot.isEmpty}>\n <slot name=\"drawer\"></slot>\n </aside>\n </div>\n </div>\n `\n }\n\n private renderNavToggle() {\n return html`\n <div class=\"n-nav-toggle-container\">\n <slot\n name=\"nav-toggle\"\n @click=${this.handleToggleClick}\n @mouseover=${this.handleMouseEnter}\n @mouseout=${this.handleMouseLeave}\n >\n <nord-nav-toggle></nord-nav-toggle>\n </slot>\n </div>\n `\n }\n\n private renderNavCollapse() {\n return html`\n <button class=\"n-collapse-btn\" @click=${this.handleToggleClick}>\n <nord-icon name=\"navigation-toggle-lock\" size=\"s\"></nord-icon>\n </button>\n `\n }\n\n @observe('navWidth', 'updated')\n protected handleNavWidthChange(prev: number) {\n navWidthStore.value = this.navWidth\n if (prev != null) {\n const navWidth = this.navWidth\n this.dispatchEvent(new NavResizeEvent(navWidth))\n }\n }\n\n @observe('navState')\n protected handleNavStateChange(prev: NavState) {\n if (prev === 'wait' && this.peekTimeoutId) {\n clearTimeout(this.peekTimeoutId)\n }\n if (prev === 'unpeek') {\n this.navEl.removeEventListener('transitionend', this.handleTransitionEnd)\n }\n\n switch (this.navState) {\n case 'closed':\n this.navOpen = false\n break\n case 'opened':\n this.navOpen = true\n break\n case 'wait':\n this.peekTimeoutId = setTimeout(() => this.navTransition('timeout'), NAV_PEEK_DELAY)\n break\n case 'unpeek':\n this.navEl.addEventListener('transitionend', this.handleTransitionEnd, { once: true })\n break\n default:\n break\n }\n }\n\n @observe('navOpen', 'updated')\n protected handleOpenChange(prev: boolean) {\n if (!this.isDragging) {\n // when opening nav, it should restore to default width (or larger).\n // unless it is being dragged, in which case the drag width wins\n this.setNavWidth(Math.max(this.navWidth, this.defaultNavWidth))\n }\n\n this.navTransition(this.navOpen ? 'open' : 'close')\n\n if (this.persistNavState) {\n navOpenStore.value = this.navOpen\n }\n\n // skip first update, we only want subsequent changes\n if (prev != null) {\n // Bind to a local so the custom-elements-manifest analyzer can infer\n // the event name from this constructor call site (it reads the bare\n // identifier passed to `new NavOpenChangeEvent(...)`; a `this.x`\n // member access defeats that heuristic and leaves the event nameless,\n // which then crashes `scripts/build-react-types.mjs` on sort).\n const navOpen = this.navOpen\n // Suppress the broadcast when the change came from a received message,\n // otherwise tabs would echo every update back at each other. See the\n // `applyingRemote` field for the full rationale.\n if (!this.applyingRemote) {\n this.broadcast.post({ navOpen })\n }\n this.dispatchEvent(new NavOpenChangeEvent(navOpen))\n }\n }\n\n /* ---------------------------------------------\n / NAVIGATION OPEN/CLOSE LOGIC\n / --------------------------------------------- */\n\n private navTransition(event: NavEvent) {\n this.navState = navMachine.transition(this.navState, event)\n }\n\n private handleNavClick(e: Event) {\n if (!e.defaultPrevented && !this.wideScreen) {\n const target = e.target as HTMLElement\n\n if (isNavItemLeaf(target)) {\n this.navTransition('close')\n }\n }\n }\n\n private handleMainClick() {\n this.navTransition('click')\n }\n\n private handleDropdownOpen(e: Event) {\n const target = e.target as Element\n\n if (target.localName === 'nord-dropdown') {\n this.navTransition('dropdownOpen')\n }\n }\n\n private handleDropdownClose(e: Event) {\n const target = e.target as Element\n\n if (target.localName === 'nord-dropdown') {\n this.navTransition('dropdownClose')\n }\n }\n\n private handleMediaQueryChange = () => {\n this.wideScreen = mediaQuery.matches\n this.navTransition(this.wideScreen ? 'open' : 'close')\n }\n\n private handleToggleClick = (e: Event) => {\n // Skip when a `<nord-nav-toggle>` is in the click path — `handleHostClick`\n // will fire for it. Without this guard, an in-slot `<nord-nav-toggle>`\n // would toggle twice (once via the slot handler, once via the host one).\n if (isNavToggleClick(e)) {\n return\n }\n this.navTransition('toggle')\n }\n\n // Allow `<nord-nav-toggle>` to be placed anywhere inside the layout, not\n // just in the `nav-toggle` slot. Clicks on the host bubble up through the\n // light-DOM subtree; if the composed path contains a `<nord-nav-toggle>`,\n // we treat that as a toggle request.\n private handleHostClick = (e: Event) => {\n if (isNavToggleClick(e)) {\n this.navTransition('toggle')\n }\n }\n\n // Same delegation pattern as `handleHostClick`, but for hover-to-peek.\n // `relatedTarget` filtering avoids re-firing as the cursor moves between\n // children inside the same `<nord-nav-toggle>`.\n private handleHostMouseOver = (e: MouseEvent) => {\n const toggle = findNavToggleInPath(e.composedPath())\n if (!toggle) {\n return\n }\n if (e.relatedTarget instanceof Node && toggle.contains(e.relatedTarget)) {\n return\n }\n this.handleMouseEnter()\n }\n\n private handleHostMouseOut = (e: MouseEvent) => {\n const toggle = findNavToggleInPath(e.composedPath())\n if (!toggle) {\n return\n }\n if (e.relatedTarget instanceof Node && toggle.contains(e.relatedTarget)) {\n return\n }\n this.handleMouseLeave()\n }\n\n private handleNavFocus = () => {\n // In rail mode, the icons are already visible — focus inside the\n // rail should not trigger a peek that re-expands the full sidebar.\n if (this.wideScreen && this.collapseMode === 'rail') {\n return\n }\n this.navTransition('focusin')\n }\n\n private handleMainFocus = () => {\n this.navTransition('focusout')\n }\n\n private handleMouseEnter = () => {\n if (!this.wideScreen) {\n return\n }\n if (this.collapseMode === 'rail') {\n return\n }\n this.navTransition('pointerenter')\n }\n\n private handleMouseLeave = () => {\n if (this.wideScreen && this.collapseMode === 'rail') {\n return\n }\n this.navTransition('pointerleave')\n }\n\n private handleTransitionEnd = () => {\n this.navTransition('transitionend')\n }\n\n /* ---------------------------------------------\n / RESIZE LOGIC\n / --------------------------------------------- */\n\n /**\n * `aria-valuenow` for the focusable resize separator (ARIA window splitter\n * pattern): the current nav width in pixels, bounded by the `min-nav-width`\n * / `max-nav-width` props exposed as `aria-valuemin` / `aria-valuemax`.\n * While the nav is collapsed the value must stay within those bounds, so it\n * reports the minimum and `aria-valuetext` announces the collapsed state.\n */\n private get resizeValueNow(): number {\n if (this.navState !== 'opened') {\n return this.minNavWidth\n }\n return clamp(Math.round(this.navWidth), this.minNavWidth, this.maxNavWidth)\n }\n\n private handleKeyboardResize(e: KeyboardEvent) {\n const {\n navWidth,\n direction: { isLTR },\n } = this\n\n switch (e.key) {\n case 'ArrowLeft':\n this.setNavWidth(navWidth + (isLTR ? -NAV_RESIZE_STEP : NAV_RESIZE_STEP))\n break\n case 'ArrowRight':\n this.setNavWidth(navWidth + (isLTR ? NAV_RESIZE_STEP : -NAV_RESIZE_STEP))\n break\n case 'Enter':\n this.navTransition('toggle')\n break\n case 'Home':\n this.setNavWidth(this.minNavWidth)\n break\n case 'End':\n this.setNavWidth(this.maxNavWidth)\n break\n default:\n return\n }\n\n this.broadcast.post({ navWidth: this.navWidth })\n e.preventDefault()\n }\n\n private setNavWidth(width: number) {\n this.navWidth = clamp(Math.round(width), this.minNavWidth, this.maxNavWidth)\n }\n\n private dragStartX = 0\n private hasDragged = false\n\n private startDragging(e: PointerEvent) {\n if (e.button === 0) {\n const target = e.target as Element\n target.setPointerCapture(e.pointerId)\n this.isDragging = true\n this.dragStartX = e.clientX\n this.hasDragged = false\n }\n }\n\n private stopDragging() {\n if (this.isDragging && this.toggleOnResizeClick && !this.hasDragged) {\n this.navTransition('toggle')\n }\n this.isDragging = false\n this.hasDragged = false\n this.broadcast.post({ navWidth: this.navWidth })\n }\n\n private handleResizeHoverMove = (e: PointerEvent) => {\n const target = e.currentTarget as HTMLElement | null\n if (!target || !this.resizeTooltipEl)\n return\n\n const rect = target.getBoundingClientRect()\n const offset = e.clientY - (rect.top + rect.height / 2)\n this.resizeTooltipEl.style.setProperty('--n-resize-tooltip-y', `${offset}px`)\n }\n\n private handleResizePointerLeave = () => {\n this.stopDragging()\n this.resizeTooltipEl?.style.removeProperty('--n-resize-tooltip-y')\n }\n\n private handleDrag(e: PointerEvent) {\n if (!this.hasDragged && Math.abs(e.clientX - this.dragStartX) < NAV_RESIZE_DRAG_THRESHOLD) {\n return\n }\n this.hasDragged = true\n\n const width = this.direction.isRTL ? this.clientWidth - e.clientX : e.clientX\n\n this.setNavWidth(width)\n this.navTransition(width >= NAV_COLLAPSE_WIDTH ? 'open' : 'close')\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-layout': Layout\n }\n}\n"],"names":["defaultEnabled","BroadcastChannelController","constructor","host","options","addController","this","enabled","hostConnected","BroadcastChannel","channel","channelName","addEventListener","hostDisconnected","_a","removeEventListener","_b","close","handleEvent","event","onMessage","data","post","message","postMessage","Icon","registerIcon","lockIcon","resizeTooltipIdCounter","NAV_DEFAULT_WIDTH","mediaQuery","matchMedia","matches","navWidthStore","storage","navWidthDefaultStore","navOpenStore","findNavToggleInPath","path","target","HTMLElement","localName","isNavToggleClick","e","composedPath","navMachine","fsm","opened","toggle","closed","open","focusin","pointerenter","peek","focusout","pointerleave","dropdownOpen","click","blocked","dropdownClose","wait","timeout","unpeek","transitionend","Layout","LitElement","resizeTooltipId","navSlot","SlotController","drawerSlot","topBarSlot","headerSlot","footerSlot","dividerTooltipSlot","direction","DirectionController","events","EventController","localization","LocalizeController","lightDismiss","LightDismissController","isOpen","navState","wideScreen","onDismiss","navTransition","isDismissible","node","navEl","applyingRemote","broadcast","syncNavState","navOpen","navWidth","updateComplete","then","value","isDragging","persistNavState","defaultNavWidth","minNavWidth","maxNavWidth","navRailWidth","padding","sticky","stickyFooter","hideDefaultNavToggle","hideCollapseButton","toggleOnResizeClick","collapseMode","handleFooterSlotChange","next","footerSlotEl","assignedElements","flatten","observedFooterElement","footerSizeObserver","disconnect","ResizeObserver","publishFooterSize","observe","style","removeProperty","handleMediaQueryChange","handleToggleClick","handleHostClick","handleHostMouseOver","relatedTarget","Node","contains","handleMouseEnter","handleHostMouseOut","handleMouseLeave","handleNavFocus","handleMainFocus","handleTransitionEnd","dragStartX","hasDragged","handleResizeHoverMove","currentTarget","resizeTooltipEl","rect","getBoundingClientRect","offset","clientY","top","height","setProperty","handleResizePointerLeave","stopDragging","isNarrow","connectedCallback","super","listen","disconnectedCallback","headerSizeObserver","undefined","firstUpdated","stickyHeaderEl","publishHeaderSize","size","willUpdate","hasUpdated","Number","isFinite","setNavWidth","render","isRailCollapsed","adjustedNavWidth","html","classMap","isRTL","hasContent","styleMap","isEmpty","handleDropdownOpen","handleDropdownClose","handleNavClick","term","resizeValueNow","cond","startDragging","handleDrag","handleKeyboardResize","nothing","renderNavCollapse","handleMainClick","renderNavToggle","handleNavWidthChange","prev","dispatchEvent","NavResizeEvent","handleNavStateChange","peekTimeoutId","clearTimeout","setTimeout","once","handleOpenChange","Math","max","NavOpenChangeEvent","transition","defaultPrevented","el","isNavItem","hasSubNav","clamp","round","isLTR","key","preventDefault","width","button","setPointerCapture","pointerId","clientX","abs","clientWidth","styles","componentStyle","stickyStyle","__decorate","query","prototype","state","property","reflect","type","Boolean","attribute","customElement"],"mappings":"0qEAQA,MAAMA,EAAiB,KAAM,QAEhBC,EAIX,WAAAC,CAAYC,EAA8BC,GACxCD,EAAKE,cAAcC,MACnBA,KAAKF,QAAU,CAAEG,QAASP,KAAmBI,EAC9C,CAED,aAAAI,GACkC,oBAArBC,mBACTH,KAAKI,QAAU,IAAID,iBAAiBH,KAAKF,QAAQO,aACjDL,KAAKI,QAAQE,iBAAiB,UAAWN,MAE5C,CAED,gBAAAO,WACgB,QAAdC,EAAAR,KAAKI,eAAS,IAAAI,GAAAA,EAAAC,oBAAoB,UAAWT,MAC/B,QAAdU,EAAAV,KAAKI,eAAS,IAAAM,GAAAA,EAAAC,OACf,CAED,WAAAC,CAAYC,GACNb,KAAKF,QAAQG,WACfD,KAAKF,QAAQgB,UA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AAgK,UAAA,0BAAA,GASnCF,EAAA,CADCI,EAAS,CAAEE,KAAMC,QAASF,SAAS,EAAMG,UAAW,4BACjBtK,EAAAgK,UAAA,2BAAA,GAWqBF,EAAA,CAAxDI,EAAS,CAAEC,SAAS,EAAMG,UAAW,mBAAyDtK,EAAAgK,UAAA,oBAAA,GAuPrFF,EAAA,CADTrG,EAAQ,WAAY,YAOpBzD,EAAAgK,UAAA,uBAAA,MAGSF,EAAA,CADTrG,EAAQ,aAyBRzD,EAAAgK,UAAA,uBAAA,MAGSF,EAAA,CADTrG,EAAQ,UAAW,YA8BnBzD,EAAAgK,UAAA,mBAAA,MApdkBhK,EAAM8J,EAAA,CAD1BS,EAAc,gBACMvK,SAAAA"}
1
+ {"version":3,"file":"Layout.js","sources":["../src/common/controllers/BroadcastChannelController.ts","../src/layout/Layout.ts"],"sourcesContent":["import type { ReactiveController, ReactiveControllerHost } from 'lit'\n\ninterface Options<T> {\n channelName: string\n onMessage: (message: T) => void\n enabled?: () => boolean\n /**\n * When the document is hidden, incoming messages are buffered instead of\n * delivered, and successive messages are coalesced with this reducer\n * (default: keep the latest). The buffered value is delivered once, when the\n * document becomes visible again.\n *\n * This stops background tabs from doing work (e.g. layout reflows) they\n * cannot show. On machines where same-origin tabs share a single renderer\n * process/main thread — common on low-memory devices — that background work\n * would otherwise steal main-thread time from the foreground tab and degrade\n * its interaction latency (INP).\n */\n coalesce?: (pending: T | undefined, incoming: T) => T\n}\n\nconst defaultEnabled = () => true\nconst defaultCoalesce = <T>(_pending: T | undefined, incoming: T): T => incoming\n\nexport class BroadcastChannelController<T> implements ReactiveController {\n private channel?: BroadcastChannel\n private options: Required<Options<T>>\n // Wrapped so `undefined` (no buffered message) is distinguishable from a\n // buffered value that happens to be `undefined`.\n private pending?: { value: T }\n\n constructor(host: ReactiveControllerHost, options: Options<T>) {\n host.addController(this)\n this.options = { enabled: defaultEnabled, coalesce: defaultCoalesce, ...options }\n }\n\n hostConnected(): void {\n if (typeof BroadcastChannel !== 'undefined') {\n this.channel = new BroadcastChannel(this.options.channelName)\n this.channel.addEventListener('message', this)\n }\n if (typeof document !== 'undefined') {\n document.addEventListener('visibilitychange', this.handleVisibilityChange)\n }\n }\n\n hostDisconnected(): void {\n this.channel?.removeEventListener('message', this)\n this.channel?.close()\n if (typeof document !== 'undefined') {\n document.removeEventListener('visibilitychange', this.handleVisibilityChange)\n }\n this.pending = undefined\n }\n\n handleEvent(event: MessageEvent<T>) {\n if (!this.options.enabled()) {\n return\n }\n // Defer work in hidden tabs: buffer the coalesced latest value and apply it\n // once the tab is visible again. A burst of messages received while hidden\n // collapses into a single delivery.\n if (typeof document !== 'undefined' && document.hidden) {\n this.pending = { value: this.options.coalesce(this.pending?.value, event.data) }\n return\n }\n this.options.onMessage(event.data)\n }\n\n private handleVisibilityChange = () => {\n if (typeof document !== 'undefined' && document.hidden) {\n return\n }\n const pending = this.pending\n this.pending = undefined\n if (pending && this.options.enabled()) {\n this.options.onMessage(pending.value)\n }\n }\n\n post(message: T) {\n if (this.options.enabled()) {\n this.channel?.postMessage(message)\n }\n }\n}\n","import type { Events, States } from '../common/fsm.js'\nimport type NavItem from '../nav-item/NavItem.js'\nimport * as lockIcon from '@nordhealth/icons/lib/assets/navigation-toggle-lock.js'\nimport { html, LitElement, nothing } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { classMap } from 'lit/directives/class-map.js'\nimport { styleMap } from 'lit/directives/style-map.js'\nimport { BroadcastChannelController } from '../common/controllers/BroadcastChannelController.js'\nimport { DirectionController } from '../common/controllers/DirectionController.js'\nimport { EventController } from '../common/controllers/EventController.js'\nimport { LightDismissController } from '../common/controllers/LightDismissController.js'\nimport { SlotController } from '../common/controllers/SlotController.js'\nimport { observe } from '../common/decorators/observe.js'\nimport { cond } from '../common/directives/cond.js'\nimport { fsm } from '../common/fsm.js'\nimport { clamp } from '../common/number.js'\nimport { storage } from '../common/storage.js'\n\nimport componentStyle from '../common/styles/Component.css'\nimport stickyStyle from '../common/styles/Sticky.css'\n\nimport Icon from '../icon/Icon.js'\nimport { LocalizeController } from '../localization/LocalizeController.js'\nimport style from './Layout.css'\nimport { NavOpenChangeEvent } from './NavOpenChangeEvent.js'\nimport { NavResizeEvent } from './NavResizeEvent.js'\nimport '../nav-toggle/NavToggle.js'\nimport '../tooltip/Tooltip.js'\n\nIcon.registerIcon(lockIcon)\n\nlet resizeTooltipIdCounter = 0\n\nconst NAV_DEFAULT_WIDTH = 250\nconst NAV_MIN_WIDTH = 220\nconst NAV_MAX_WIDTH = 400\nconst NAV_COLLAPSE_WIDTH = 100\nconst NAV_RAIL_WIDTH = 64\nconst NAV_RESIZE_STEP = 30\nconst NAV_PEEK_DELAY = 300\nconst NAV_RESIZE_DRAG_THRESHOLD = 4\n\nconst mediaQuery\n = typeof matchMedia !== 'undefined'\n ? matchMedia('(min-width: 768px)')\n : ({\n matches: false,\n addEventListener() {\n /* noop */\n },\n } as unknown as MediaQueryList)\n\nconst navWidthStore = storage('nord-layout.navWidth', NAV_DEFAULT_WIDTH)\n// Tracks the last `default-nav-width` we wrote, so we can re-seed the\n// stored width when consumers change the default between loads.\n// Initial default matches NAV_DEFAULT_WIDTH so existing consumers that\n// never set `default-nav-width` get no re-seed on upgrade — their users'\n// persisted widths are preserved.\nconst navWidthDefaultStore = storage('nord-layout.navWidthDefault', NAV_DEFAULT_WIDTH)\nconst navOpenStore = storage('nord-layout.navOpen', true)\n\nfunction findNavToggleInPath(path: EventTarget[]): HTMLElement | null {\n for (const target of path) {\n if (target instanceof HTMLElement && target.localName === 'nord-nav-toggle') {\n return target\n }\n }\n return null\n}\n\nfunction isNavToggleClick(e: Event): boolean {\n return findNavToggleInPath(e.composedPath()) !== null\n}\n\nconst navMachine = fsm({\n opened: {\n toggle: 'closed',\n close: 'closed',\n },\n closed: {\n toggle: 'opened',\n open: 'opened',\n focusin: 'peek',\n pointerenter: 'peek',\n },\n peek: {\n toggle: 'opened',\n focusout: 'unpeek',\n pointerleave: 'wait',\n dropdownOpen: 'blocked',\n click: 'unpeek',\n open: 'opened',\n },\n blocked: {\n dropdownClose: 'peek',\n open: 'opened',\n },\n wait: {\n toggle: 'opened',\n focusin: 'peek',\n pointerenter: 'peek',\n timeout: 'unpeek',\n },\n unpeek: {\n toggle: 'opened',\n focusin: 'peek',\n pointerenter: 'peek',\n transitionend: 'closed',\n },\n})\n\ntype NavState = States<typeof navMachine>\ntype NavEvent = Events<typeof navMachine>\n\nconst isNavItem = (el: HTMLElement): el is NavItem => el.localName === 'nord-nav-item'\nconst isNavItemLeaf = (el: HTMLElement) => isNavItem(el) && !el.hasSubNav\n\n/**\n * Layout component is used to create the main layout of an app. Layout\n * currently comes with one main configuration: two-column.\n *\n * @status ready\n * @category layout\n * @slot - The default main section content.\n * @slot nav - Used to place content inside the navigation sidebar.\n * @slot top-bar - Used to place the [Top Bar](/components/top-bar/) component.\n * @slot header - Used to place content inside the header section. This slot can be made sticky by utilizing the `sticky` property on the layout component.\n * @slot footer - Used to place content inside the footer section. This slot can be made sticky by utilizing the `stickyFooter` property on the layout component.\n * @slot drawer - Used to place additional content/details relating to a selected item.\n * @slot nav-toggle - Used to place a own nav-toggle component, for cases where you might need to add a tooltip. As an alternative, `<nord-nav-toggle>` can be placed anywhere inside `<nord-layout>` (e.g. inside a `<nord-header>`) — the layout listens for clicks and hover on any descendant `<nord-nav-toggle>` and drives toggle / peek behaviour accordingly. When using that placement, set `hide-default-nav-toggle` to suppress the layout's built-in fallback toggle.\n *\n * @fires {NavOpenChangeEvent} nav-open-change - Dispatched when the navigation open state changes, regardless of the trigger (user toggle, peek, focus, programmatic). The event's `navOpen` property contains the new state.\n * @fires {NavResizeEvent} nav-resize - Dispatched when the navigation sidebar width changes. The event's `width` property contains the new width in pixels.\n *\n * @cssprop [--n-layout-padding=var(--n-space-l)] - Controls the padding around the main layout area (the main slot), using our [spacing tokens](/tokens/#space).\n * @cssprop [--n-layout-drawer-inline-size=320px] - Controls the width of the drawer area, when used.\n * @cssprop [--n-layout-background-color=var(--n-color-background)] - Controls the background color of the layout, using [color tokens](/tokens/#color).\n * @cssprop [--n-layout-nav-border-color=var(--n-color-border)] - Controls the color of the border between the navigation and the main content area when the nav is open on wide screens.\n * @cssprop [--n-layout-resize-color=var(--n-color-accent)] - Controls the colour of the resize handle's accent bar (shown on hover, focus, and while dragging).\n * @cssprop [--n-layout-resize-block-size=100%] - Controls the block-axis (vertical) size of the resize handle. Set to a fixed length (e.g. `200px`) to constrain the handle so it doesn't span the full nav height.\n * @cssprop [--n-layout-resize-inset-inline-end=5px] - Controls the inline-end offset of the resize handle's accent bar (the visible vertical line shown on hover/focus/drag).\n * @cssprop [--n-layout-nav-rail-width=64px] - Controls the width of the navigation column when `collapse-mode=\"rail\"` is active and the nav is closed. Equivalent to the `nav-rail-width` attribute / `navRailWidth` property; the CSS custom property takes precedence when set.\n * @cssprop [--n-layout-header-size=var(--n-space-xxl)] - Controls the block-axis (height) of the layout's header area. Also drives the size of the nav-toggle container and sticky-positioning offsets.\n * @cssprop [--n-layout-drawer-box-shadow=var(--n-box-shadow-nav)] - Controls the box-shadow applied to the drawer (aside) on narrow viewports.\n * @cssprop [--n-layout-drawer-box-shadow-wide=var(--n-box-shadow-header)] - Controls the box-shadow applied to the drawer (aside) on wide viewports (≥1240px).\n * @cssprop [--n-layout-drawer-border-inline-start-width=1px] - Controls the inline-start border width of the drawer on wide viewports.\n * @cssprop [--n-layout-drawer-border-inline-start-color=var(--n-color-border)] - Controls the inline-start border color of the drawer on wide viewports.\n *\n * @localization resizeNavigation - Accessible label for the nav resize separator.\n * @localization navigationCollapsed - Announced by the nav resize separator (`aria-valuetext`) while the navigation is collapsed.\n */\n@customElement('nord-layout')\nexport default class Layout extends LitElement {\n static styles = [componentStyle, stickyStyle, style]\n\n private peekTimeoutId?: ReturnType<typeof setTimeout>\n private readonly resizeTooltipId = `n-layout-resize-tip-${++resizeTooltipIdCounter}`\n\n private navSlot = new SlotController(this, 'nav')\n private drawerSlot = new SlotController(this, 'drawer')\n private topBarSlot = new SlotController(this, 'top-bar')\n private headerSlot = new SlotController(this, 'header')\n private footerSlot = new SlotController(this, 'footer')\n private dividerTooltipSlot = new SlotController(this, 'tooltip-divider')\n private direction = new DirectionController(this)\n private events = new EventController(this)\n private localization = new LocalizeController<'nord-layout'>(this)\n private lightDismiss = new LightDismissController(this, {\n isOpen: () => this.navState === 'opened' && !this.wideScreen,\n onDismiss: () => this.navTransition('close'),\n isDismissible: node => node !== this.navEl,\n })\n\n // Set while applying an incoming BroadcastChannel message. The navOpen\n // observer checks this and skips re-broadcasting so that received changes\n // don't echo back across tabs. Without this gate the two tabs ping-pong\n // on Safari, where microtask scheduling lets their updates interleave\n // past Lit's property equality check.\n private applyingRemote = false\n\n private broadcast = new BroadcastChannelController<{ navOpen?: boolean, navWidth?: number }>(this, {\n channelName: 'nord-layout-nav-state',\n enabled: () => this.syncNavState && this.wideScreen,\n // Merge messages buffered while the tab is hidden so the latest value of\n // each field survives coalescing — a navOpen update must not be dropped by\n // a later navWidth update, and vice versa.\n coalesce: (pending, incoming) => ({ ...pending, ...incoming }),\n onMessage: (data) => {\n this.applyingRemote = true\n // Value-based echo suppression. Applying a value equal to the current one\n // is a wasted reflow, and on Safari the async `applyingRemote` reset can\n // race such that an equal value echoes back and sustains a loop. Skipping\n // unchanged values makes suppression hold regardless of that timing, and\n // is the equality guard the downstream disable (VCF-2146) asked for.\n if (data.navOpen !== undefined && data.navOpen !== this.navOpen) {\n this.navOpen = data.navOpen\n }\n if (data.navWidth !== undefined && data.navWidth !== this.navWidth) {\n this.navWidth = data.navWidth\n }\n this.updateComplete.then(() => {\n this.applyingRemote = false\n })\n },\n })\n\n @query('.n-layout-nav', true) private navEl!: HTMLDivElement\n @query('.n-resize-tooltip') private resizeTooltipEl?: HTMLElement\n @query('.n-sticky') private stickyHeaderEl?: HTMLElement\n @query('slot[name=\"footer\"]') private footerSlotEl?: HTMLSlotElement\n\n // Track the actual rendered block-size of header/footer so consumers\n // (e.g. <nord-aside>) can offset overlay positioning against the real\n // values, not just the static defaults. Single ResizeObserver per\n // dimension, written as public CSS custom properties on the host.\n private headerSizeObserver?: ResizeObserver\n private footerSizeObserver?: ResizeObserver\n private observedFooterElement?: Element\n\n @state() private navWidth = navWidthStore.value\n @state() private isDragging = false\n @state() private navState!: NavState\n @state() private wideScreen = mediaQuery.matches\n\n /**\n * Controls whether the navigation is hidden off-screen or not.\n * Defaults to `true` for wide viewports, and `false` otherwise.\n */\n @property({ reflect: true, type: Boolean, attribute: 'nav-open' }) navOpen!: boolean\n\n /**\n * Controls whether the navigation's open/closed state is persisted across page loads.\n * This is useful for multi-page apps, where clicks on links trigger a full page load.\n */\n @property({ reflect: true, type: Boolean, attribute: 'persist-nav-state' }) persistNavState = false\n\n /**\n * Controls whether the navigation's open/closed state and width is synced across tabs/windows on the same origin.\n * This is useful for long-lived app sessions where you may have multiple tabs/windows open at once.\n */\n @property({ type: Boolean, reflect: true, attribute: 'sync-nav-state' }) syncNavState = false\n\n /**\n * Initial width (in pixels) of the navigation sidebar when no value has been persisted.\n * Changing this value between loads also re-seeds the persisted width for existing users,\n * so design changes propagate without manual localStorage resets.\n */\n @property({ type: Number, reflect: true, attribute: 'default-nav-width' }) defaultNavWidth = NAV_DEFAULT_WIDTH\n\n /**\n * Minimum width (in pixels) the navigation sidebar can be resized to via drag or keyboard.\n */\n @property({ type: Number, reflect: true, attribute: 'min-nav-width' }) minNavWidth = NAV_MIN_WIDTH\n\n /**\n * Maximum width (in pixels) the navigation sidebar can be resized to via drag or keyboard.\n */\n @property({ type: Number, reflect: true, attribute: 'max-nav-width' }) maxNavWidth = NAV_MAX_WIDTH\n\n /**\n * Width (in pixels) of the rail column when `collapse-mode=\"rail\"` is active\n * and the nav is closed. Default 64.\n */\n @property({ type: Number, reflect: true, attribute: 'nav-rail-width' }) navRailWidth = NAV_RAIL_WIDTH\n\n /**\n * Controls the padding of the default main section slot. When set to “none”,\n * the nav and header slots will still have padding.\n */\n @property({ reflect: true }) padding: 'm' | 'none' = 'm'\n\n /**\n * Controls whether the layout's header has sticky positioning.\n */\n @property({ type: Boolean, reflect: true }) sticky: boolean = false\n\n /**\n * Controls whether the layout's footer has sticky positioning.\n */\n @property({ type: Boolean, reflect: true, attribute: 'sticky-footer' }) stickyFooter: boolean = false\n\n /**\n * Suppresses the built-in `<nord-nav-toggle>` rendered as the fallback for\n * the `nav-toggle` slot. Set this when you've placed your own\n * `<nord-nav-toggle>` elsewhere inside the layout (e.g. inside\n * `<nord-header>`) and want the layout's default one hidden.\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-default-nav-toggle' })\n hideDefaultNavToggle: boolean = false\n\n /**\n * Suppresses the built-in collapse button rendered inside the nav (the\n * lock-icon button that toggles the sidebar between opened and the\n * collapsed state defined by `collapse-mode`). Set this when you've\n * placed your own collapse control elsewhere.\n */\n @property({ type: Boolean, reflect: true, attribute: 'hide-collapse-button' })\n hideCollapseButton: boolean = false\n\n /**\n * When set, clicking the resize handle (without dragging) toggles the\n * nav between opened and the collapsed state defined by `collapse-mode`.\n * Dragging the handle still resizes the sidebar as usual; the click\n * behaviour only fires when the pointer barely moves between down and up.\n */\n @property({ type: Boolean, reflect: true, attribute: 'toggle-on-resize-click' })\n toggleOnResizeClick: boolean = false\n\n /**\n * Controls how the navigation renders when closed on wide viewports.\n * `hide` (default) slides the nav off-screen entirely. `rail` keeps a\n * narrow icon-only column visible, with tooltips for labels and flyout\n * popovers for items that have a `subnav` slot.\n *\n * Narrow viewports always use the off-screen behaviour regardless of\n * this setting.\n */\n @property({ reflect: true, attribute: 'collapse-mode' }) collapseMode: 'hide' | 'rail' = 'hide'\n\n /**\n * A getter whose values reflects whether the layout component considers the viewport to be narrow or not.\n * A narrow viewport is considered to be less than 768px wide.\n */\n get isNarrow(): boolean {\n return !this.wideScreen\n }\n\n connectedCallback(): void {\n super.connectedCallback()\n this.events.listen(mediaQuery, 'change', this.handleMediaQueryChange)\n this.addEventListener('click', this.handleHostClick)\n this.addEventListener('mouseover', this.handleHostMouseOver)\n this.addEventListener('mouseout', this.handleHostMouseOut)\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback()\n this.removeEventListener('click', this.handleHostClick)\n this.removeEventListener('mouseover', this.handleHostMouseOver)\n this.removeEventListener('mouseout', this.handleHostMouseOut)\n this.headerSizeObserver?.disconnect()\n this.headerSizeObserver = undefined\n this.footerSizeObserver?.disconnect()\n this.footerSizeObserver = undefined\n this.observedFooterElement = undefined\n this.style.removeProperty('--n-layout-header-block-size')\n this.style.removeProperty('--n-layout-footer-block-size')\n }\n\n protected firstUpdated() {\n if (typeof ResizeObserver === 'undefined')\n return\n if (this.stickyHeaderEl) {\n this.headerSizeObserver = new ResizeObserver(() => this.publishHeaderSize())\n this.headerSizeObserver.observe(this.stickyHeaderEl)\n this.publishHeaderSize()\n }\n if (this.footerSlotEl) {\n this.footerSlotEl.addEventListener('slotchange', this.handleFooterSlotChange)\n this.handleFooterSlotChange()\n }\n }\n\n private publishHeaderSize() {\n const size = this.stickyHeaderEl?.getBoundingClientRect().height ?? 0\n if (size > 0)\n this.style.setProperty('--n-layout-header-block-size', `${size}px`)\n else\n this.style.removeProperty('--n-layout-header-block-size')\n }\n\n private handleFooterSlotChange = () => {\n const next = this.footerSlotEl?.assignedElements({ flatten: true })[0]\n if (next === this.observedFooterElement)\n return\n this.footerSizeObserver?.disconnect()\n this.observedFooterElement = next\n if (!next) {\n this.style.removeProperty('--n-layout-footer-block-size')\n return\n }\n this.footerSizeObserver = new ResizeObserver(() => this.publishFooterSize())\n this.footerSizeObserver.observe(next)\n this.publishFooterSize()\n }\n\n private publishFooterSize() {\n const size = this.observedFooterElement?.getBoundingClientRect().height ?? 0\n if (size > 0)\n this.style.setProperty('--n-layout-footer-block-size', `${size}px`)\n else\n this.style.removeProperty('--n-layout-footer-block-size')\n }\n\n willUpdate() {\n // we only want this logic to run once, before first render\n if (this.hasUpdated) {\n return\n }\n\n // fall back to the built-in constants when consumer-provided attributes\n // are non-numeric (e.g. `min-nav-width=\"abc\"` produces NaN). reflect:true\n // also rewrites the attribute in the DOM to the sanitized value\n if (!Number.isFinite(this.defaultNavWidth)) {\n this.defaultNavWidth = NAV_DEFAULT_WIDTH\n }\n if (!Number.isFinite(this.minNavWidth)) {\n this.minNavWidth = NAV_MIN_WIDTH\n }\n if (!Number.isFinite(this.maxNavWidth)) {\n this.maxNavWidth = NAV_MAX_WIDTH\n }\n\n // re-seed persisted width when the consumer-provided default-nav-width\n // differs from the last default we applied. This lets apps roll out a\n // new sidebar default without manual localStorage migrations.\n if (navWidthDefaultStore.value !== this.defaultNavWidth) {\n this.setNavWidth(this.defaultNavWidth)\n navWidthStore.value = this.navWidth\n // store the raw consumer-provided default so mismatch detection is\n // independent of the min/max clamp\n navWidthDefaultStore.value = this.defaultNavWidth\n }\n else {\n // ensure a previously-persisted width still respects current min/max\n this.setNavWidth(this.navWidth)\n }\n\n // on mobile it should always start closed\n if (this.isNarrow) {\n this.navState = 'closed'\n }\n // if nav state is persisted, and it was previously closed, start closed\n else if (this.persistNavState && navOpenStore.value === false) {\n this.navState = 'closed'\n }\n // otherwise start open\n else {\n this.navState = 'opened'\n }\n }\n\n render() {\n const { navWidth, navState, navSlot, headerSlot, footerSlot, topBarSlot, drawerSlot, isDragging, direction } = this\n const isRailCollapsed = this.wideScreen && this.collapseMode === 'rail' && navState !== 'opened'\n const adjustedNavWidth = navState === 'opened' && this.wideScreen\n ? navWidth\n : isRailCollapsed\n ? NAV_RAIL_WIDTH\n : this.defaultNavWidth\n\n return html`\n <div\n class=${classMap({\n 'n-layout': true,\n 'n-rtl': direction.isRTL,\n 'n-dragging': isDragging,\n 'n-has-header': headerSlot.hasContent,\n 'n-has-footer': footerSlot.hasContent,\n 'n-has-top-bar': topBarSlot.hasContent,\n 'n-has-drawer': drawerSlot.hasContent,\n 'n-has-nav': navSlot.hasContent,\n })}\n style=${styleMap({\n '--_n-layout-nav-width': `${adjustedNavWidth}px`,\n '--_n-layout-nav-rail-width': `var(--n-layout-nav-rail-width, ${this.navRailWidth}px)`,\n // Mirror the min/max nav-width props as px so the hide-mode peek\n // flyout can clamp its intrinsic (`fit-content`) width in CSS.\n '--_n-layout-nav-min-width': `${this.minNavWidth}px`,\n '--_n-layout-nav-max-width': `${this.maxNavWidth}px`,\n })}\n data-nav=${navSlot.hasContent ? navState : 'closed'}\n data-screen=${this.wideScreen ? 'wide' : 'narrow'}\n data-collapse-mode=${this.collapseMode}\n >\n <div\n id=\"n-layout-nav\"\n class=\"n-layout-nav\"\n ?hidden=${navSlot.isEmpty}\n @focusin=${this.handleNavFocus}\n @mouseenter=${this.handleMouseEnter}\n @mouseleave=${this.handleMouseLeave}\n @open=${this.handleDropdownOpen}\n @close=${this.handleDropdownClose}\n >\n <slot name=\"nav\" @click=${this.handleNavClick}></slot>\n <div\n class=\"n-resize\"\n role=\"separator\"\n aria-orientation=\"vertical\"\n tabindex=\"0\"\n aria-label=${this.localization.term('resizeNavigation')}\n aria-controls=\"n-layout-nav\"\n aria-valuemin=${this.minNavWidth}\n aria-valuemax=${this.maxNavWidth}\n aria-valuenow=${this.resizeValueNow}\n aria-valuetext=${cond(navState !== 'opened', this.localization.term('navigationCollapsed'))}\n aria-describedby=${cond(this.dividerTooltipSlot.hasContent && !isDragging, this.resizeTooltipId)}\n @pointerdown=${cond(navState === 'opened' || isRailCollapsed, this.startDragging)}\n @pointermove=${isDragging ? this.handleDrag : this.handleResizeHoverMove}\n @pointerleave=${this.handleResizePointerLeave}\n @pointerup=${this.stopDragging}\n @keydown=${this.handleKeyboardResize}\n ?hidden=${this.isNarrow}\n ></div>\n ${this.dividerTooltipSlot.hasContent\n ? html`\n <nord-tooltip id=${this.resizeTooltipId} position=\"inline-end\" class=\"n-resize-tooltip\">\n <slot name=\"tooltip-divider\"></slot>\n </nord-tooltip>\n `\n : nothing}\n ${this.hideCollapseButton ? nothing : this.renderNavCollapse()}\n </div>\n\n <div class=\"n-layout-main\" @focusin=${this.handleMainFocus} @click=${this.handleMainClick}>\n ${navSlot.hasContent && !this.hideDefaultNavToggle ? this.renderNavToggle() : nothing}\n\n <div class=\"n-top-bar-container\">\n <slot name=\"top-bar\"></slot>\n </div>\n\n <div class=\"n-layout-content\">\n <div class=\"n-sticky\">\n <slot name=\"header\"></slot>\n </div>\n <main>\n <slot></slot>\n </main>\n <slot name=\"footer\"></slot>\n </div>\n\n <aside ?hidden=${this.drawerSlot.isEmpty}>\n <slot name=\"drawer\"></slot>\n </aside>\n </div>\n </div>\n `\n }\n\n private renderNavToggle() {\n return html`\n <div class=\"n-nav-toggle-container\">\n <slot\n name=\"nav-toggle\"\n @click=${this.handleToggleClick}\n @mouseover=${this.handleMouseEnter}\n @mouseout=${this.handleMouseLeave}\n >\n <nord-nav-toggle></nord-nav-toggle>\n </slot>\n </div>\n `\n }\n\n private renderNavCollapse() {\n return html`\n <button class=\"n-collapse-btn\" @click=${this.handleToggleClick}>\n <nord-icon name=\"navigation-toggle-lock\" size=\"s\"></nord-icon>\n </button>\n `\n }\n\n @observe('navWidth', 'updated')\n protected handleNavWidthChange(prev: number) {\n navWidthStore.value = this.navWidth\n if (prev != null) {\n const navWidth = this.navWidth\n this.dispatchEvent(new NavResizeEvent(navWidth))\n }\n }\n\n @observe('navState')\n protected handleNavStateChange(prev: NavState) {\n if (prev === 'wait' && this.peekTimeoutId) {\n clearTimeout(this.peekTimeoutId)\n }\n if (prev === 'unpeek') {\n this.navEl.removeEventListener('transitionend', this.handleTransitionEnd)\n }\n\n switch (this.navState) {\n case 'closed':\n this.navOpen = false\n break\n case 'opened':\n this.navOpen = true\n break\n case 'wait':\n this.peekTimeoutId = setTimeout(() => this.navTransition('timeout'), NAV_PEEK_DELAY)\n break\n case 'unpeek':\n this.navEl.addEventListener('transitionend', this.handleTransitionEnd, { once: true })\n break\n default:\n break\n }\n }\n\n @observe('navOpen', 'updated')\n protected handleOpenChange(prev: boolean) {\n if (!this.isDragging) {\n // when opening nav, it should restore to default width (or larger).\n // unless it is being dragged, in which case the drag width wins\n this.setNavWidth(Math.max(this.navWidth, this.defaultNavWidth))\n }\n\n this.navTransition(this.navOpen ? 'open' : 'close')\n\n if (this.persistNavState) {\n navOpenStore.value = this.navOpen\n }\n\n // skip first update, we only want subsequent changes\n if (prev != null) {\n // Bind to a local so the custom-elements-manifest analyzer can infer\n // the event name from this constructor call site (it reads the bare\n // identifier passed to `new NavOpenChangeEvent(...)`; a `this.x`\n // member access defeats that heuristic and leaves the event nameless,\n // which then crashes `scripts/build-react-types.mjs` on sort).\n const navOpen = this.navOpen\n // Suppress the broadcast when the change came from a received message,\n // otherwise tabs would echo every update back at each other. See the\n // `applyingRemote` field for the full rationale.\n if (!this.applyingRemote) {\n this.broadcast.post({ navOpen })\n }\n this.dispatchEvent(new NavOpenChangeEvent(navOpen))\n }\n }\n\n /* ---------------------------------------------\n / NAVIGATION OPEN/CLOSE LOGIC\n / --------------------------------------------- */\n\n private navTransition(event: NavEvent) {\n this.navState = navMachine.transition(this.navState, event)\n }\n\n private handleNavClick(e: Event) {\n if (!e.defaultPrevented && !this.wideScreen) {\n const target = e.target as HTMLElement\n\n if (isNavItemLeaf(target)) {\n this.navTransition('close')\n }\n }\n }\n\n private handleMainClick() {\n this.navTransition('click')\n }\n\n private handleDropdownOpen(e: Event) {\n const target = e.target as Element\n\n if (target.localName === 'nord-dropdown') {\n this.navTransition('dropdownOpen')\n }\n }\n\n private handleDropdownClose(e: Event) {\n const target = e.target as Element\n\n if (target.localName === 'nord-dropdown') {\n this.navTransition('dropdownClose')\n }\n }\n\n private handleMediaQueryChange = () => {\n this.wideScreen = mediaQuery.matches\n this.navTransition(this.wideScreen ? 'open' : 'close')\n }\n\n private handleToggleClick = (e: Event) => {\n // Skip when a `<nord-nav-toggle>` is in the click path — `handleHostClick`\n // will fire for it. Without this guard, an in-slot `<nord-nav-toggle>`\n // would toggle twice (once via the slot handler, once via the host one).\n if (isNavToggleClick(e)) {\n return\n }\n this.navTransition('toggle')\n }\n\n // Allow `<nord-nav-toggle>` to be placed anywhere inside the layout, not\n // just in the `nav-toggle` slot. Clicks on the host bubble up through the\n // light-DOM subtree; if the composed path contains a `<nord-nav-toggle>`,\n // we treat that as a toggle request.\n private handleHostClick = (e: Event) => {\n if (isNavToggleClick(e)) {\n this.navTransition('toggle')\n }\n }\n\n // Same delegation pattern as `handleHostClick`, but for hover-to-peek.\n // `relatedTarget` filtering avoids re-firing as the cursor moves between\n // children inside the same `<nord-nav-toggle>`.\n private handleHostMouseOver = (e: MouseEvent) => {\n const toggle = findNavToggleInPath(e.composedPath())\n if (!toggle) {\n return\n }\n if (e.relatedTarget instanceof Node && toggle.contains(e.relatedTarget)) {\n return\n }\n this.handleMouseEnter()\n }\n\n private handleHostMouseOut = (e: MouseEvent) => {\n const toggle = findNavToggleInPath(e.composedPath())\n if (!toggle) {\n return\n }\n if (e.relatedTarget instanceof Node && toggle.contains(e.relatedTarget)) {\n return\n }\n this.handleMouseLeave()\n }\n\n private handleNavFocus = () => {\n // In rail mode, the icons are already visible — focus inside the\n // rail should not trigger a peek that re-expands the full sidebar.\n if (this.wideScreen && this.collapseMode === 'rail') {\n return\n }\n this.navTransition('focusin')\n }\n\n private handleMainFocus = () => {\n this.navTransition('focusout')\n }\n\n private handleMouseEnter = () => {\n if (!this.wideScreen) {\n return\n }\n if (this.collapseMode === 'rail') {\n return\n }\n this.navTransition('pointerenter')\n }\n\n private handleMouseLeave = () => {\n if (this.wideScreen && this.collapseMode === 'rail') {\n return\n }\n this.navTransition('pointerleave')\n }\n\n private handleTransitionEnd = () => {\n this.navTransition('transitionend')\n }\n\n /* ---------------------------------------------\n / RESIZE LOGIC\n / --------------------------------------------- */\n\n /**\n * `aria-valuenow` for the focusable resize separator (ARIA window splitter\n * pattern): the current nav width in pixels, bounded by the `min-nav-width`\n * / `max-nav-width` props exposed as `aria-valuemin` / `aria-valuemax`.\n * While the nav is collapsed the value must stay within those bounds, so it\n * reports the minimum and `aria-valuetext` announces the collapsed state.\n */\n private get resizeValueNow(): number {\n if (this.navState !== 'opened') {\n return this.minNavWidth\n }\n return clamp(Math.round(this.navWidth), this.minNavWidth, this.maxNavWidth)\n }\n\n private handleKeyboardResize(e: KeyboardEvent) {\n const {\n navWidth,\n direction: { isLTR },\n } = this\n\n switch (e.key) {\n case 'ArrowLeft':\n this.setNavWidth(navWidth + (isLTR ? -NAV_RESIZE_STEP : NAV_RESIZE_STEP))\n break\n case 'ArrowRight':\n this.setNavWidth(navWidth + (isLTR ? NAV_RESIZE_STEP : -NAV_RESIZE_STEP))\n break\n case 'Enter':\n this.navTransition('toggle')\n break\n case 'Home':\n this.setNavWidth(this.minNavWidth)\n break\n case 'End':\n this.setNavWidth(this.maxNavWidth)\n break\n default:\n return\n }\n\n this.broadcast.post({ navWidth: this.navWidth })\n e.preventDefault()\n }\n\n private setNavWidth(width: number) {\n this.navWidth = clamp(Math.round(width), this.minNavWidth, this.maxNavWidth)\n }\n\n private dragStartX = 0\n private hasDragged = false\n\n private startDragging(e: PointerEvent) {\n if (e.button === 0) {\n const target = e.target as Element\n target.setPointerCapture(e.pointerId)\n this.isDragging = true\n this.dragStartX = e.clientX\n this.hasDragged = false\n }\n }\n\n private stopDragging() {\n if (this.isDragging && this.toggleOnResizeClick && !this.hasDragged) {\n this.navTransition('toggle')\n }\n this.isDragging = false\n this.hasDragged = false\n this.broadcast.post({ navWidth: this.navWidth })\n }\n\n private handleResizeHoverMove = (e: PointerEvent) => {\n const target = e.currentTarget as HTMLElement | null\n if (!target || !this.resizeTooltipEl)\n return\n\n const rect = target.getBoundingClientRect()\n const offset = e.clientY - (rect.top + rect.height / 2)\n this.resizeTooltipEl.style.setProperty('--n-resize-tooltip-y', `${offset}px`)\n }\n\n private handleResizePointerLeave = () => {\n this.stopDragging()\n this.resizeTooltipEl?.style.removeProperty('--n-resize-tooltip-y')\n }\n\n private handleDrag(e: PointerEvent) {\n if (!this.hasDragged && Math.abs(e.clientX - this.dragStartX) < NAV_RESIZE_DRAG_THRESHOLD) {\n return\n }\n this.hasDragged = true\n\n const width = this.direction.isRTL ? this.clientWidth - e.clientX : e.clientX\n\n this.setNavWidth(width)\n this.navTransition(width >= NAV_COLLAPSE_WIDTH ? 'open' : 'close')\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nord-layout': Layout\n }\n}\n"],"names":["defaultEnabled","defaultCoalesce","_pending","incoming","BroadcastChannelController","constructor","host","options","this","handleVisibilityChange","document","hidden","pending","undefined","enabled","onMessage","value","addController","coalesce","hostConnected","BroadcastChannel","channel","channelName","addEventListener","hostDisconnected","_a","removeEventListener","_b","close","handleEvent","event","data","post","message","postMessage","Icon","registerIcon","lockIcon","resizeTooltipIdCounter","NAV_DEFAULT_WIDTH","mediaQuery","matchMedia","matches","navWidthStore","storage","navWidthDefaultStore","navOpenStore","findNavToggleInPath","path","target","HTMLElement","localName","isNavToggleClick","e","composedPath","navMachine","fsm","opened","toggle","closed","open","focusin","pointerenter","peek","focusout","pointerleave","dropdownOpen","click","blocked","dropdownClose","wait","timeout","unpeek","transitionend","Layout","LitElement","resizeTooltipId","navSlot","SlotController","drawerSlot","topBarSlot","headerSlot","footerSlot","dividerTooltipSlot","direction","DirectionController","events","EventController","localization","LocalizeController","lightDismiss","LightDismissController","isOpen","navState","wideScreen","onDismiss","navTransition","isDismissible","node","navEl","applyingRemote","broadcast","syncNavState","navOpen","navWidth","updateComplete","then","isDragging","persistNavState","defaultNavWidth","minNavWidth","maxNavWidth","navRailWidth","padding","sticky","stickyFooter","hideDefaultNavToggle","hideCollapseButton","toggleOnResizeClick","collapseMode","handleFooterSlotChange","next","footerSlotEl","assignedElements","flatten","observedFooterElement","footerSizeObserver","disconnect","ResizeObserver","publishFooterSize","observe","style","removeProperty","handleMediaQueryChange","handleToggleClick","handleHostClick","handleHostMouseOver","relatedTarget","Node","contains","handleMouseEnter","handleHostMouseOut","handleMouseLeave","handleNavFocus","handleMainFocus","handleTransitionEnd","dragStartX","hasDragged","handleResizeHoverMove","currentTarget","resizeTooltipEl","rect","getBoundingClientRect","offset","clientY","top","height","setProperty","handleResizePointerLeave","stopDragging","isNarrow","connectedCallback","super","listen","disconnectedCallback","headerSizeObserver","firstUpdated","stickyHeaderEl","publishHeaderSize","size","willUpdate","hasUpdated","Number","isFinite","setNavWidth","render","isRailCollapsed","adjustedNavWidth","html","classMap","isRTL","hasContent","styleMap","isEmpty","handleDropdownOpen","handleDropdownClose","handleNavClick","term","resizeValueNow","cond","startDragging","handleDrag","handleKeyboardResize","nothing","renderNavCollapse","handleMainClick","renderNavToggle","handleNavWidthChange","prev","dispatchEvent","NavResizeEvent","handleNavStateChange","peekTimeoutId","clearTimeout","setTimeout","once","handleOpenChange","Math","max","NavOpenChangeEvent","transition","defaultPrevented","el","isNavItem","hasSubNav","clamp","round","isLTR","key","preventDefault","width","button","setPointerCapture","pointerId","clientX","abs","clientWidth","styles","componentStyle","stickyStyle","__decorate","query","prototype","state","property","reflect","type","Boolean","attribute","customElement"],"mappings":"0qEAqBA,MAAMA,EAAiB,KAAM,EACvBC,EAAkB,CAAIC,EAAyBC,IAAmBA,QAE3DC,EAOX,WAAAC,CAAYC,EAA8BC,GAsClCC,KAAsBC,uBAAG,KAC/B,GAAwB,oBAAbC,UAA4BA,SAASC,OAC9C,OAEF,MAAMC,EAAUJ,KAAKI,QACrBJ,KAAKI,aAAUC,EACXD,GAAWJ,KAAKD,QAAQO,WAC1BN,KAAKD,QAAQQ,UAAUH,EAAQI,MAChC,EA7CDV,EAAKW,cAAcT,MACnBA,KAAKD,QAAU,CAAEO,QAASd,EAAgBkB,SAAUjB,KAAoBM,EACzE,CAED,aAAAY,GACkC,oBAArBC,mBACTZ,KAAKa,QAAU,IAAID,iBAAiBZ,KAAKD,QAAQe,aACjDd,KAAKa,QAAQE,iBAAiB,UAAWf,OAEnB,oBAAbE,UACTA,SAASa,iBAAiB,mBAAoBf,KAAKC,uBAEtD,CAED,gBAAAe,WACgB,QAAdC,EAAAjB,KAAKa,eAAS,IAAAI,GAAAA,EAAAC,oBAAoB,UAA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,OAAQ+D,SAAS,EAAMG,UAAW,oBAAiDpK,EAAA8J,UAAA,oBAAA,GAMxEF,EAAA,CAA5BI,EAAS,CAAEC,SAAS,KAAmCjK,EAAA8J,UAAA,eAAA,GAKZF,EAAA,CAA3CI,EAAS,CAAEE,KAAMC,QAASF,SAAS,KAA+BjK,EAAA8J,UAAA,cAAA,GAKKF,EAAA,CAAvEI,EAAS,CAAEE,KAAMC,QAASF,SAAS,EAAMG,UAAW,mBAAgDpK,EAAA8J,UAAA,oBAAA,GASrGF,EAAA,CADCI,EAAS,CAAEE,KAAMC,QAASF,SAAS,EAAMG,UAAW,6BAChBpK,EAAA8J,UAAA,4BAAA,GASrCF,EAAA,CADCI,EAAS,CAAEE,KAAMC,QAASF,SAAS,EAAMG,UAAW,0BAClBpK,EAAA8J,UAAA,0BAAA,GASnCF,EAAA,CADCI,EAAS,CAAEE,KAAMC,QAASF,SAAS,EAAMG,UAAW,4BACjBpK,EAAA8J,UAAA,2BAAA,GAWqBF,EAAA,CAAxDI,EAAS,CAAEC,SAAS,EAAMG,UAAW,mBAAyDpK,EAAA8J,UAAA,oBAAA,GAuPrFF,EAAA,CADTpG,EAAQ,WAAY,YAOpBxD,EAAA8J,UAAA,uBAAA,MAGSF,EAAA,CADTpG,EAAQ,aAyBRxD,EAAA8J,UAAA,uBAAA,MAGSF,EAAA,CADTpG,EAAQ,UAAW,YA8BnBxD,EAAA8J,UAAA,mBAAA,MA7dkB9J,EAAM4J,EAAA,CAD1BS,EAAc,gBACMrK,SAAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ShortcutController-CV5b0BZl.js","sources":["../src/common/controllers/ShortcutController.ts"],"sourcesContent":["import type { ReactiveController, ReactiveControllerHost } from 'lit'\nimport type { KeybindingsMap } from 'tinykeys'\nimport { tinykeys } from 'tinykeys'\n\ntype ShortcutTarget = Parameters<typeof tinykeys>[0]\n\nconst ARROW_RE = /Arrow(Up|Down|Left|Right)/g\nconst ESC_RE = /Escape/g\n\nfunction normalise(shortcuts: KeybindingsMap) {\n const normalised: KeybindingsMap = {}\n\n Object.keys(shortcuts).forEach((keybinding) => {\n normalised[keybinding] = shortcuts[keybinding]\n\n // Arrow and Escape keys in IE/Edge have different names\n if (ARROW_RE.test(keybinding)) {\n const mapped = keybinding.replace(ARROW_RE, (_match, capture) => capture)\n normalised[mapped] = normalised[keybinding]\n }\n if (ESC_RE.test(keybinding)) {\n const mapped = keybinding.replace(ESC_RE, () => 'Esc')\n normalised[mapped] = normalised[keybinding]\n }\n })\n\n return normalised\n}\n\nexport class ShortcutController implements ReactiveController {\n private unregister?: ReturnType<typeof tinykeys>\n\n constructor(\n host: ReactiveControllerHost,\n private shortcuts?: KeybindingsMap,\n private target?: ShortcutTarget,\n ) {\n host.addController(this)\n }\n\n hostConnected() {\n if (this.shortcuts) {\n this.bind(this.shortcuts)\n }\n }\n\n hostDisconnected() {\n this.unbind()\n }\n\n unbind() {\n this.unregister?.()\n }\n\n bind(shortcuts: KeybindingsMap) {\n this.unbind()\n this.shortcuts = shortcuts\n // tinykeys v4 added a default `ignore` filter that drops key repeats and\n // events originating from form/contenteditable elements. Our components\n // bind shortcuts to `window`/host but rely on them firing while focus is in\n // an input (e.g. Escape to dismiss, `$mod+k`, command-menu arrow nav) and\n // on key repeat, so we opt out to preserve the pre-v4 behaviour.\n this.unregister = tinykeys(this.target ?? window, normalise(this.shortcuts), { ignore: () => false })\n }\n}\n\nexport type { KeybindingsMap as ShortcutMap }\n"],"names":["ARROW_RE","ESC_RE","ShortcutController","constructor","host","shortcuts","target","this","addController","hostConnected","bind","hostDisconnected","unbind","_a","unregister","call","tinykeys","window","normalised","Object","keys","forEach","keybinding","test","mapped","replace","_match","capture","normalise","ignore"],"mappings":"sCAMA,MAAMA,EAAW,6BACXC,EAAS,gBAsBFC,EAGX,WAAAC,CACEC,EACQC,EACAC,GADAC,KAASF,UAATA,EACAE,KAAMD,OAANA,EAERF,EAAKI,cAAcD,KACpB,CAED,aAAAE,GACMF,KAAKF,WACPE,KAAKG,KAAKH,KAAKF,UAElB,CAED,gBAAAM,GACEJ,KAAKK,QACN,CAED,MAAAA,SACiB,QAAfC,EAAAN,KAAKO,kBAAU,IAAAD,GAAAA,EAAAE,KAAAR,KAChB,CAED,IAAAG,CAAKL,SACHE,KAAKK,SACLL,KAAKF,UAAYA,EAMjBE,KAAKO,WAAaE,EAAoB,QAAXH,EAAAN,KAAKD,cAAM,IAAAO,EAAAA,EAAII,OArD9C,SAAmBZ,GACjB,MAAMa,EAA6B,CAAA,EAgBnC,OAdAC,OAAOC,KAAKf,GAAWgB,SAASC,IAI9B,GAHAJ,EAAWI,GAAcjB,EAAUiB,GAG/BtB,EAASuB,KAAKD,GAAa,CAC7B,MAAME,EAASF,EAAWG,QAAQzB,GAAU,CAAC0B,EAAQC,IAAYA,IACjET,EAAWM,GAAUN,EAAWI,EACjC,CACD,GAAIrB,EAAOsB,KAAKD,GAAa,CAC3B,MAAME,EAASF,EAAWG,QAAQxB,GAAQ,IAAM,QAChDiB,EAAWM,GAAUN,EAAWI,EACjC,KAGIJ,CACT,CAmCsDU,CAAUrB,KAAKF,WAAY,CAAEwB,OAAQ,KAAM,GAC9F"}
1
+ {"version":3,"file":"ShortcutController-CV5b0BZl.js","sources":["../src/common/controllers/ShortcutController.ts"],"sourcesContent":["import type { ReactiveController, ReactiveControllerHost } from 'lit'\nimport type { KeybindingsMap } from 'tinykeys'\nimport { tinykeys } from 'tinykeys'\n\ntype ShortcutTarget = Parameters<typeof tinykeys>[0]\n\nconst ARROW_RE = /Arrow(Up|Down|Left|Right)/g\nconst ESC_RE = /Escape/g\n\nfunction normalise(shortcuts: KeybindingsMap) {\n const normalised: KeybindingsMap = {}\n\n Object.keys(shortcuts).forEach((keybinding) => {\n normalised[keybinding] = shortcuts[keybinding]\n\n // Arrow and Escape keys in IE/Edge have different names\n if (ARROW_RE.test(keybinding)) {\n const mapped = keybinding.replace(ARROW_RE, (_match, capture) => capture)\n normalised[mapped] = normalised[keybinding]\n }\n if (ESC_RE.test(keybinding)) {\n const mapped = keybinding.replace(ESC_RE, () => 'Esc')\n normalised[mapped] = normalised[keybinding]\n }\n })\n\n return normalised\n}\n\nexport class ShortcutController implements ReactiveController {\n private unregister?: ReturnType<typeof tinykeys>\n\n constructor(\n host: ReactiveControllerHost,\n private shortcuts?: KeybindingsMap,\n private target?: ShortcutTarget,\n ) {\n host.addController(this)\n }\n\n hostConnected() {\n if (this.shortcuts) {\n this.bind(this.shortcuts)\n }\n }\n\n hostDisconnected() {\n this.unbind()\n }\n\n unbind() {\n this.unregister?.()\n }\n\n bind(shortcuts: KeybindingsMap) {\n this.unbind()\n this.shortcuts = shortcuts\n // tinykeys v4 added a default `ignore` filter that drops key repeats and\n // events originating from form/contenteditable elements. Our components\n // bind shortcuts to `window`/host but rely on them firing while focus is in\n // an input (e.g. Escape to dismiss, `$mod+k`, command-menu arrow nav) and\n // on key repeat, so we opt out to preserve the pre-v4 behaviour. Per-command\n // \"don't fire while typing\" is handled in KeyboardController instead.\n this.unregister = tinykeys(this.target ?? window, normalise(this.shortcuts), { ignore: () => false })\n }\n}\n\nexport type { KeybindingsMap as ShortcutMap }\n"],"names":["ARROW_RE","ESC_RE","ShortcutController","constructor","host","shortcuts","target","this","addController","hostConnected","bind","hostDisconnected","unbind","_a","unregister","call","tinykeys","window","normalised","Object","keys","forEach","keybinding","test","mapped","replace","_match","capture","normalise","ignore"],"mappings":"sCAMA,MAAMA,EAAW,6BACXC,EAAS,gBAsBFC,EAGX,WAAAC,CACEC,EACQC,EACAC,GADAC,KAASF,UAATA,EACAE,KAAMD,OAANA,EAERF,EAAKI,cAAcD,KACpB,CAED,aAAAE,GACMF,KAAKF,WACPE,KAAKG,KAAKH,KAAKF,UAElB,CAED,gBAAAM,GACEJ,KAAKK,QACN,CAED,MAAAA,SACiB,QAAfC,EAAAN,KAAKO,kBAAU,IAAAD,GAAAA,EAAAE,KAAAR,KAChB,CAED,IAAAG,CAAKL,SACHE,KAAKK,SACLL,KAAKF,UAAYA,EAOjBE,KAAKO,WAAaE,EAAoB,QAAXH,EAAAN,KAAKD,cAAM,IAAAO,EAAAA,EAAII,OAtD9C,SAAmBZ,GACjB,MAAMa,EAA6B,CAAA,EAgBnC,OAdAC,OAAOC,KAAKf,GAAWgB,SAASC,IAI9B,GAHAJ,EAAWI,GAAcjB,EAAUiB,GAG/BtB,EAASuB,KAAKD,GAAa,CAC7B,MAAME,EAASF,EAAWG,QAAQzB,GAAU,CAAC0B,EAAQC,IAAYA,IACjET,EAAWM,GAAUN,EAAWI,EACjC,CACD,GAAIrB,EAAOsB,KAAKD,GAAa,CAC3B,MAAME,EAASF,EAAWG,QAAQxB,GAAQ,IAAM,QAChDiB,EAAWM,GAAUN,EAAWI,EACjC,KAGIJ,CACT,CAoCsDU,CAAUrB,KAAKF,WAAY,CAAEwB,OAAQ,KAAM,GAC9F"}