@aquera/nile-elements 1.8.2 → 1.8.4
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/README.md +6 -0
- package/dist/index.js +87 -43
- package/dist/nile-detail/nile-detail.cjs.js +1 -1
- package/dist/nile-detail/nile-detail.cjs.js.map +1 -1
- package/dist/nile-detail/nile-detail.css.cjs.js +1 -1
- package/dist/nile-detail/nile-detail.css.cjs.js.map +1 -1
- package/dist/nile-detail/nile-detail.css.esm.js +37 -1
- package/dist/nile-detail/nile-detail.esm.js +17 -9
- package/dist/nile-detail/nile-detail.utils.cjs.js +1 -1
- package/dist/nile-detail/nile-detail.utils.cjs.js.map +1 -1
- package/dist/nile-detail/nile-detail.utils.esm.js +1 -1
- package/dist/nile-tree/nile-tree.css.cjs.js +1 -1
- package/dist/nile-tree/nile-tree.css.cjs.js.map +1 -1
- package/dist/nile-tree/nile-tree.css.esm.js +1 -1
- package/dist/nile-tree-item/nile-tree-item.css.cjs.js +1 -1
- package/dist/nile-tree-item/nile-tree-item.css.cjs.js.map +1 -1
- package/dist/nile-tree-item/nile-tree-item.css.esm.js +10 -10
- package/dist/src/nile-detail/nile-detail.css.js +37 -1
- package/dist/src/nile-detail/nile-detail.css.js.map +1 -1
- package/dist/src/nile-detail/nile-detail.d.ts +15 -0
- package/dist/src/nile-detail/nile-detail.js +85 -4
- package/dist/src/nile-detail/nile-detail.js.map +1 -1
- package/dist/src/nile-detail/nile-detail.utils.d.ts +1 -0
- package/dist/src/nile-detail/nile-detail.utils.js +34 -4
- package/dist/src/nile-detail/nile-detail.utils.js.map +1 -1
- package/dist/src/nile-tree/nile-tree.css.js +1 -1
- package/dist/src/nile-tree/nile-tree.css.js.map +1 -1
- package/dist/src/nile-tree-item/nile-tree-item.css.js +10 -10
- package/dist/src/nile-tree-item/nile-tree-item.css.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-detail/nile-detail.css.ts +37 -1
- package/src/nile-detail/nile-detail.ts +87 -3
- package/src/nile-detail/nile-detail.utils.ts +34 -4
- package/src/nile-tree/nile-tree.css.ts +1 -1
- package/src/nile-tree-item/nile-tree-item.css.ts +10 -10
- package/vscode-html-custom-data.json +10 -1
package/dist/index.js
CHANGED
|
@@ -5736,7 +5736,7 @@ class no{constructor(e){this._element=null;const t=e??window;this._node=t,e&&(th
|
|
|
5736
5736
|
* @license
|
|
5737
5737
|
* Copyright 2021 Google LLC
|
|
5738
5738
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
5739
|
-
*/(this._hostElement,e),this._scrollerController=new oo(this,this._clippingAncestors[0]),this._schedule(this._updateLayout),this._observeAndListen(),this._connected=!0}_observeAndListen(){this._mutationObserver.observe(this._hostElement,{childList:!0}),this._hostElementRO.observe(this._hostElement),this._scrollEventListeners.push(window),window.addEventListener("scroll",this,this._scrollEventListenerOptions),this._clippingAncestors.forEach((e=>{e.addEventListener("scroll",this,this._scrollEventListenerOptions),this._scrollEventListeners.push(e),this._hostElementRO.observe(e)})),this._hostElementRO.observe(this._scrollerController.element),this._children.forEach((e=>this._childrenRO.observe(e))),this._scrollEventListeners.forEach((e=>e.addEventListener("scroll",this,this._scrollEventListenerOptions)))}disconnected(){this._scrollEventListeners.forEach((e=>e.removeEventListener("scroll",this,this._scrollEventListenerOptions))),this._scrollEventListeners=[],this._clippingAncestors=[],this._scrollerController?.detach(this),this._scrollerController=null,this._mutationObserver?.disconnect(),this._mutationObserver=null,this._hostElementRO?.disconnect(),this._hostElementRO=null,this._childrenRO?.disconnect(),this._childrenRO=null,this._rejectLayoutCompletePromise("disconnected"),this._connected=!1}_applyVirtualizerStyles(){const e=this._hostElement.style;e.display=e.display||"block",e.position=e.position||"relative",e.contain=e.contain||"size layout",this._isScroller&&(e.overflow=e.overflow||"auto",e.minHeight=e.minHeight||"150px")}_getSizer(){const e=this._hostElement;if(!this._sizer){let t=e.querySelector(`[${so}]`);t||(t=document.createElement("div"),t.setAttribute(so,""),e.appendChild(t)),Object.assign(t.style,{position:"absolute",margin:"-2px 0 0 0",padding:0,visibility:"hidden",fontSize:"2px"}),t.textContent=" ",t.setAttribute(so,""),this._sizer=t}return this._sizer}async updateLayoutConfig(e){await this._layoutInitialized;const t=e.type||ao;if("function"==typeof t&&this._layout instanceof t){const t={...e};return delete t.type,this._layout.config=t,!0}return!1}async _initLayout(e){let t,i;if("function"==typeof e.type){i=e.type;const n={...e};delete n.type,t=n}else t=e;void 0===i&&(ao=i=(await Promise.resolve().then((function(){return Zv}))).FlowLayout),this._layout=new i((e=>this._handleLayoutMessage(e)),t),this._layout.measureChildren&&"function"==typeof this._layout.updateItemSizes&&("function"==typeof this._layout.measureChildren&&(this._measureChildOverride=this._layout.measureChildren),this._measureCallback=this._layout.updateItemSizes.bind(this._layout)),this._layout.listenForChildLoadEvents&&this._hostElement.addEventListener("load",this._loadListener,!0),this._schedule(this._updateLayout)}startBenchmarking(){null===this._benchmarkStart&&(this._benchmarkStart=window.performance.now())}stopBenchmarking(){if(null!==this._benchmarkStart){const e=window.performance.now(),t=e-this._benchmarkStart,i=performance.getEntriesByName("uv-virtualizing","measure").filter((t=>t.startTime>=this._benchmarkStart&&t.startTime<e)).reduce(((e,t)=>e+t.duration),0);return this._benchmarkStart=null,{timeElapsed:t,virtualizationTime:i}}return null}_measureChildren(){const e={},t=this._children,i=this._measureChildOverride||this._measureChild;for(let n=0;n<t.length;n++){const o=t[n],M=this._first+n;(this._itemsChanged||this._toBeMeasured.has(o))&&(e[M]=i.call(this,o,this._items[M]))}this._childMeasurements=e,this._schedule(this._updateLayout),this._toBeMeasured.clear()}_measureChild(e){const{width:t,height:i}=e.getBoundingClientRect();return Object.assign({width:t,height:i},function(e){const t=window.getComputedStyle(e);return{marginTop:go(t.marginTop),marginRight:go(t.marginRight),marginBottom:go(t.marginBottom),marginLeft:go(t.marginLeft)}}(e))}async _schedule(e){this._scheduled.has(e)||(this._scheduled.add(e),await Promise.resolve(),this._scheduled.delete(e),e.call(this))}async _updateDOM(e){this._scrollSize=e.scrollSize,this._adjustRange(e.range),this._childrenPos=e.childPositions,this._scrollError=e.scrollError||null;const{_rangeChanged:t,_itemsChanged:i}=this;this._visibilityChanged&&(this._notifyVisibility(),this._visibilityChanged=!1),(t||i)&&(this._notifyRange(),this._rangeChanged=!1),this._finishDOMUpdate()}_finishDOMUpdate(){this._connected&&(this._children.forEach((e=>this._childrenRO.observe(e))),this._checkScrollIntoViewTarget(this._childrenPos),this._positionChildren(this._childrenPos),this._sizeHostElement(this._scrollSize),this._correctScrollError(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_updateLayout(){this._layout&&this._connected&&(this._layout.items=this._items,this._updateView(),null!==this._childMeasurements&&(this._measureCallback&&this._measureCallback(this._childMeasurements),this._childMeasurements=null),this._layout.reflowIfNeeded(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_handleScrollEvent(){if(this._benchmarkStart&&"mark"in window.performance){try{window.performance.measure("uv-virtualizing","uv-start","uv-end")}catch(e){console.warn("Error measuring performance data: ",e)}window.performance.mark("uv-start")}!1===this._scrollerController.correctingScrollError&&this._layout?.unpin(),this._schedule(this._updateLayout)}handleEvent(e){if("scroll"===e.type)(e.currentTarget===window||this._clippingAncestors.includes(e.currentTarget))&&this._handleScrollEvent();else console.warn("event not handled",e)}_handleLayoutMessage(e){"stateChanged"===e.type?this._updateDOM(e):"visibilityChanged"===e.type?(this._firstVisible=e.firstVisible,this._lastVisible=e.lastVisible,this._notifyVisibility()):"unpinned"===e.type&&this._hostElement.dispatchEvent(new io)}get _children(){const e=[];let t=this._hostElement.firstElementChild;for(;t;)t.hasAttribute(so)||e.push(t),t=t.nextElementSibling;return e}_updateView(){const e=this._hostElement,t=this._scrollerController?.element,i=this._layout;if(e&&t&&i){let n,o,M,r;const s=e.getBoundingClientRect();n=0,o=0,M=window.innerHeight,r=window.innerWidth;const a=this._clippingAncestors.map((e=>e.getBoundingClientRect()));a.unshift(s);for(const e of a)n=Math.max(n,e.top),o=Math.max(o,e.left),M=Math.min(M,e.bottom),r=Math.min(r,e.right);const l=t.getBoundingClientRect(),g={left:s.left-l.left,top:s.top-l.top},N={width:t.scrollWidth,height:t.scrollHeight},c=n-s.top+e.scrollTop,u=o-s.left+e.scrollLeft,D=Math.max(0,M-n),d=Math.max(0,r-o);i.viewportSize={width:d,height:D},i.viewportScroll={top:c,left:u},i.totalScrollSize=N,i.offsetWithinScroller=g}}_sizeHostElement(e){const t=82e5,i=e&&null!==e.width?Math.min(t,e.width):0,n=e&&null!==e.height?Math.min(t,e.height):0;if(this._isScroller)this._getSizer().style.transform=`translate(${i}px, ${n}px)`;else{const e=this._hostElement.style;e.minWidth=i?`${i}px`:"100%",e.minHeight=n?`${n}px`:"100%"}}_positionChildren(e){e&&e.forEach((({top:e,left:t,width:i,height:n,xOffset:o,yOffset:M},r)=>{const s=this._children[r-this._first];s&&(s.style.position="absolute",s.style.boxSizing="border-box",s.style.transform=`translate(${t}px, ${e}px)`,void 0!==i&&(s.style.width=i+"px"),void 0!==n&&(s.style.height=n+"px"),s.style.left=void 0===o?null:o+"px",s.style.top=void 0===M?null:M+"px")}))}async _adjustRange(e){const{_first:t,_last:i,_firstVisible:n,_lastVisible:o}=this;this._first=e.first,this._last=e.last,this._firstVisible=e.firstVisible,this._lastVisible=e.lastVisible,this._rangeChanged=this._rangeChanged||this._first!==t||this._last!==i,this._visibilityChanged=this._visibilityChanged||this._firstVisible!==n||this._lastVisible!==o}_correctScrollError(){if(this._scrollError){const{scrollTop:e,scrollLeft:t}=this._scrollerController,{top:i,left:n}=this._scrollError;this._scrollError=null,this._scrollerController.correctScrollError({top:e-i,left:t-n})}}element(e){return e===1/0&&(e=this._items.length-1),void 0===this._items?.[e]?void 0:{scrollIntoView:(t={})=>this._scrollElementIntoView({...t,index:e})}}_scrollElementIntoView(e){if(e.index>=this._first&&e.index<=this._last)this._children[e.index-this._first].scrollIntoView(e);else if(e.index=Math.min(e.index,this._items.length-1),"smooth"===e.behavior){const t=this._layout.getScrollIntoViewCoordinates(e),{behavior:i}=e;this._updateScrollIntoViewCoordinates=this._scrollerController.managedScrollTo(Object.assign(t,{behavior:i}),(()=>this._layout.getScrollIntoViewCoordinates(e)),(()=>this._scrollIntoViewTarget=null)),this._scrollIntoViewTarget=e}else this._layout.pin=e}_checkScrollIntoViewTarget(e){const{index:t}=this._scrollIntoViewTarget||{};t&&e?.has(t)&&this._updateScrollIntoViewCoordinates(this._layout.getScrollIntoViewCoordinates(this._scrollIntoViewTarget))}_notifyRange(){this._hostElement.dispatchEvent(new eo({first:this._first,last:this._last}))}_notifyVisibility(){this._hostElement.dispatchEvent(new to({first:this._firstVisible,last:this._lastVisible}))}get layoutComplete(){return this._layoutCompletePromise||(this._layoutCompletePromise=new Promise(((e,t)=>{this._layoutCompleteResolver=e,this._layoutCompleteRejecter=t}))),this._layoutCompletePromise}_rejectLayoutCompletePromise(e){null!==this._layoutCompleteRejecter&&this._layoutCompleteRejecter(e),this._resetLayoutCompleteState()}_scheduleLayoutComplete(){this._layoutCompletePromise&&null===this._pendingLayoutComplete&&(this._pendingLayoutComplete=requestAnimationFrame((()=>requestAnimationFrame((()=>this._resolveLayoutCompletePromise())))))}_resolveLayoutCompletePromise(){null!==this._layoutCompleteResolver&&this._layoutCompleteResolver(),this._resetLayoutCompleteState()}_resetLayoutCompleteState(){this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null}_hostElementSizeChanged(){this._schedule(this._updateLayout)}_childLoaded(){}_childrenSizeChanged(e){if(this._layout?.measureChildren){for(const t of e)this._toBeMeasured.set(t.target,t.contentRect);this._measureChildren()}this._scheduleLayoutComplete(),this._itemsChanged=!1,this._rangeChanged=!1}};function go(e){const t=e?parseFloat(e):NaN;return Number.isNaN(t)?0:t}function No(e){if(null!==e.assignedSlot)return e.assignedSlot;if(null!==e.parentElement)return e.parentElement;const t=e.parentNode;return t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host||null}const co=Ae(class extends Xn{constructor(e){if(super(e),this._virtualizer=null,this._first=0,this._last=-1,this._renderItem=(e,t)=>((e,t)=>_`${t}: ${JSON.stringify(e,null,2)}`)(e,t+this._first),this._keyFunction=(e,t)=>(e=>e)(e,this._first),this._items=[],e.type!==ye)throw new Error("The virtualize directive can only be used in child expressions")}render(e){e&&this._setFunctions(e);const t=[];if(this._first>=0&&this._last>=this._first)for(let e=this._first;e<=this._last;e++)t.push(this._items[e]);return Kn(t,this._keyFunction,this._renderItem)}update(e,[t]){this._setFunctions(t);const i=this._items!==t.items;return this._items=t.items||[],this._virtualizer?this._updateVirtualizerConfig(e,t):this._initialize(e,t),i?R:this.render()}async _updateVirtualizerConfig(e,t){if(!await this._virtualizer.updateLayoutConfig(t.layout||{})){const i=e.parentNode;this._makeVirtualizer(i,t)}this._virtualizer.items=this._items}_setFunctions(e){const{renderItem:t,keyFunction:i}=e;t&&(this._renderItem=(e,i)=>t(e,i+this._first)),i&&(this._keyFunction=(e,t)=>i(e,t+this._first))}_makeVirtualizer(e,t){this._virtualizer&&this._virtualizer.disconnected();const{layout:i,scroller:n,items:o}=t;this._virtualizer=new lo({hostElement:e,layout:i,scroller:n}),this._virtualizer.items=o,this._virtualizer.connected()}_initialize(e,t){const i=e.parentNode;i&&1===i.nodeType&&(i.addEventListener("rangeChanged",(e=>{this._first=e.first,this._last=e.last,this.setValue(this.render())})),this._makeVirtualizer(i,t))}disconnected(){this._virtualizer?.disconnected()}reconnected(){this._virtualizer?.connected()}});class uo{static getVirtualizedContent(e,t,i,n,o,M,r,s,a,l,g,N,c,u,D,d){return _`
|
|
5739
|
+
*/(this._hostElement,e),this._scrollerController=new oo(this,this._clippingAncestors[0]),this._schedule(this._updateLayout),this._observeAndListen(),this._connected=!0}_observeAndListen(){this._mutationObserver.observe(this._hostElement,{childList:!0}),this._hostElementRO.observe(this._hostElement),this._scrollEventListeners.push(window),window.addEventListener("scroll",this,this._scrollEventListenerOptions),this._clippingAncestors.forEach((e=>{e.addEventListener("scroll",this,this._scrollEventListenerOptions),this._scrollEventListeners.push(e),this._hostElementRO.observe(e)})),this._hostElementRO.observe(this._scrollerController.element),this._children.forEach((e=>this._childrenRO.observe(e))),this._scrollEventListeners.forEach((e=>e.addEventListener("scroll",this,this._scrollEventListenerOptions)))}disconnected(){this._scrollEventListeners.forEach((e=>e.removeEventListener("scroll",this,this._scrollEventListenerOptions))),this._scrollEventListeners=[],this._clippingAncestors=[],this._scrollerController?.detach(this),this._scrollerController=null,this._mutationObserver?.disconnect(),this._mutationObserver=null,this._hostElementRO?.disconnect(),this._hostElementRO=null,this._childrenRO?.disconnect(),this._childrenRO=null,this._rejectLayoutCompletePromise("disconnected"),this._connected=!1}_applyVirtualizerStyles(){const e=this._hostElement.style;e.display=e.display||"block",e.position=e.position||"relative",e.contain=e.contain||"size layout",this._isScroller&&(e.overflow=e.overflow||"auto",e.minHeight=e.minHeight||"150px")}_getSizer(){const e=this._hostElement;if(!this._sizer){let t=e.querySelector(`[${so}]`);t||(t=document.createElement("div"),t.setAttribute(so,""),e.appendChild(t)),Object.assign(t.style,{position:"absolute",margin:"-2px 0 0 0",padding:0,visibility:"hidden",fontSize:"2px"}),t.textContent=" ",t.setAttribute(so,""),this._sizer=t}return this._sizer}async updateLayoutConfig(e){await this._layoutInitialized;const t=e.type||ao;if("function"==typeof t&&this._layout instanceof t){const t={...e};return delete t.type,this._layout.config=t,!0}return!1}async _initLayout(e){let t,i;if("function"==typeof e.type){i=e.type;const n={...e};delete n.type,t=n}else t=e;void 0===i&&(ao=i=(await Promise.resolve().then((function(){return Vv}))).FlowLayout),this._layout=new i((e=>this._handleLayoutMessage(e)),t),this._layout.measureChildren&&"function"==typeof this._layout.updateItemSizes&&("function"==typeof this._layout.measureChildren&&(this._measureChildOverride=this._layout.measureChildren),this._measureCallback=this._layout.updateItemSizes.bind(this._layout)),this._layout.listenForChildLoadEvents&&this._hostElement.addEventListener("load",this._loadListener,!0),this._schedule(this._updateLayout)}startBenchmarking(){null===this._benchmarkStart&&(this._benchmarkStart=window.performance.now())}stopBenchmarking(){if(null!==this._benchmarkStart){const e=window.performance.now(),t=e-this._benchmarkStart,i=performance.getEntriesByName("uv-virtualizing","measure").filter((t=>t.startTime>=this._benchmarkStart&&t.startTime<e)).reduce(((e,t)=>e+t.duration),0);return this._benchmarkStart=null,{timeElapsed:t,virtualizationTime:i}}return null}_measureChildren(){const e={},t=this._children,i=this._measureChildOverride||this._measureChild;for(let n=0;n<t.length;n++){const o=t[n],M=this._first+n;(this._itemsChanged||this._toBeMeasured.has(o))&&(e[M]=i.call(this,o,this._items[M]))}this._childMeasurements=e,this._schedule(this._updateLayout),this._toBeMeasured.clear()}_measureChild(e){const{width:t,height:i}=e.getBoundingClientRect();return Object.assign({width:t,height:i},function(e){const t=window.getComputedStyle(e);return{marginTop:go(t.marginTop),marginRight:go(t.marginRight),marginBottom:go(t.marginBottom),marginLeft:go(t.marginLeft)}}(e))}async _schedule(e){this._scheduled.has(e)||(this._scheduled.add(e),await Promise.resolve(),this._scheduled.delete(e),e.call(this))}async _updateDOM(e){this._scrollSize=e.scrollSize,this._adjustRange(e.range),this._childrenPos=e.childPositions,this._scrollError=e.scrollError||null;const{_rangeChanged:t,_itemsChanged:i}=this;this._visibilityChanged&&(this._notifyVisibility(),this._visibilityChanged=!1),(t||i)&&(this._notifyRange(),this._rangeChanged=!1),this._finishDOMUpdate()}_finishDOMUpdate(){this._connected&&(this._children.forEach((e=>this._childrenRO.observe(e))),this._checkScrollIntoViewTarget(this._childrenPos),this._positionChildren(this._childrenPos),this._sizeHostElement(this._scrollSize),this._correctScrollError(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_updateLayout(){this._layout&&this._connected&&(this._layout.items=this._items,this._updateView(),null!==this._childMeasurements&&(this._measureCallback&&this._measureCallback(this._childMeasurements),this._childMeasurements=null),this._layout.reflowIfNeeded(),this._benchmarkStart&&"mark"in window.performance&&window.performance.mark("uv-end"))}_handleScrollEvent(){if(this._benchmarkStart&&"mark"in window.performance){try{window.performance.measure("uv-virtualizing","uv-start","uv-end")}catch(e){console.warn("Error measuring performance data: ",e)}window.performance.mark("uv-start")}!1===this._scrollerController.correctingScrollError&&this._layout?.unpin(),this._schedule(this._updateLayout)}handleEvent(e){if("scroll"===e.type)(e.currentTarget===window||this._clippingAncestors.includes(e.currentTarget))&&this._handleScrollEvent();else console.warn("event not handled",e)}_handleLayoutMessage(e){"stateChanged"===e.type?this._updateDOM(e):"visibilityChanged"===e.type?(this._firstVisible=e.firstVisible,this._lastVisible=e.lastVisible,this._notifyVisibility()):"unpinned"===e.type&&this._hostElement.dispatchEvent(new io)}get _children(){const e=[];let t=this._hostElement.firstElementChild;for(;t;)t.hasAttribute(so)||e.push(t),t=t.nextElementSibling;return e}_updateView(){const e=this._hostElement,t=this._scrollerController?.element,i=this._layout;if(e&&t&&i){let n,o,M,r;const s=e.getBoundingClientRect();n=0,o=0,M=window.innerHeight,r=window.innerWidth;const a=this._clippingAncestors.map((e=>e.getBoundingClientRect()));a.unshift(s);for(const e of a)n=Math.max(n,e.top),o=Math.max(o,e.left),M=Math.min(M,e.bottom),r=Math.min(r,e.right);const l=t.getBoundingClientRect(),g={left:s.left-l.left,top:s.top-l.top},N={width:t.scrollWidth,height:t.scrollHeight},c=n-s.top+e.scrollTop,u=o-s.left+e.scrollLeft,D=Math.max(0,M-n),d=Math.max(0,r-o);i.viewportSize={width:d,height:D},i.viewportScroll={top:c,left:u},i.totalScrollSize=N,i.offsetWithinScroller=g}}_sizeHostElement(e){const t=82e5,i=e&&null!==e.width?Math.min(t,e.width):0,n=e&&null!==e.height?Math.min(t,e.height):0;if(this._isScroller)this._getSizer().style.transform=`translate(${i}px, ${n}px)`;else{const e=this._hostElement.style;e.minWidth=i?`${i}px`:"100%",e.minHeight=n?`${n}px`:"100%"}}_positionChildren(e){e&&e.forEach((({top:e,left:t,width:i,height:n,xOffset:o,yOffset:M},r)=>{const s=this._children[r-this._first];s&&(s.style.position="absolute",s.style.boxSizing="border-box",s.style.transform=`translate(${t}px, ${e}px)`,void 0!==i&&(s.style.width=i+"px"),void 0!==n&&(s.style.height=n+"px"),s.style.left=void 0===o?null:o+"px",s.style.top=void 0===M?null:M+"px")}))}async _adjustRange(e){const{_first:t,_last:i,_firstVisible:n,_lastVisible:o}=this;this._first=e.first,this._last=e.last,this._firstVisible=e.firstVisible,this._lastVisible=e.lastVisible,this._rangeChanged=this._rangeChanged||this._first!==t||this._last!==i,this._visibilityChanged=this._visibilityChanged||this._firstVisible!==n||this._lastVisible!==o}_correctScrollError(){if(this._scrollError){const{scrollTop:e,scrollLeft:t}=this._scrollerController,{top:i,left:n}=this._scrollError;this._scrollError=null,this._scrollerController.correctScrollError({top:e-i,left:t-n})}}element(e){return e===1/0&&(e=this._items.length-1),void 0===this._items?.[e]?void 0:{scrollIntoView:(t={})=>this._scrollElementIntoView({...t,index:e})}}_scrollElementIntoView(e){if(e.index>=this._first&&e.index<=this._last)this._children[e.index-this._first].scrollIntoView(e);else if(e.index=Math.min(e.index,this._items.length-1),"smooth"===e.behavior){const t=this._layout.getScrollIntoViewCoordinates(e),{behavior:i}=e;this._updateScrollIntoViewCoordinates=this._scrollerController.managedScrollTo(Object.assign(t,{behavior:i}),(()=>this._layout.getScrollIntoViewCoordinates(e)),(()=>this._scrollIntoViewTarget=null)),this._scrollIntoViewTarget=e}else this._layout.pin=e}_checkScrollIntoViewTarget(e){const{index:t}=this._scrollIntoViewTarget||{};t&&e?.has(t)&&this._updateScrollIntoViewCoordinates(this._layout.getScrollIntoViewCoordinates(this._scrollIntoViewTarget))}_notifyRange(){this._hostElement.dispatchEvent(new eo({first:this._first,last:this._last}))}_notifyVisibility(){this._hostElement.dispatchEvent(new to({first:this._firstVisible,last:this._lastVisible}))}get layoutComplete(){return this._layoutCompletePromise||(this._layoutCompletePromise=new Promise(((e,t)=>{this._layoutCompleteResolver=e,this._layoutCompleteRejecter=t}))),this._layoutCompletePromise}_rejectLayoutCompletePromise(e){null!==this._layoutCompleteRejecter&&this._layoutCompleteRejecter(e),this._resetLayoutCompleteState()}_scheduleLayoutComplete(){this._layoutCompletePromise&&null===this._pendingLayoutComplete&&(this._pendingLayoutComplete=requestAnimationFrame((()=>requestAnimationFrame((()=>this._resolveLayoutCompletePromise())))))}_resolveLayoutCompletePromise(){null!==this._layoutCompleteResolver&&this._layoutCompleteResolver(),this._resetLayoutCompleteState()}_resetLayoutCompleteState(){this._layoutCompletePromise=null,this._layoutCompleteResolver=null,this._layoutCompleteRejecter=null,this._pendingLayoutComplete=null}_hostElementSizeChanged(){this._schedule(this._updateLayout)}_childLoaded(){}_childrenSizeChanged(e){if(this._layout?.measureChildren){for(const t of e)this._toBeMeasured.set(t.target,t.contentRect);this._measureChildren()}this._scheduleLayoutComplete(),this._itemsChanged=!1,this._rangeChanged=!1}};function go(e){const t=e?parseFloat(e):NaN;return Number.isNaN(t)?0:t}function No(e){if(null!==e.assignedSlot)return e.assignedSlot;if(null!==e.parentElement)return e.parentElement;const t=e.parentNode;return t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&t.host||null}const co=Ae(class extends Xn{constructor(e){if(super(e),this._virtualizer=null,this._first=0,this._last=-1,this._renderItem=(e,t)=>((e,t)=>_`${t}: ${JSON.stringify(e,null,2)}`)(e,t+this._first),this._keyFunction=(e,t)=>(e=>e)(e,this._first),this._items=[],e.type!==ye)throw new Error("The virtualize directive can only be used in child expressions")}render(e){e&&this._setFunctions(e);const t=[];if(this._first>=0&&this._last>=this._first)for(let e=this._first;e<=this._last;e++)t.push(this._items[e]);return Kn(t,this._keyFunction,this._renderItem)}update(e,[t]){this._setFunctions(t);const i=this._items!==t.items;return this._items=t.items||[],this._virtualizer?this._updateVirtualizerConfig(e,t):this._initialize(e,t),i?R:this.render()}async _updateVirtualizerConfig(e,t){if(!await this._virtualizer.updateLayoutConfig(t.layout||{})){const i=e.parentNode;this._makeVirtualizer(i,t)}this._virtualizer.items=this._items}_setFunctions(e){const{renderItem:t,keyFunction:i}=e;t&&(this._renderItem=(e,i)=>t(e,i+this._first)),i&&(this._keyFunction=(e,t)=>i(e,t+this._first))}_makeVirtualizer(e,t){this._virtualizer&&this._virtualizer.disconnected();const{layout:i,scroller:n,items:o}=t;this._virtualizer=new lo({hostElement:e,layout:i,scroller:n}),this._virtualizer.items=o,this._virtualizer.connected()}_initialize(e,t){const i=e.parentNode;i&&1===i.nodeType&&(i.addEventListener("rangeChanged",(e=>{this._first=e.first,this._last=e.last,this.setValue(this.render())})),this._makeVirtualizer(i,t))}disconnected(){this._virtualizer?.disconnected()}reconnected(){this._virtualizer?.connected()}});class uo{static getVirtualizedContent(e,t,i,n,o,M,r,s,a,l,g,N,c,u,D,d){return _`
|
|
5740
5740
|
<div part="select-options" class="select__options ${t?"select__options__search-enabled":""} ${c?"loading":""}">
|
|
5741
5741
|
${g&&!c?_`
|
|
5742
5742
|
<div part="select-no-results" class="select__no-results">
|
|
@@ -13414,7 +13414,7 @@ function*(e,t){if(void 0!==e){let i=0;for(const n of e)yield t(n,i++)}}
|
|
|
13414
13414
|
--indent-guide-offset: 0;
|
|
13415
13415
|
--indent-guide-style: solid;
|
|
13416
13416
|
--indent-guide-width: 0;
|
|
13417
|
-
--indent-size: var(--nile-spacing-2xl);
|
|
13417
|
+
--indent-size: var(--nile-spacing-2xl, var(--ng-spacing-2xl));
|
|
13418
13418
|
|
|
13419
13419
|
display: block;
|
|
13420
13420
|
isolation: isolate;
|
|
@@ -13459,7 +13459,7 @@ function*(e,t){if(void 0!==e){let i=0;for(const n of e)yield t(n,i++)}}
|
|
|
13459
13459
|
}
|
|
13460
13460
|
|
|
13461
13461
|
slot:not([name])::slotted(nile-icon) {
|
|
13462
|
-
margin-inline-end: var(--nile-spacing-md);
|
|
13462
|
+
margin-inline-end: var(--nile-spacing-md, var(--ng-spacing-md));
|
|
13463
13463
|
}
|
|
13464
13464
|
|
|
13465
13465
|
.tree-item {
|
|
@@ -13467,7 +13467,7 @@ function*(e,t){if(void 0!==e){let i=0;for(const n of e)yield t(n,i++)}}
|
|
|
13467
13467
|
display: flex;
|
|
13468
13468
|
align-items: stretch;
|
|
13469
13469
|
flex-direction: column;
|
|
13470
|
-
color: var(--nile-colors-dark-900);
|
|
13470
|
+
color: var(--nile-colors-dark-900, var(--ng-colors-text-secondary-700));
|
|
13471
13471
|
cursor: pointer;
|
|
13472
13472
|
user-select: none;
|
|
13473
13473
|
}
|
|
@@ -13479,9 +13479,9 @@ function*(e,t){if(void 0!==e){let i=0;for(const n of e)yield t(n,i++)}}
|
|
|
13479
13479
|
.tree-item__expand-button,
|
|
13480
13480
|
.tree-item__checkbox,
|
|
13481
13481
|
.tree-item__label {
|
|
13482
|
-
font-family: var(--nile-font-family-serif);
|
|
13483
|
-
font-size: var(--nile-type-scale-4);
|
|
13484
|
-
font-weight: var(--nile-font-weight-regular);
|
|
13482
|
+
font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
|
|
13483
|
+
font-size: var(--nile-type-scale-4, var(--ng-font-size-text-sm));
|
|
13484
|
+
font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-medium));
|
|
13485
13485
|
}
|
|
13486
13486
|
|
|
13487
13487
|
.tree-item__checkbox::part(base) {
|
|
@@ -13500,8 +13500,8 @@ function*(e,t){if(void 0!==e){let i=0;for(const n of e)yield t(n,i++)}}
|
|
|
13500
13500
|
align-items: center;
|
|
13501
13501
|
justify-content: center;
|
|
13502
13502
|
box-sizing: content-box;
|
|
13503
|
-
color: var(--nile-colors-neutral-500);
|
|
13504
|
-
padding: var(--nile-spacing-md);
|
|
13503
|
+
color: var(--nile-colors-neutral-500, var(--ng-colors-fg-tertiary-600));
|
|
13504
|
+
padding: var(--nile-spacing-md, var(--ng-spacing-md));
|
|
13505
13505
|
width: 1rem;
|
|
13506
13506
|
height: 1rem;
|
|
13507
13507
|
flex-shrink: 0;
|
|
@@ -13552,12 +13552,12 @@ function*(e,t){if(void 0!==e){let i=0;for(const n of e)yield t(n,i++)}}
|
|
|
13552
13552
|
}
|
|
13553
13553
|
|
|
13554
13554
|
:host(:not([aria-disabled='true'])) .tree-item--selected .tree-item__item {
|
|
13555
|
-
background-color: var(--nile-colors-primary-100);
|
|
13556
|
-
border-inline-start-color: var(--nile-colors-primary-700);
|
|
13555
|
+
background-color: var(--nile-colors-primary-100, var(--ng-colors-bg-brand-primary));
|
|
13556
|
+
border-inline-start-color: var(--nile-colors-primary-700, var(--ng-colors-border-brand));
|
|
13557
13557
|
}
|
|
13558
13558
|
|
|
13559
13559
|
:host(:not([aria-disabled='true'])) .tree-item__expand-button {
|
|
13560
|
-
color: var(--nile-colors-dark-900);
|
|
13560
|
+
color: var(--nile-colors-dark-900, var(--ng-colors-fg-tertiary-600));
|
|
13561
13561
|
}
|
|
13562
13562
|
|
|
13563
13563
|
.tree-item__label {
|
|
@@ -17840,7 +17840,7 @@ nile-rich-text-editor[disabled] .editor a {
|
|
|
17840
17840
|
</span>
|
|
17841
17841
|
`:B}
|
|
17842
17842
|
</button>
|
|
17843
|
-
`}};e([ue({type:String,reflect:!0})],qS.prototype,"color",void 0),e([ue({type:Boolean,reflect:!0})],qS.prototype,"active",void 0),qS=e([ge("nile-color-swatch")],qS);"undefined"!=typeof window&&(window.nileElementsVersion='"1.8.
|
|
17843
|
+
`}};e([ue({type:String,reflect:!0})],qS.prototype,"color",void 0),e([ue({type:Boolean,reflect:!0})],qS.prototype,"active",void 0),qS=e([ge("nile-color-swatch")],qS);"undefined"!=typeof window&&(window.nileElementsVersion='"1.8.4"',window.nileVersion="__NILE_VERSION__",window.process=window.process||{env:{NODE_ENV:"production"}});const KS=r`
|
|
17844
17844
|
:host {
|
|
17845
17845
|
|
|
17846
17846
|
top: 0;
|
|
@@ -19495,6 +19495,41 @@ a {
|
|
|
19495
19495
|
padding: 0;
|
|
19496
19496
|
}
|
|
19497
19497
|
|
|
19498
|
+
/* ── Preview state ──────────────────────────────────────────────────────── */
|
|
19499
|
+
|
|
19500
|
+
.detail__body--preview {
|
|
19501
|
+
position: relative;
|
|
19502
|
+
cursor: pointer;
|
|
19503
|
+
}
|
|
19504
|
+
|
|
19505
|
+
.detail__body--preview::after {
|
|
19506
|
+
content: '';
|
|
19507
|
+
position: absolute;
|
|
19508
|
+
left: 0;
|
|
19509
|
+
right: 0;
|
|
19510
|
+
bottom: 0;
|
|
19511
|
+
height: var(--nile-detail-preview-fade-height, 40px);
|
|
19512
|
+
background: linear-gradient(
|
|
19513
|
+
to bottom,
|
|
19514
|
+
transparent,
|
|
19515
|
+
var(--nile-colors-white-base, var(--ng-colors-bg-primary))
|
|
19516
|
+
);
|
|
19517
|
+
pointer-events: none;
|
|
19518
|
+
}
|
|
19519
|
+
|
|
19520
|
+
.detail__body--preview:focus {
|
|
19521
|
+
outline: none;
|
|
19522
|
+
}
|
|
19523
|
+
|
|
19524
|
+
.detail__body--preview:focus-visible {
|
|
19525
|
+
outline: solid 3px var(--nile-colors-blue-500, var(--ng-colors-fg-brand-primary-600));
|
|
19526
|
+
outline-offset: -3px;
|
|
19527
|
+
}
|
|
19528
|
+
|
|
19529
|
+
.detail--disabled .detail__body--preview {
|
|
19530
|
+
cursor: not-allowed;
|
|
19531
|
+
}
|
|
19532
|
+
|
|
19498
19533
|
/* ── Selection variant ──────────────────────────────────────────────────── */
|
|
19499
19534
|
|
|
19500
19535
|
.detail__selection-label {
|
|
@@ -19751,7 +19786,8 @@ a {
|
|
|
19751
19786
|
var(--nile-spacing-3xl, var(--ng-spacing-3xl));
|
|
19752
19787
|
}
|
|
19753
19788
|
|
|
19754
|
-
.detail--light.detail--open .detail__header
|
|
19789
|
+
.detail--light.detail--open .detail__header,
|
|
19790
|
+
.detail--light.detail--preview .detail__header {
|
|
19755
19791
|
border-bottom: 1px solid var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
|
19756
19792
|
}
|
|
19757
19793
|
|
|
@@ -19759,7 +19795,7 @@ a {
|
|
|
19759
19795
|
.detail--light .detail__selection-content {
|
|
19760
19796
|
padding: var(--nile-spacing-3xl, var(--ng-spacing-3xl));
|
|
19761
19797
|
}
|
|
19762
|
-
`;async function Ik(e){if(!e.open&&!e.disabled)return e.open=!0,Jt(e,"nile-after-show")}async function zk(e){if(e.open&&!e.disabled)return e.open=!1,Jt(e,"nile-after-hide")}_t("detail.show",{keyframes:[{height:"0",opacity:"0"},{height:"auto",opacity:"1"}],options:{duration:300,easing:"ease"}}),_t("detail.hide",{keyframes:[{height:"auto",opacity:"1"},{height:"0",opacity:"0"}],options:{duration:300,easing:"ease"}});const yk="undefined"!=typeof window;let pk=class extends Fe{constructor(){super(...arguments),this.open=!1,this.heading="",this.description="",this.expandIconPlacement="right",this.disabled=!1,this.variant="default",this.items=[],this.selected=[],this.allowHtmlLabel=!1,this.disableLocalSearch=!1,this.pageSize=200,this.placeholderLabel="Loading…",this.searchPlaceholder="Search...",this.itemsLabel="attributes",this.restoreLabel="Restore",this.clearLabel="Clear",this.gridRows=6,this.gridColumns=3,this.minColumnWidth="220px",this.laneHeight=32,this.orientation="horizontal",this.maxHeight="320px",this.matrixColumns=20,this.virtualize=!1,this.virtualizeThreshold=60,this.overscan=4,this._detailOpen=!1,this._hasSlottedContent=!1,this._searchTerm="",this._selectedSet=new Set,this._showSelectedOnly=!1,this.showSelectedToggle=!1,this.selectedOnlyLabel="Selected",this.showAllLabel="Show all",this._restoreDefaults=null,this._gridResizeObserver=null,this._virtCtrl=null,this._rowVirtCtrl=null,this._colVirtCtrl=null,this._pageCache=new Map,this._pendingPages=new Set}get _isSelectionVariant(){return"selection"===this.variant||"select-light"===this.variant}get _isLightVariant(){return"light"===this.variant||"select-light"===this.variant}get _isInfiniteMode(){return this._isSelectionVariant&&"function"==typeof this.fetchPage&&"number"==typeof this.totalCount&&"both"!==this.orientation}_effectiveTotalCount(){return this._isInfiniteMode?this.totalCount??0:this._filteredItems.length}_getItemAt(e){if(!this._isInfiniteMode)return this._filteredItems[e];const t=Math.max(1,this.pageSize),i=Math.floor(e/t),n=this._pageCache.get(i);return n?n[e-i*t]:void 0}_scheduleFetchForRange(e,t){if(!this._isInfiniteMode||!this.fetchPage)return;const i=Math.max(1,this.pageSize),n=this.totalCount??0;if(n<=0)return;const o=Math.floor(e/i),M=Math.floor(Math.min(t,n-1)/i);for(let e=o;e<=M;e++)this._pageCache.has(e)||this._pendingPages.has(e)||this._loadPage(e)}async _loadPage(e){if(!this.fetchPage)return;const t=Math.max(1,this.pageSize),i=e*t,n=this.totalCount??0,o=Math.min(t,Math.max(0,n-i));if(!(o<=0)){this._pendingPages.add(e);try{const t=await this.fetchPage(i,o);this._pageCache.set(e,Array.isArray(t)?t:[]),this.dispatchEvent(new CustomEvent("nile-page-load",{detail:{pageIndex:e,offset:i,limit:o,rows:this._pageCache.get(e)},bubbles:!0,composed:!0}))}catch(t){this.dispatchEvent(new CustomEvent("nile-page-error",{detail:{pageIndex:e,offset:i,limit:o,error:t},bubbles:!0,composed:!0}))}finally{this._pendingPages.delete(e),this.requestUpdate()}}}resetPages(){this._pageCache=new Map,this._pendingPages=new Set,this.requestUpdate()}get _isVirtualized(){return!!yk&&(!!this._isInfiniteMode||this._isSelectionVariant&&(this.virtualize||this.items.length>this.virtualizeThreshold))}get _columnWidthPx(){const e=parseInt(this.minColumnWidth,10);return Number.isFinite(e)&&e>0?e:220}firstUpdated(){this._detailOpen=this.open,this.body.hidden=!this.open,this.body.style.height=this.open?"auto":"0",this._syncSelectedFromProperty(),null===this._restoreDefaults&&(this._restoreDefaults=[...this._selectedSet]),this._setupGridResizeObserver()}disconnectedCallback(){super.disconnectedCallback(),this._gridResizeObserver?.disconnect(),this._gridResizeObserver=null}updated(e){this._isSelectionVariant&&(this._setupGridResizeObserver(),this._syncVirtualizer(),this._scheduleTooltipOverflowCheck())}_syncVirtualizer(){if(!yk)return;if(!this._isVirtualized)return this._virtCtrl=null,this._rowVirtCtrl=null,void(this._colVirtCtrl=null);const e=this.shadowRoot?.querySelector(".detail__selection-grid");if(!e)return;if("both"===this.orientation)return this._virtCtrl=null,void this._syncBothVirtualizers();this._rowVirtCtrl=null,this._colVirtCtrl=null;const t=this._effectiveTotalCount(),i="vertical"===this.orientation,n=Math.max(1,i?this.gridColumns:this.gridRows),o=i?this.laneHeight:this._columnWidthPx;if(!this._virtCtrl)return void(this._virtCtrl=new lM(this,{count:t,getScrollElement:()=>this.shadowRoot?.querySelector(".detail__selection-grid"),estimateSize:()=>o,horizontal:!i,lanes:n,overscan:this.overscan}));const M=this._virtCtrl.getVirtualizer(),r=M.options,s=!!r.horizontal!=!i;(r.count!==t||r.lanes!==n||r.overscan!==this.overscan||s)&&(M.setOptions({...r,count:t,lanes:n,overscan:this.overscan,horizontal:!i,estimateSize:()=>o}),M.measure())}_syncBothVirtualizers(){const e=this._filteredItems.length,t=Math.max(1,this.matrixColumns),i=Math.max(1,Math.ceil(e/t)),n=this._columnWidthPx,o=this.laneHeight,M=()=>this.shadowRoot?.querySelector(".detail__selection-grid");if(this._rowVirtCtrl){const e=this._rowVirtCtrl.getVirtualizer(),t=e.options;t.count===i&&t.overscan===this.overscan||(e.setOptions({...t,count:i,overscan:this.overscan,estimateSize:()=>o}),e.measure())}else this._rowVirtCtrl=new lM(this,{count:i,getScrollElement:M,estimateSize:()=>o,horizontal:!1,overscan:this.overscan});if(this._colVirtCtrl){const e=this._colVirtCtrl.getVirtualizer(),i=e.options;i.count===t&&i.overscan===this.overscan||(e.setOptions({...i,count:t,overscan:this.overscan,estimateSize:()=>n}),e.measure())}else this._colVirtCtrl=new lM(this,{count:t,getScrollElement:M,estimateSize:()=>n,horizontal:!0,overscan:this.overscan})}_setupGridResizeObserver(){if(!this._isSelectionVariant)return;if("undefined"==typeof ResizeObserver)return;const e=this.shadowRoot?.querySelector(".detail__selection-grid");e&&(this._gridResizeObserver||(this._gridResizeObserver=new ResizeObserver((()=>this._scheduleTooltipOverflowCheck())),this._gridResizeObserver.observe(e)))}_scheduleTooltipOverflowCheck(){"undefined"!=typeof requestAnimationFrame&&requestAnimationFrame((()=>this._updateTooltipOverflowStates()))}async _updateTooltipOverflowStates(){const e=this.shadowRoot?.querySelectorAll(".detail__selection-tooltip");if(e)for(const t of e){const e=t.querySelector("nile-checkbox");if(!e)continue;e.updateComplete&&await e.updateComplete;const i=e.shadowRoot?.querySelector('[part="label"]');!!i&&i.scrollWidth>i.clientWidth+1?t.removeAttribute("disabled"):t.setAttribute("disabled","")}}_onSelectedPropertyChange(){this._syncSelectedFromProperty()}_onConfigChange(){this._applyConfig()}_applyConfig(){const e=this.config;if(e){if(void 0!==e.variant&&(this.variant=e.variant),void 0!==e.heading&&(this.heading=e.heading),void 0!==e.description&&(this.description=e.description),void 0!==e.itemsLabel&&(this.itemsLabel=e.itemsLabel),void 0!==e.open&&(this.open=e.open),void 0!==e.disabled&&(this.disabled=e.disabled),void 0!==e.items&&(this.items=e.items),void 0!==e.selected&&(this.selected=e.selected),void 0!==e.renderItemConfig&&(this.renderItemConfig=e.renderItemConfig),void 0!==e.allowHtmlLabel&&(this.allowHtmlLabel=e.allowHtmlLabel),e.layout){const t=e.layout;void 0!==t.orientation&&(this.orientation=t.orientation),void 0!==t.gridRows&&(this.gridRows=t.gridRows),void 0!==t.gridColumns&&(this.gridColumns=t.gridColumns),void 0!==t.matrixColumns&&(this.matrixColumns=t.matrixColumns),void 0!==t.minColumnWidth&&(this.minColumnWidth=t.minColumnWidth),void 0!==t.laneHeight&&(this.laneHeight=t.laneHeight),void 0!==t.maxHeight&&(this.maxHeight=t.maxHeight),void 0!==t.expandIconPlacement&&(this.expandIconPlacement=t.expandIconPlacement)}e.search&&(void 0!==e.search.placeholder&&(this.searchPlaceholder=e.search.placeholder),void 0!==e.search.disableLocal&&(this.disableLocalSearch=e.search.disableLocal)),e.virtualization&&(void 0!==e.virtualization.enabled&&(this.virtualize=e.virtualization.enabled),void 0!==e.virtualization.threshold&&(this.virtualizeThreshold=e.virtualization.threshold),void 0!==e.virtualization.overscan&&(this.overscan=e.virtualization.overscan)),e.pagination&&(void 0!==e.pagination.totalCount&&(this.totalCount=e.pagination.totalCount),void 0!==e.pagination.pageSize&&(this.pageSize=e.pagination.pageSize),void 0!==e.pagination.fetchPage&&(this.fetchPage=e.pagination.fetchPage),void 0!==e.pagination.placeholderLabel&&(this.placeholderLabel=e.pagination.placeholderLabel)),e.labels&&(void 0!==e.labels.restore&&(this.restoreLabel=e.labels.restore),void 0!==e.labels.clear&&(this.clearLabel=e.labels.clear),void 0!==e.labels.selectedOnly&&(this.selectedOnlyLabel=e.labels.selectedOnly),void 0!==e.labels.showAll&&(this.showAllLabel=e.labels.showAll)),void 0!==e.showSelectedToggle&&(this.showSelectedToggle=e.showSelectedToggle)}}_syncSelectedFromProperty(){this._selectedSet=new Set(this.selected||[])}_getItemValue(e){const t=this.renderItemConfig;return t?.getValue?String(t.getValue(e)):"string"==typeof e?e:String(e.value??"")}_getItemLabel(e){const t=this.renderItemConfig;return t?.getDisplayText?t.getDisplayText(e):"string"==typeof e?e:e.label??this._getItemValue(e)}_getItemSearchText(e){const t=this.renderItemConfig;return t?.getSearchText?t.getSearchText(e):this._getItemLabel(e)}_getItemDescription(e){const t=this.renderItemConfig;return t?.getDescription?t.getDescription(e)??"":"string"==typeof e?"":e.description??""}_getItemPrefix(e){const t=this.renderItemConfig;return t?.getPrefix?t.getPrefix(e)??"":"string"==typeof e?"":e.prefix??""}_getItemSuffix(e){const t=this.renderItemConfig;return t?.getSuffix?t.getSuffix(e)??"":"string"==typeof e?"":e.suffix??""}_getItemDisabled(e){const t=this.renderItemConfig;return t?.getDisabled?!!t.getDisabled(e):"string"!=typeof e&&!!e.disabled}_getItemClassName(e){const t=this.renderItemConfig;return t?.getClassName?t.getClassName(e)??"":"string"==typeof e?"":e.className??""}get _filteredItems(){let e=this.items;if(this._showSelectedOnly&&(e=e.filter((e=>this._selectedSet.has(this._getItemValue(e))))),this.disableLocalSearch)return e;const t=this._searchTerm.trim().toLowerCase();return t?e.filter((e=>this._getItemSearchText(e).toLowerCase().includes(t))):e}_onToggleSelectedOnly(e){e.preventDefault();const t=!this._showSelectedOnly;t&&0===this._selectedSet.size||(this._showSelectedOnly=t)}_selectableValues(){return(this._isInfiniteMode?Array.from(this._pageCache.values()).flat():this.items).filter((e=>!this._getItemDisabled(e))).map((e=>this._getItemValue(e)))}get _allChecked(){const e=this._selectableValues();return 0!==e.length&&e.every((e=>this._selectedSet.has(e)))}get _indeterminate(){const e=this._selectableValues(),t=e.filter((e=>this._selectedSet.has(e))).length;return t>0&&t<e.length}get _countLabel(){const e=this._isInfiniteMode?this.totalCount??0:this.items.length;return`${this._selectedSet.size} of ${e} ${this.itemsLabel} selected`}_emitSelectionChange(){this.selected=[...this._selectedSet],this.dispatchEvent(new CustomEvent("nile-change",{detail:{selected:[...this._selectedSet]},bubbles:!0,composed:!0}))}_onItemChange(e,t,i){if(t)return void i.preventDefault();const n=i.target,o=new Set(this._selectedSet);n.checked?o.add(e):o.delete(e),this._selectedSet=o,this._emitSelectionChange()}_onSelectAllChange(e){const t=e.target,i=this._selectableValues(),n=new Set(this._selectedSet);t.checked?i.forEach((e=>n.add(e))):i.forEach((e=>n.delete(e))),this._selectedSet=n,this._emitSelectionChange()}_emitSearch(e){this.dispatchEvent(new CustomEvent("nile-search",{detail:{value:e},bubbles:!0,composed:!0}))}_onSearchInput(e){const t=e.target.value??"";this._searchTerm=t,this.disableLocalSearch&&this._emitSearch(t)}_onSearchClear(){this._searchTerm="",this.disableLocalSearch&&this._emitSearch("")}_onRestore(e){e.preventDefault();const t=this._restoreDefaults??this._selectableValues();this._selectedSet=new Set(t),this._emitSelectionChange()}_onClear(e){e.preventDefault(),this._selectedSet=new Set,this._showSelectedOnly=!1,this._emitSelectionChange()}_handleDefaultSlotChange(e){const t=e.target.assignedNodes({flatten:!0});this._hasSlottedContent=t.some((e=>e.nodeType===Node.ELEMENT_NODE||e.nodeType===Node.TEXT_NODE&&!(!e.textContent||!e.textContent.trim())))}_stopHeaderToggle(e){e.stopPropagation()}_handleSummaryClick(e){e.preventDefault(),function(e){e.disabled||(e.open?zk(e):Ik(e))}(this)}_handleSummaryKeyDown(e){!function(e,t){e.preventDefault(),"Enter"!==e.key&&" "!==e.key||(t.open?zk(t):Ik(t)),"ArrowUp"!==e.key&&"ArrowLeft"!==e.key||zk(t),"ArrowDown"!==e.key&&"ArrowRight"!==e.key||Ik(t)}(e,this)}async handleOpenChange(){this.open?(this._detailOpen=!0,await async function(e){if(e.emit("nile-show",{cancelable:!0}).defaultPrevented)return void(e.open=!1);await Yt(e.body),e.body.hidden=!1;const{keyframes:t,options:i}=Rt(e,"detail.show",{dir:"ltr"});await Qt(e.body,Zt(t,e.body.scrollHeight),i),e.body.style.height="auto",e.emit("nile-after-show")}(this)):(await async function(e){if(e.emit("nile-hide",{cancelable:!0}).defaultPrevented)return void(e.open=!0);await Yt(e.body);const{keyframes:t,options:i}=Rt(e,"detail.hide",{dir:"ltr"});await Qt(e.body,Zt(t,e.body.scrollHeight),i),e.body.hidden=!0,e.body.style.height="auto",e.emit("nile-after-hide")}(this),this._detailOpen=!1)}async show(){return Ik(this)}async hide(){return zk(this)}get _summaryLabel(){return[this.heading,this.description].filter(Boolean).join(", ")}_renderSelectionLabel(){return _`
|
|
19798
|
+
`;function Ik(e){if(!e.preview)return 0;const t=Math.min(100,Math.max(0,e.previewPercentage));return t<=0?0:Math.max(1,Math.round(e.body.scrollHeight*t/100))}async function zk(e){if(!e.open&&!e.disabled)return e.open=!0,Jt(e,"nile-after-show")}async function yk(e){if(e.open&&!e.disabled)return e.open=!1,Jt(e,"nile-after-hide")}_t("detail.show",{keyframes:[{height:"0",opacity:"0"},{height:"auto",opacity:"1"}],options:{duration:300,easing:"ease"}}),_t("detail.hide",{keyframes:[{height:"auto",opacity:"1"},{height:"0",opacity:"0"}],options:{duration:300,easing:"ease"}});const pk="undefined"!=typeof window;let Tk=class extends Fe{constructor(){super(...arguments),this.open=!1,this.heading="",this.description="",this.expandIconPlacement="right",this.disabled=!1,this.preview=!1,this.previewPercentage=30,this.variant="default",this.items=[],this.selected=[],this.allowHtmlLabel=!1,this.disableLocalSearch=!1,this.pageSize=200,this.placeholderLabel="Loading…",this.searchPlaceholder="Search...",this.itemsLabel="attributes",this.restoreLabel="Restore",this.clearLabel="Clear",this.gridRows=6,this.gridColumns=3,this.minColumnWidth="220px",this.laneHeight=32,this.orientation="horizontal",this.maxHeight="320px",this.matrixColumns=20,this.virtualize=!1,this.virtualizeThreshold=60,this.overscan=4,this._detailOpen=!1,this._hasSlottedContent=!1,this._searchTerm="",this._selectedSet=new Set,this._showSelectedOnly=!1,this.showSelectedToggle=!1,this.selectedOnlyLabel="Selected",this.showAllLabel="Show all",this._restoreDefaults=null,this._gridResizeObserver=null,this._virtCtrl=null,this._rowVirtCtrl=null,this._colVirtCtrl=null,this._pageCache=new Map,this._pendingPages=new Set}get _isSelectionVariant(){return"selection"===this.variant||"select-light"===this.variant}get _isLightVariant(){return"light"===this.variant||"select-light"===this.variant}get _previewEnabled(){return this.preview&&Math.min(100,Math.max(0,this.previewPercentage))>0}get _isPreviewActive(){return this._previewEnabled&&!this.open}get _isInfiniteMode(){return this._isSelectionVariant&&"function"==typeof this.fetchPage&&"number"==typeof this.totalCount&&"both"!==this.orientation}_effectiveTotalCount(){return this._isInfiniteMode?this.totalCount??0:this._filteredItems.length}_getItemAt(e){if(!this._isInfiniteMode)return this._filteredItems[e];const t=Math.max(1,this.pageSize),i=Math.floor(e/t),n=this._pageCache.get(i);return n?n[e-i*t]:void 0}_scheduleFetchForRange(e,t){if(!this._isInfiniteMode||!this.fetchPage)return;const i=Math.max(1,this.pageSize),n=this.totalCount??0;if(n<=0)return;const o=Math.floor(e/i),M=Math.floor(Math.min(t,n-1)/i);for(let e=o;e<=M;e++)this._pageCache.has(e)||this._pendingPages.has(e)||this._loadPage(e)}async _loadPage(e){if(!this.fetchPage)return;const t=Math.max(1,this.pageSize),i=e*t,n=this.totalCount??0,o=Math.min(t,Math.max(0,n-i));if(!(o<=0)){this._pendingPages.add(e);try{const t=await this.fetchPage(i,o);this._pageCache.set(e,Array.isArray(t)?t:[]),this.dispatchEvent(new CustomEvent("nile-page-load",{detail:{pageIndex:e,offset:i,limit:o,rows:this._pageCache.get(e)},bubbles:!0,composed:!0}))}catch(t){this.dispatchEvent(new CustomEvent("nile-page-error",{detail:{pageIndex:e,offset:i,limit:o,error:t},bubbles:!0,composed:!0}))}finally{this._pendingPages.delete(e),this.requestUpdate()}}}resetPages(){this._pageCache=new Map,this._pendingPages=new Set,this.requestUpdate()}get _isVirtualized(){return!!pk&&(!!this._isInfiniteMode||this._isSelectionVariant&&(this.virtualize||this.items.length>this.virtualizeThreshold))}get _columnWidthPx(){const e=parseInt(this.minColumnWidth,10);return Number.isFinite(e)&&e>0?e:220}firstUpdated(){this._detailOpen=this.open||this._isPreviewActive,this.body.hidden=!this.open&&!this._isPreviewActive,this.body.style.height=this.open?"auto":"0",this._isPreviewActive&&this._applyPreviewHeight(),this._syncSelectedFromProperty(),null===this._restoreDefaults&&(this._restoreDefaults=[...this._selectedSet]),this._setupGridResizeObserver()}disconnectedCallback(){super.disconnectedCallback(),this._gridResizeObserver?.disconnect(),this._gridResizeObserver=null}updated(e){this._isSelectionVariant&&(this._setupGridResizeObserver(),this._syncVirtualizer(),this._scheduleTooltipOverflowCheck())}_syncVirtualizer(){if(!pk)return;if(!this._isVirtualized)return this._virtCtrl=null,this._rowVirtCtrl=null,void(this._colVirtCtrl=null);const e=this.shadowRoot?.querySelector(".detail__selection-grid");if(!e)return;if("both"===this.orientation)return this._virtCtrl=null,void this._syncBothVirtualizers();this._rowVirtCtrl=null,this._colVirtCtrl=null;const t=this._effectiveTotalCount(),i="vertical"===this.orientation,n=Math.max(1,i?this.gridColumns:this.gridRows),o=i?this.laneHeight:this._columnWidthPx;if(!this._virtCtrl)return void(this._virtCtrl=new lM(this,{count:t,getScrollElement:()=>this.shadowRoot?.querySelector(".detail__selection-grid"),estimateSize:()=>o,horizontal:!i,lanes:n,overscan:this.overscan}));const M=this._virtCtrl.getVirtualizer(),r=M.options,s=!!r.horizontal!=!i;(r.count!==t||r.lanes!==n||r.overscan!==this.overscan||s)&&(M.setOptions({...r,count:t,lanes:n,overscan:this.overscan,horizontal:!i,estimateSize:()=>o}),M.measure())}_syncBothVirtualizers(){const e=this._filteredItems.length,t=Math.max(1,this.matrixColumns),i=Math.max(1,Math.ceil(e/t)),n=this._columnWidthPx,o=this.laneHeight,M=()=>this.shadowRoot?.querySelector(".detail__selection-grid");if(this._rowVirtCtrl){const e=this._rowVirtCtrl.getVirtualizer(),t=e.options;t.count===i&&t.overscan===this.overscan||(e.setOptions({...t,count:i,overscan:this.overscan,estimateSize:()=>o}),e.measure())}else this._rowVirtCtrl=new lM(this,{count:i,getScrollElement:M,estimateSize:()=>o,horizontal:!1,overscan:this.overscan});if(this._colVirtCtrl){const e=this._colVirtCtrl.getVirtualizer(),i=e.options;i.count===t&&i.overscan===this.overscan||(e.setOptions({...i,count:t,overscan:this.overscan,estimateSize:()=>n}),e.measure())}else this._colVirtCtrl=new lM(this,{count:t,getScrollElement:M,estimateSize:()=>n,horizontal:!0,overscan:this.overscan})}_setupGridResizeObserver(){if(!this._isSelectionVariant)return;if("undefined"==typeof ResizeObserver)return;const e=this.shadowRoot?.querySelector(".detail__selection-grid");e&&(this._gridResizeObserver||(this._gridResizeObserver=new ResizeObserver((()=>this._scheduleTooltipOverflowCheck())),this._gridResizeObserver.observe(e)))}_scheduleTooltipOverflowCheck(){"undefined"!=typeof requestAnimationFrame&&requestAnimationFrame((()=>this._updateTooltipOverflowStates()))}async _updateTooltipOverflowStates(){const e=this.shadowRoot?.querySelectorAll(".detail__selection-tooltip");if(e)for(const t of e){const e=t.querySelector("nile-checkbox");if(!e)continue;e.updateComplete&&await e.updateComplete;const i=e.shadowRoot?.querySelector('[part="label"]');!!i&&i.scrollWidth>i.clientWidth+1?t.removeAttribute("disabled"):t.setAttribute("disabled","")}}_onSelectedPropertyChange(){this._syncSelectedFromProperty()}_onConfigChange(){this._applyConfig()}_applyConfig(){const e=this.config;if(e){if(void 0!==e.variant&&(this.variant=e.variant),void 0!==e.heading&&(this.heading=e.heading),void 0!==e.description&&(this.description=e.description),void 0!==e.itemsLabel&&(this.itemsLabel=e.itemsLabel),void 0!==e.open&&(this.open=e.open),void 0!==e.disabled&&(this.disabled=e.disabled),void 0!==e.items&&(this.items=e.items),void 0!==e.selected&&(this.selected=e.selected),void 0!==e.renderItemConfig&&(this.renderItemConfig=e.renderItemConfig),void 0!==e.allowHtmlLabel&&(this.allowHtmlLabel=e.allowHtmlLabel),e.layout){const t=e.layout;void 0!==t.orientation&&(this.orientation=t.orientation),void 0!==t.gridRows&&(this.gridRows=t.gridRows),void 0!==t.gridColumns&&(this.gridColumns=t.gridColumns),void 0!==t.matrixColumns&&(this.matrixColumns=t.matrixColumns),void 0!==t.minColumnWidth&&(this.minColumnWidth=t.minColumnWidth),void 0!==t.laneHeight&&(this.laneHeight=t.laneHeight),void 0!==t.maxHeight&&(this.maxHeight=t.maxHeight),void 0!==t.expandIconPlacement&&(this.expandIconPlacement=t.expandIconPlacement)}e.search&&(void 0!==e.search.placeholder&&(this.searchPlaceholder=e.search.placeholder),void 0!==e.search.disableLocal&&(this.disableLocalSearch=e.search.disableLocal)),e.virtualization&&(void 0!==e.virtualization.enabled&&(this.virtualize=e.virtualization.enabled),void 0!==e.virtualization.threshold&&(this.virtualizeThreshold=e.virtualization.threshold),void 0!==e.virtualization.overscan&&(this.overscan=e.virtualization.overscan)),e.pagination&&(void 0!==e.pagination.totalCount&&(this.totalCount=e.pagination.totalCount),void 0!==e.pagination.pageSize&&(this.pageSize=e.pagination.pageSize),void 0!==e.pagination.fetchPage&&(this.fetchPage=e.pagination.fetchPage),void 0!==e.pagination.placeholderLabel&&(this.placeholderLabel=e.pagination.placeholderLabel)),e.labels&&(void 0!==e.labels.restore&&(this.restoreLabel=e.labels.restore),void 0!==e.labels.clear&&(this.clearLabel=e.labels.clear),void 0!==e.labels.selectedOnly&&(this.selectedOnlyLabel=e.labels.selectedOnly),void 0!==e.labels.showAll&&(this.showAllLabel=e.labels.showAll)),void 0!==e.showSelectedToggle&&(this.showSelectedToggle=e.showSelectedToggle),void 0!==e.preview&&(this.preview=e.preview),void 0!==e.previewPercentage&&(this.previewPercentage=e.previewPercentage)}}_syncSelectedFromProperty(){this._selectedSet=new Set(this.selected||[])}_getItemValue(e){const t=this.renderItemConfig;return t?.getValue?String(t.getValue(e)):"string"==typeof e?e:String(e.value??"")}_getItemLabel(e){const t=this.renderItemConfig;return t?.getDisplayText?t.getDisplayText(e):"string"==typeof e?e:e.label??this._getItemValue(e)}_getItemSearchText(e){const t=this.renderItemConfig;return t?.getSearchText?t.getSearchText(e):this._getItemLabel(e)}_getItemDescription(e){const t=this.renderItemConfig;return t?.getDescription?t.getDescription(e)??"":"string"==typeof e?"":e.description??""}_getItemPrefix(e){const t=this.renderItemConfig;return t?.getPrefix?t.getPrefix(e)??"":"string"==typeof e?"":e.prefix??""}_getItemSuffix(e){const t=this.renderItemConfig;return t?.getSuffix?t.getSuffix(e)??"":"string"==typeof e?"":e.suffix??""}_getItemDisabled(e){const t=this.renderItemConfig;return t?.getDisabled?!!t.getDisabled(e):"string"!=typeof e&&!!e.disabled}_getItemClassName(e){const t=this.renderItemConfig;return t?.getClassName?t.getClassName(e)??"":"string"==typeof e?"":e.className??""}get _filteredItems(){let e=this.items;if(this._showSelectedOnly&&(e=e.filter((e=>this._selectedSet.has(this._getItemValue(e))))),this.disableLocalSearch)return e;const t=this._searchTerm.trim().toLowerCase();return t?e.filter((e=>this._getItemSearchText(e).toLowerCase().includes(t))):e}_onToggleSelectedOnly(e){e.preventDefault();const t=!this._showSelectedOnly;t&&0===this._selectedSet.size||(this._showSelectedOnly=t)}_selectableValues(){return(this._isInfiniteMode?Array.from(this._pageCache.values()).flat():this.items).filter((e=>!this._getItemDisabled(e))).map((e=>this._getItemValue(e)))}get _allChecked(){const e=this._selectableValues();return 0!==e.length&&e.every((e=>this._selectedSet.has(e)))}get _indeterminate(){const e=this._selectableValues(),t=e.filter((e=>this._selectedSet.has(e))).length;return t>0&&t<e.length}get _countLabel(){const e=this._isInfiniteMode?this.totalCount??0:this.items.length;return`${this._selectedSet.size} of ${e} ${this.itemsLabel} selected`}_emitSelectionChange(){this.selected=[...this._selectedSet],this.dispatchEvent(new CustomEvent("nile-change",{detail:{selected:[...this._selectedSet]},bubbles:!0,composed:!0}))}_onItemChange(e,t,i){if(t)return void i.preventDefault();const n=i.target,o=new Set(this._selectedSet);n.checked?o.add(e):o.delete(e),this._selectedSet=o,this._emitSelectionChange()}_onSelectAllChange(e){const t=e.target,i=this._selectableValues(),n=new Set(this._selectedSet);t.checked?i.forEach((e=>n.add(e))):i.forEach((e=>n.delete(e))),this._selectedSet=n,this._emitSelectionChange()}_emitSearch(e){this.dispatchEvent(new CustomEvent("nile-search",{detail:{value:e},bubbles:!0,composed:!0}))}_onSearchInput(e){const t=e.target.value??"";this._searchTerm=t,this.disableLocalSearch&&this._emitSearch(t)}_onSearchClear(){this._searchTerm="",this.disableLocalSearch&&this._emitSearch("")}_onRestore(e){e.preventDefault();const t=this._restoreDefaults??this._selectableValues();this._selectedSet=new Set(t),this._emitSelectionChange()}_onClear(e){e.preventDefault(),this._selectedSet=new Set,this._showSelectedOnly=!1,this._emitSelectionChange()}_handleDefaultSlotChange(e){const t=e.target.assignedNodes({flatten:!0});this._hasSlottedContent=t.some((e=>e.nodeType===Node.ELEMENT_NODE||e.nodeType===Node.TEXT_NODE&&!(!e.textContent||!e.textContent.trim()))),this._isPreviewActive&&this._applyPreviewHeight()}_stopHeaderToggle(e){e.stopPropagation()}_handleSummaryClick(e){e.preventDefault(),function(e){e.disabled||(e.open?yk(e):zk(e))}(this)}_handleSummaryKeyDown(e){!function(e,t){e.preventDefault(),"Enter"!==e.key&&" "!==e.key||(t.open?yk(t):zk(t)),"ArrowUp"!==e.key&&"ArrowLeft"!==e.key||yk(t),"ArrowDown"!==e.key&&"ArrowRight"!==e.key||zk(t)}(e,this)}async handleOpenChange(){this.open?(this._detailOpen=!0,await async function(e){if(e.emit("nile-show",{cancelable:!0}).defaultPrevented)return void(e.open=!1);await Yt(e.body),e.body.hidden=!1;const t=Ik(e),{keyframes:i,options:n}=Rt(e,"detail.show",{dir:"ltr"}),o=t>0?[{height:`${t}px`,opacity:"1"},{height:"auto",opacity:"1"}]:i;await Qt(e.body,Zt(o,e.body.scrollHeight),n),e.body.style.height="auto",e.emit("nile-after-show")}(this)):(await async function(e){if(e.emit("nile-hide",{cancelable:!0}).defaultPrevented)return void(e.open=!0);await Yt(e.body);const t=Ik(e),{keyframes:i,options:n}=Rt(e,"detail.hide",{dir:"ltr"});if(t>0){const i=[{height:"auto",opacity:"1"},{height:`${t}px`,opacity:"1"}];await Qt(e.body,Zt(i,e.body.scrollHeight),n),e.body.style.height=`${t}px`}else await Qt(e.body,Zt(i,e.body.scrollHeight),n),e.body.hidden=!0,e.body.style.height="auto";e.emit("nile-after-hide")}(this),this._detailOpen=this._previewEnabled)}handlePreviewChange(){this.open||(this._previewEnabled?(this._detailOpen=!0,this._applyPreviewHeight()):(this.body.hidden=!0,this.body.style.height="0",this._detailOpen=!1))}async _applyPreviewHeight(){await this.updateComplete,this._isPreviewActive&&this.body&&(this.body.hidden=!1,this.body.style.height=`${Ik(this)}px`)}_handlePreviewClick(){this._isPreviewActive&&!this.disabled&&zk(this)}_handlePreviewKeyDown(e){this._isPreviewActive&&!this.disabled&&("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),zk(this)))}async show(){return zk(this)}async hide(){return yk(this)}get _summaryLabel(){return[this.heading,this.description].filter(Boolean).join(", ")}_renderSelectionLabel(){return _`
|
|
19763
19799
|
<div part="selection-label" class="detail__selection-label">
|
|
19764
19800
|
<nile-checkbox
|
|
19765
19801
|
part="select-all"
|
|
@@ -19857,7 +19893,7 @@ a {
|
|
|
19857
19893
|
<details
|
|
19858
19894
|
part="base"
|
|
19859
19895
|
?open=${this._detailOpen}
|
|
19860
|
-
class=${xe({detail:!0,"detail--open":this.open,"detail--disabled":this.disabled,"detail--selection":e,"detail--light":this._isLightVariant})}
|
|
19896
|
+
class=${xe({detail:!0,"detail--open":this.open,"detail--disabled":this.disabled,"detail--selection":e,"detail--light":this._isLightVariant,"detail--preview":this._isPreviewActive})}
|
|
19861
19897
|
>
|
|
19862
19898
|
<summary
|
|
19863
19899
|
part="header"
|
|
@@ -19895,7 +19931,15 @@ a {
|
|
|
19895
19931
|
|
|
19896
19932
|
</summary>
|
|
19897
19933
|
|
|
19898
|
-
<div
|
|
19934
|
+
<div
|
|
19935
|
+
part="content"
|
|
19936
|
+
class=${xe({detail__body:!0,"detail__body--preview":this._isPreviewActive})}
|
|
19937
|
+
role=${this._isPreviewActive?"button":B}
|
|
19938
|
+
tabindex=${this._isPreviewActive&&!this.disabled?"0":B}
|
|
19939
|
+
aria-label=${this._isPreviewActive?"Expand to view full content":B}
|
|
19940
|
+
@click=${this._handlePreviewClick}
|
|
19941
|
+
@keydown=${this._handlePreviewKeyDown}
|
|
19942
|
+
>
|
|
19899
19943
|
${e?_`<div part="selection-content" class="detail__selection-content">${this._renderSelectionBody()}</div>`:""}
|
|
19900
19944
|
<slot
|
|
19901
19945
|
id="content"
|
|
@@ -19904,7 +19948,7 @@ a {
|
|
|
19904
19948
|
></slot>
|
|
19905
19949
|
</div>
|
|
19906
19950
|
</details>
|
|
19907
|
-
`}};
|
|
19951
|
+
`}};Tk.styles=jk,e([he("details")],Tk.prototype,"detail",void 0),e([he("summary")],Tk.prototype,"header",void 0),e([he(".detail__body")],Tk.prototype,"body",void 0),e([ue({attribute:!0,type:Boolean,reflect:!0})],Tk.prototype,"open",void 0),e([ue({attribute:!0,type:String,reflect:!0})],Tk.prototype,"heading",void 0),e([ue({attribute:!0,type:String,reflect:!0})],Tk.prototype,"description",void 0),e([ue({attribute:!0,reflect:!0})],Tk.prototype,"expandIconPlacement",void 0),e([ue({attribute:!0,type:Boolean,reflect:!0})],Tk.prototype,"disabled",void 0),e([ue({attribute:!0,type:Boolean,reflect:!0})],Tk.prototype,"preview",void 0),e([ue({attribute:"preview-percentage",type:Number,reflect:!0})],Tk.prototype,"previewPercentage",void 0),e([ue({attribute:!0,type:String,reflect:!0})],Tk.prototype,"variant",void 0),e([ue({attribute:!1,type:Array})],Tk.prototype,"items",void 0),e([ue({attribute:!1,type:Array})],Tk.prototype,"selected",void 0),e([ue({attribute:!1})],Tk.prototype,"renderItemConfig",void 0),e([ue({attribute:"allow-html-label",type:Boolean})],Tk.prototype,"allowHtmlLabel",void 0),e([ue({attribute:"disable-local-search",type:Boolean})],Tk.prototype,"disableLocalSearch",void 0),e([ue({attribute:"total-count",type:Number})],Tk.prototype,"totalCount",void 0),e([ue({attribute:"page-size",type:Number})],Tk.prototype,"pageSize",void 0),e([ue({attribute:!1})],Tk.prototype,"fetchPage",void 0),e([ue({attribute:"placeholder-label",type:String})],Tk.prototype,"placeholderLabel",void 0),e([ue({attribute:!1})],Tk.prototype,"config",void 0),e([ue({attribute:"search-placeholder",type:String})],Tk.prototype,"searchPlaceholder",void 0),e([ue({attribute:"items-label",type:String})],Tk.prototype,"itemsLabel",void 0),e([ue({attribute:"restore-label",type:String})],Tk.prototype,"restoreLabel",void 0),e([ue({attribute:"clear-label",type:String})],Tk.prototype,"clearLabel",void 0),e([ue({attribute:"grid-rows",type:Number})],Tk.prototype,"gridRows",void 0),e([ue({attribute:"grid-columns",type:Number})],Tk.prototype,"gridColumns",void 0),e([ue({attribute:"min-column-width",type:String})],Tk.prototype,"minColumnWidth",void 0),e([ue({attribute:"lane-height",type:Number})],Tk.prototype,"laneHeight",void 0),e([ue({attribute:!0,type:String,reflect:!0})],Tk.prototype,"orientation",void 0),e([ue({attribute:"max-height",type:String})],Tk.prototype,"maxHeight",void 0),e([ue({attribute:"matrix-columns",type:Number})],Tk.prototype,"matrixColumns",void 0),e([ue({attribute:!0,type:Boolean})],Tk.prototype,"virtualize",void 0),e([ue({attribute:"virtualize-threshold",type:Number})],Tk.prototype,"virtualizeThreshold",void 0),e([ue({attribute:"overscan",type:Number})],Tk.prototype,"overscan",void 0),e([De()],Tk.prototype,"_detailOpen",void 0),e([De()],Tk.prototype,"_hasSlottedContent",void 0),e([De()],Tk.prototype,"_searchTerm",void 0),e([De()],Tk.prototype,"_selectedSet",void 0),e([De()],Tk.prototype,"_showSelectedOnly",void 0),e([ue({attribute:"show-selected-toggle",type:Boolean,reflect:!0})],Tk.prototype,"showSelectedToggle",void 0),e([ue({attribute:"selected-only-label",type:String})],Tk.prototype,"selectedOnlyLabel",void 0),e([ue({attribute:"show-all-label",type:String})],Tk.prototype,"showAllLabel",void 0),e([We("selected",{waitUntilFirstUpdate:!1})],Tk.prototype,"_onSelectedPropertyChange",null),e([We("config",{waitUntilFirstUpdate:!1})],Tk.prototype,"_onConfigChange",null),e([We("open",{waitUntilFirstUpdate:!0})],Tk.prototype,"handleOpenChange",null),e([We(["preview","previewPercentage"],{waitUntilFirstUpdate:!0})],Tk.prototype,"handlePreviewChange",null),Tk=e([ge("nile-detail")],Tk);const Ak=r`
|
|
19908
19952
|
:host {
|
|
19909
19953
|
display: inline-block;
|
|
19910
19954
|
-webkit-font-smoothing: var(--nile-webkit-font-smoothing, var(--ng-webkit-font-smoothing));
|
|
@@ -19915,7 +19959,7 @@ a {
|
|
|
19915
19959
|
canvas {
|
|
19916
19960
|
display: block;
|
|
19917
19961
|
}
|
|
19918
|
-
`,
|
|
19962
|
+
`,Ok={L:0,M:1,Q:2,H:3},xk=[[19,16,13,9],[34,28,22,16],[55,44,34,26],[80,64,48,36],[108,86,62,46],[136,108,76,60],[156,124,88,66],[194,154,110,86],[232,182,132,100],[274,216,154,122],[324,254,180,140],[370,290,206,158],[428,334,244,180],[461,365,261,197],[523,415,295,223],[589,453,325,253],[647,507,367,283],[721,563,397,313],[795,627,445,341],[861,669,485,385],[932,714,512,406],[1006,782,568,442],[1094,860,614,464],[1174,914,664,514],[1276,1e3,718,538],[1370,1062,754,596],[1468,1128,808,628],[1531,1193,871,661],[1631,1267,911,701],[1735,1373,985,745],[1843,1455,1033,793],[1955,1541,1115,845],[2071,1631,1171,901],[2191,1725,1231,961],[2306,1812,1286,986],[2434,1914,1354,1054],[2566,1992,1426,1096],[2702,2102,1502,1142],[2812,2216,1582,1222],[2956,2334,1666,1276]],Lk=[26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706],mk=[[[1,19,0,0],[1,16,0,0],[1,13,0,0],[1,9,0,0]],[[1,34,0,0],[1,28,0,0],[1,22,0,0],[1,16,0,0]],[[1,55,0,0],[1,44,0,0],[2,17,0,0],[2,13,0,0]],[[1,80,0,0],[2,32,0,0],[2,24,0,0],[4,9,0,0]],[[1,108,0,0],[2,43,0,0],[2,15,2,16],[2,11,2,12]],[[2,68,0,0],[4,27,0,0],[4,19,0,0],[4,15,0,0]],[[2,78,0,0],[4,31,0,0],[2,14,4,15],[4,13,1,14]],[[2,97,0,0],[2,38,2,39],[4,18,2,19],[4,14,2,15]],[[2,116,0,0],[3,36,2,37],[4,16,4,17],[4,12,4,13]],[[2,68,2,69],[4,43,1,44],[6,19,2,20],[6,15,2,16]],[[4,81,0,0],[1,50,4,51],[4,22,4,23],[3,12,8,13]],[[2,92,2,93],[6,36,2,37],[4,20,6,21],[7,14,4,15]],[[4,107,0,0],[8,37,1,38],[8,20,4,21],[12,11,4,12]],[[3,115,1,116],[4,40,5,41],[11,16,5,17],[11,12,5,13]],[[5,87,1,88],[5,41,5,42],[5,24,7,25],[11,12,7,13]],[[5,98,1,99],[7,45,3,46],[15,19,2,20],[3,15,13,16]],[[1,107,5,108],[10,46,1,47],[1,22,15,23],[2,14,17,15]],[[5,120,1,121],[9,43,4,44],[17,22,1,23],[2,14,19,15]],[[3,113,4,114],[3,44,11,45],[17,21,4,22],[9,13,16,14]],[[3,107,5,108],[3,41,13,42],[15,24,5,25],[15,15,10,16]],[[4,116,4,117],[17,42,0,0],[17,22,6,23],[19,16,6,17]],[[2,111,7,112],[17,46,0,0],[7,24,16,25],[34,13,0,0]],[[4,121,5,122],[4,47,14,48],[11,24,14,25],[16,15,14,16]],[[6,117,4,118],[6,45,14,46],[11,24,16,25],[30,16,2,17]],[[8,106,4,107],[8,47,13,48],[7,24,22,25],[22,15,13,16]],[[10,114,2,115],[19,46,4,47],[28,22,6,23],[33,16,4,17]],[[8,122,4,123],[22,45,3,46],[8,23,26,24],[12,15,28,16]],[[3,117,10,118],[3,45,23,46],[4,24,31,25],[11,15,31,16]],[[7,116,7,117],[21,45,7,46],[1,23,37,24],[19,15,26,16]],[[5,115,10,116],[19,47,10,48],[15,24,25,25],[23,15,25,16]],[[13,115,3,116],[2,46,29,47],[42,24,1,25],[23,15,28,16]],[[17,115,0,0],[10,46,23,47],[10,24,35,25],[19,15,35,16]],[[17,115,1,116],[14,46,21,47],[29,24,19,25],[11,15,46,16]],[[13,115,6,116],[14,46,23,47],[44,24,7,25],[59,16,1,17]],[[12,121,7,122],[12,47,26,48],[39,24,14,25],[22,15,41,16]],[[6,121,14,122],[6,47,34,48],[46,24,10,25],[2,15,64,16]],[[17,122,4,123],[29,46,14,47],[49,24,10,25],[24,15,46,16]],[[4,122,18,123],[13,46,32,47],[48,24,14,25],[42,15,32,16]],[[20,117,4,118],[40,47,7,48],[43,24,22,25],[10,15,67,16]],[[19,118,6,119],[18,47,31,48],[34,24,34,25],[20,15,61,16]]],Sk=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],wk=[[30660,29427,32170,30877,26159,25368,27713,26998],[21522,20773,24188,23371,17913,16590,20375,19104],[13663,12392,16177,14854,9396,8579,11994,11245],[5769,5054,7399,6608,1890,597,3340,2107]],Ek=[31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017],bk=new Uint8Array(512),kk=new Uint8Array(256);function vk(e,t){return 0===e||0===t?0:bk[kk[e]+kk[t]]}function fk(e,t){const i=function(e){const t=new Uint8Array(e+1);t[0]=1;for(let i=0;i<e;i++)for(let n=e;n>=1;n--)t[n]=t[n]^vk(t[n-1],bk[i]);return t}(t),n=new Uint8Array(t);for(let o=0;o<e.length;o++){const M=e[o]^n[0];for(let e=0;e<t-1;e++)n[e]=n[e+1]^vk(i[e+1],M);n[t-1]=vk(i[t],M)}return n}function Qk(e){return Array.from({length:e},(()=>Array(e).fill(-1)))}function Ck(e,t,i,n){t>=0&&t<e.length&&i>=0&&i<e.length&&(e[t][i]=n)}function Uk(e,t,i){for(let n=-1;n<=7;n++)for(let o=-1;o<=7;o++){let M=0;n>=0&&n<=6&&o>=0&&o<=6&&(0===n||6===n||0===o||6===o||n>=2&&n<=4&&o>=2&&o<=4)&&(M=1),Ck(e,t+n,i+o,M)}}function Yk(e,t){if(t<2)return;const i=Sk[t-1];for(const t of i)for(const n of i)if(-1===e[t][n])for(let i=-2;i<=2;i++)for(let o=-2;o<=2;o++){Ck(e,t+i,n+o,2===Math.abs(i)||2===Math.abs(o)||0===i&&0===o?1:0)}}function Zk(e){const t=e.length;for(let i=8;i<t-8;i++)-1===e[6][i]&&(e[6][i]=(i+1)%2),-1===e[i][6]&&(e[i][6]=(i+1)%2)}function Vk(e){const t=e.length;for(let t=0;t<=8;t++)-1===e[8][t]&&(e[8][t]=0),-1===e[t][8]&&(e[t][8]=0);for(let i=0;i<=7;i++)-1===e[8][t-1-i]&&(e[8][t-1-i]=0);for(let i=0;i<=7;i++)-1===e[t-1-i][8]&&(e[t-1-i][8]=0);e[t-8][8]=1}function Pk(e,t){if(t<7)return;const i=e.length;for(let t=0;t<6;t++)for(let n=0;n<3;n++)-1===e[t][i-11+n]&&(e[t][i-11+n]=0),-1===e[i-11+n][t]&&(e[i-11+n][t]=0)}!function(){let e=1;for(let t=0;t<255;t++)bk[t]=e,kk[e]=t,e<<=1,e>=256&&(e^=285);for(let e=255;e<512;e++)bk[e]=bk[e-255]}();const Wk=[(e,t)=>(e+t)%2==0,(e,t)=>e%2==0,(e,t)=>t%3==0,(e,t)=>(e+t)%3==0,(e,t)=>(Math.floor(e/2)+Math.floor(t/3))%2==0,(e,t)=>e*t%2+e*t%3==0,(e,t)=>(e*t%2+e*t%3)%2==0,(e,t)=>((e+t)%2+e*t%3)%2==0];function _k(e,t,i,n){return-1!==t[i][n]}function Rk(e,t,i){const n=e.length,o=e.map((e=>[...e])),M=Wk[i];for(let e=0;e<n;e++)for(let i=0;i<n;i++)!_k(0,t,e,i)&&M(e,i)&&(o[e][i]^=1);return o}function Bk(e,t,i){const n=wk[Ok[t]][i],o=e.length;for(let t=0;t<=5;t++)e[8][t]=n>>>14-t&1;e[8][7]=n>>>8&1,e[8][8]=n>>>7&1,e[7][8]=n>>>6&1;for(let t=0;t<=5;t++)e[5-t][8]=n>>>t&1;for(let t=0;t<=7;t++)e[8][o-1-t]=n>>>t&1;for(let t=0;t<=6;t++)e[o-1-t][8]=n>>>14-t&1;e[o-8][8]=1}function Gk(e,t){if(t<7)return;const i=Ek[t-7],n=e.length;for(let t=0;t<6;t++)for(let o=0;o<3;o++){const M=i>>>3*t+o&1;e[t][n-11+o]=M,e[n-11+o][t]=M}}function Fk(e){const t=e.length;let i=0;for(let n=0;n<t;n++){let o=1;for(let M=1;M<t;M++)e[n][M]===e[n][M-1]?o++:(o>=5&&(i+=o-2),o=1);o>=5&&(i+=o-2)}for(let n=0;n<t;n++){let o=1;for(let M=1;M<t;M++)e[M][n]===e[M-1][n]?o++:(o>=5&&(i+=o-2),o=1);o>=5&&(i+=o-2)}for(let n=0;n<t-1;n++)for(let o=0;o<t-1;o++){const t=e[n][o];t===e[n][o+1]&&t===e[n+1][o]&&t===e[n+1][o+1]&&(i+=3)}const n=[1,0,1,1,1,0,1,0,0,0,0],o=[0,0,0,0,1,0,1,1,1,0,1];for(let M=0;M<t;M++)for(let r=0;r<=t-11;r++){let t=!0,s=!0;for(let i=0;i<11;i++)e[M][r+i]!==n[i]&&(t=!1),e[M][r+i]!==o[i]&&(s=!1);(t||s)&&(i+=40)}for(let M=0;M<t;M++)for(let r=0;r<=t-11;r++){let t=!0,s=!0;for(let i=0;i<11;i++)e[r+i][M]!==n[i]&&(t=!1),e[r+i][M]!==o[i]&&(s=!1);(t||s)&&(i+=40)}let M=0;for(let i=0;i<t;i++)for(let n=0;n<t;n++)1===e[i][n]&&M++;const r=M/(t*t)*100,s=5*Math.floor(r/5),a=s+5;return i+=10*Math.min(Math.abs(s-50)/5,Math.abs(a-50)/5),i}function Hk(e,t="H"){if(!e)return Array.from({length:21},(()=>Array(21).fill(0)));const i=function(e,t){const i=(new TextEncoder).encode(e).length,n=Ok[t];for(let e=1;e<=40;e++)if(4+(e<=9?8:16)+8*i<=8*xk[e-1][n])return e;throw new Error("Data too long for any QR version")}(e,t),n=function(e){return 4*e+17}(i),o=Qk(n);Uk(o,0,0),Uk(o,0,n-7),Uk(o,n-7,0),Yk(o,i),Zk(o),Vk(o),Pk(o,i);const M=Qk(n);Uk(M,0,0),Uk(M,0,n-7),Uk(M,n-7,0),Yk(M,i),Zk(M),Vk(M),Pk(M,i);const r=function(e,t,i){const n=xk[t-1][Ok[i]],o=(new TextEncoder).encode(e),M=[],r=(e,t)=>{for(let i=t-1;i>=0;i--)M.push(e>>>i&1)};r(4,4);const s=t<=9?8:16;r(o.length,s);for(const e of o)r(e,8);const a=8*n;for(r(0,Math.min(4,a-M.length));M.length%8!=0;)M.push(0);const l=[236,17];let g=0;for(;M.length<a;)r(l[g],8),g^=1;const N=new Uint8Array(n);for(let e=0;e<n;e++){let t=0;for(let i=0;i<8;i++)t=t<<1|M[8*e+i];N[e]=t}return N}(e,i,t),s=function(e,t,i){const n=Ok[i],[o,M,r,s]=mk[t-1][n],a=Lk[t-1],l=o+r,g=Math.floor((a-xk[t-1][n])/l),N=[],c=[];let u=0;for(let t=0;t<o;t++){const t=e.slice(u,u+M);N.push(t),c.push(fk(t,g)),u+=M}for(let t=0;t<r;t++){const t=e.slice(u,u+s);N.push(t),c.push(fk(t,g)),u+=s}const D=[],d=Math.max(M,s);for(let e=0;e<d;e++)for(let t=0;t<l;t++)e<N[t].length&&D.push(N[t][e]);for(let e=0;e<g;e++)for(let t=0;t<l;t++)D.push(c[t][e]);return new Uint8Array(D)}(r,i,t);!function(e,t){const i=e.length;let n=0;const o=8*t.length;let M=!0;for(let r=i-1;r>=1;r-=2){6===r&&(r=5);for(let s=0;s<i;s++){const a=M?i-1-s:s;for(let i=0;i<=1;i++){const M=r-i;if(-1===e[a][M])if(n<o){const i=n>>>3,o=7-(7&n);e[a][M]=t[i]>>>o&1,n++}else e[a][M]=0}}M=!M}}(M,s);let a=0,l=1/0,g=M;for(let e=0;e<8;e++){const n=Rk(M,o,e);Bk(n,t,e),Gk(n,i);const r=Fk(n);r<l&&(l=r,a=e,g=n)}return Bk(g,t,a),Gk(g,i),g}let $k=class extends Fe{constructor(){super(...arguments),this.value="",this.size=128,this.fill="black",this.background="white",this.radius=0,this.errorCorrection="H",this.label="",this.image="",this.imageSize=.25,this.imagePadding=4,this.imageRadius=4,this.fillGradient="",this._loadedImage=null,this._imageLoadPromise=null}static get styles(){return[Ak]}updated(e){if(super.updated(e),e.has("image")&&(this._loadedImage=null,this._imageLoadPromise=null,this.image))return void this.loadImage(this.image);const t=["value","size","fill","background","radius","errorCorrection","imageSize","imagePadding","imageRadius","fillGradient"].some((t=>e.has(t)));t&&this.drawQrCode()}render(){const e=this.label||this.value||"QR Code";return _`
|
|
19919
19963
|
<canvas
|
|
19920
19964
|
part="base"
|
|
19921
19965
|
role="img"
|
|
@@ -19923,7 +19967,7 @@ a {
|
|
|
19923
19967
|
width=${this.size}
|
|
19924
19968
|
height=${this.size}
|
|
19925
19969
|
></canvas>
|
|
19926
|
-
`}download(e="qr-code.png"){if(!this.canvas)return;const t=document.createElement("a");t.download=e,t.href=this.canvas.toDataURL("image/png"),t.click()}toDataURL(e="image/png"){return this.canvas?this.canvas.toDataURL(e):""}loadImage(e){const t=new Image;t.crossOrigin="anonymous",this._imageLoadPromise=new Promise((i=>{t.onload=()=>{this._loadedImage=t,this._imageLoadPromise=null,this.drawQrCode(),i()},t.onerror=()=>{this._loadedImage=null,this._imageLoadPromise=null,this.emit("nile-qr-image-error",{src:e}),this.drawQrCode(),i()}})),t.src=e}drawQrCode(){if(!this.canvas)return;const e=this.canvas.getContext("2d");if(!e)return;const{size:t,fill:i,background:n,radius:o,errorCorrection:M,value:r}=this,s=Math.max(0,Math.min(.5,o)),a=
|
|
19970
|
+
`}download(e="qr-code.png"){if(!this.canvas)return;const t=document.createElement("a");t.download=e,t.href=this.canvas.toDataURL("image/png"),t.click()}toDataURL(e="image/png"){return this.canvas?this.canvas.toDataURL(e):""}loadImage(e){const t=new Image;t.crossOrigin="anonymous",this._imageLoadPromise=new Promise((i=>{t.onload=()=>{this._loadedImage=t,this._imageLoadPromise=null,this.drawQrCode(),i()},t.onerror=()=>{this._loadedImage=null,this._imageLoadPromise=null,this.emit("nile-qr-image-error",{src:e}),this.drawQrCode(),i()}})),t.src=e}drawQrCode(){if(!this.canvas)return;const e=this.canvas.getContext("2d");if(!e)return;const{size:t,fill:i,background:n,radius:o,errorCorrection:M,value:r}=this,s=Math.max(0,Math.min(.5,o)),a=Hk(r,M),l=a.length,g=t/l;e.clearRect(0,0,t,t),n&&"transparent"!==n&&(e.fillStyle=n,e.fillRect(0,0,t,t));const N=Math.max(.1,Math.min(.4,this.imageSize)),c=this._loadedImage?t*N:0,u=c+(this._loadedImage?2*this.imagePadding:0),D=(t-u)/2,d=D+u,h=this.resolveModuleFill(e,t);e.fillStyle=h;for(let t=0;t<l;t++)for(let i=0;i<l;i++){if(1!==a[t][i])continue;const n=i*g,o=t*g;if(this._loadedImage){if(n>=D&&n+g<=d&&o>=D&&o+g<=d)continue}s>0?this.drawRoundedModule(e,n,o,g,g,s*g):e.fillRect(n,o,g,g)}this._loadedImage&&this.drawCenterImage(e,t,c)}resolveModuleFill(e,t){if(!this.fillGradient)return this.fill;const i=this.fillGradient.split(",").map((e=>e.trim()));if(i.length<3)return this.fill;const n=parseFloat(i[0]);if(Number.isNaN(n))return this.fill;const o=n*Math.PI/180,M=t/2,r=t/2,s=t/2,a=M-Math.cos(o)*s,l=r-Math.sin(o)*s,g=M+Math.cos(o)*s,N=r+Math.sin(o)*s,c=e.createLinearGradient(a,l,g,N),u=i.slice(1);for(let e=0;e<u.length;e++)c.addColorStop(e/(u.length-1),u[e]);return c}drawCenterImage(e,t,i){if(!this._loadedImage)return;const n=(t-i)/2,o=(t-i)/2,M=Math.min(this.imageRadius,i/2),r=this.imagePadding;if(r>0&&this.background&&"transparent"!==this.background){e.fillStyle=this.background;const t=n-r,s=o-r,a=i+2*r,l=i+2*r,g=M+.5*r;this.drawRoundedRect(e,t,s,a,l,g),e.fill()}e.save(),this.clipRoundedRect(e,n,o,i,i,M),e.drawImage(this._loadedImage,n,o,i,i),e.restore()}drawRoundedModule(e,t,i,n,o,M){e.beginPath(),e.moveTo(t+M,i),e.lineTo(t+n-M,i),e.arcTo(t+n,i,t+n,i+M,M),e.lineTo(t+n,i+o-M),e.arcTo(t+n,i+o,t+n-M,i+o,M),e.lineTo(t+M,i+o),e.arcTo(t,i+o,t,i+o-M,M),e.lineTo(t,i+M),e.arcTo(t,i,t+M,i,M),e.closePath(),e.fill()}drawRoundedRect(e,t,i,n,o,M){e.beginPath(),e.moveTo(t+M,i),e.lineTo(t+n-M,i),e.arcTo(t+n,i,t+n,i+M,M),e.lineTo(t+n,i+o-M),e.arcTo(t+n,i+o,t+n-M,i+o,M),e.lineTo(t+M,i+o),e.arcTo(t,i+o,t,i+o-M,M),e.lineTo(t,i+M),e.arcTo(t,i,t+M,i,M),e.closePath()}clipRoundedRect(e,t,i,n,o,M){e.beginPath(),e.moveTo(t+M,i),e.lineTo(t+n-M,i),e.arcTo(t+n,i,t+n,i+M,M),e.lineTo(t+n,i+o-M),e.arcTo(t+n,i+o,t+n-M,i+o,M),e.lineTo(t+M,i+o),e.arcTo(t,i+o,t,i+o-M,M),e.lineTo(t,i+M),e.arcTo(t,i,t+M,i,M),e.closePath(),e.clip()}};e([ue({type:String,reflect:!0})],$k.prototype,"value",void 0),e([ue({type:Number,reflect:!0})],$k.prototype,"size",void 0),e([ue({type:String,reflect:!0})],$k.prototype,"fill",void 0),e([ue({type:String,reflect:!0})],$k.prototype,"background",void 0),e([ue({type:Number,reflect:!0})],$k.prototype,"radius",void 0),e([ue({attribute:"error-correction",reflect:!0})],$k.prototype,"errorCorrection",void 0),e([ue({type:String,reflect:!0})],$k.prototype,"label",void 0),e([ue({type:String,reflect:!0})],$k.prototype,"image",void 0),e([ue({attribute:"image-size",type:Number,reflect:!0})],$k.prototype,"imageSize",void 0),e([ue({attribute:"image-padding",type:Number,reflect:!0})],$k.prototype,"imagePadding",void 0),e([ue({attribute:"image-radius",type:Number,reflect:!0})],$k.prototype,"imageRadius",void 0),e([ue({attribute:"fill-gradient",type:String,reflect:!0})],$k.prototype,"fillGradient",void 0),e([he("canvas")],$k.prototype,"canvas",void 0),$k=e([ge("nile-qr-code")],$k);const Jk=r`
|
|
19927
19971
|
|
|
19928
19972
|
[hidden] {
|
|
19929
19973
|
display: none;
|
|
@@ -20112,7 +20156,7 @@ a {
|
|
|
20112
20156
|
}
|
|
20113
20157
|
|
|
20114
20158
|
|
|
20115
|
-
`;let
|
|
20159
|
+
`;let Xk=0,qk=class extends Fe{constructor(){super(...arguments),this.attrId=++Xk,this.componentId=`nile-nav-tab-${this.attrId}`,this.panel="",this.active=!1,this.closable=!1,this.disabled=!1,this.centered=!1}connectedCallback(){super.connectedCallback(),this.setAttribute("role","tab"),this.syncA11yState()}firstUpdated(){this.syncA11yState(),this.updateAccessibleName()}updated(){this.syncA11yState(),this.updateAccessibleName()}syncA11yState(){this.id=this.id||this.componentId,this.tabIndex=this.disabled?-1:this.active?0:-1,this.setAttribute("aria-selected",this.active?"true":"false"),this.setAttribute("aria-disabled",this.disabled?"true":"false"),this.disabled?this.setAttribute("aria-hidden","true"):this.removeAttribute("aria-hidden")}updateAccessibleName(){if(this.hasAttribute("aria-label")&&"true"!==this.getAttribute("data-auto-aria-label"))return;const e=(this.textContent||"").replace(/\s+/g," ").trim();e?(this.setAttribute("aria-label",e),this.setAttribute("data-auto-aria-label","true")):(this.removeAttribute("aria-label"),this.removeAttribute("data-auto-aria-label"))}handleCloseClick(e){e.preventDefault(),e.stopPropagation(),this.emit("nile-close")}handleTabClick(e){if(this.disabled)return e.preventDefault(),void e.stopPropagation();Object.values(ut).some((t=>e[t]))||0!==e.button||e.preventDefault()}handleActiveChange(){this.syncA11yState()}handleDisabledChange(){this.syncA11yState()}focus(e){super.focus(e)}blur(){super.blur()}render(){return this.id=this.id||this.componentId,_`
|
|
20116
20160
|
<li part="base tab" class="nav-tab-container" role="presentation">
|
|
20117
20161
|
<nile-link
|
|
20118
20162
|
class=${xe({"nav-tab":!0,"tab--centered":this.centered,"nav-tab--active":this.active,"nav-tab--closable":this.closable,"nav-tab--disabled":this.disabled})}
|
|
@@ -20147,13 +20191,13 @@ a {
|
|
|
20147
20191
|
`:B}
|
|
20148
20192
|
</nile-link>
|
|
20149
20193
|
</li>
|
|
20150
|
-
`}};
|
|
20194
|
+
`}};qk.styles=Jk,e([he(".nav-tab")],qk.prototype,"navTab",void 0),e([ue({reflect:!0})],qk.prototype,"panel",void 0),e([ue({type:Boolean,reflect:!0})],qk.prototype,"active",void 0),e([ue({type:Boolean})],qk.prototype,"closable",void 0),e([ue({type:Boolean,reflect:!0})],qk.prototype,"disabled",void 0),e([ue({type:Boolean,reflect:!0})],qk.prototype,"centered",void 0),e([ue({type:String,reflect:!0})],qk.prototype,"link",void 0),e([We("active")],qk.prototype,"handleActiveChange",null),e([We("disabled")],qk.prototype,"handleDisabledChange",null),qk=e([ge("nile-nav-tab")],qk);
|
|
20151
20195
|
/**
|
|
20152
20196
|
* @license
|
|
20153
20197
|
* Copyright 2018 Google LLC
|
|
20154
20198
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
20155
20199
|
*/
|
|
20156
|
-
const
|
|
20200
|
+
const Kk="important",ev=" !"+Kk,tv=Ae(class extends Oe{constructor(e){if(super(e),e.type!==ze||"style"!==e.name||e.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(e){return Object.keys(e).reduce(((t,i)=>{const n=e[i];return null==n?t:t+`${i=i.includes("-")?i:i.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`}),"")}update(e,[t]){const{style:i}=e.element;if(void 0===this.ft)return this.ft=new Set(Object.keys(t)),this.render(t);for(const e of this.ft)null==t[e]&&(this.ft.delete(e),e.includes("-")?i.removeProperty(e):i[e]=null);for(const e in t){const n=t[e];if(null!=n){this.ft.add(e);const t="string"==typeof n&&n.endsWith(ev);e.includes("-")||t?i.setProperty(e,t?n.slice(0,-11):n,t?Kk:""):i[e]=n}}return R}}),iv=r`
|
|
20157
20201
|
|
|
20158
20202
|
[hidden] {
|
|
20159
20203
|
display: none;
|
|
@@ -20820,11 +20864,11 @@ const qk="important",Kk=" !"+qk,ev=Ae(class extends Oe{constructor(e){if(super(e
|
|
|
20820
20864
|
:host([placement='bottom']:not([variant])) {
|
|
20821
20865
|
--nile-nav-tab-padding: var(--nile-spacing-lg, var(--ng-spacing-3)) var(--nile-spacing-none, var(--ng-spacing-none)) var(--nile-spacing-none, var(--ng-spacing-none)) var(--nile-spacing-none, var(--ng-spacing-none));
|
|
20822
20866
|
}
|
|
20823
|
-
`;let
|
|
20867
|
+
`;let nv=class extends Fe{constructor(){super(...arguments),this.pillRepositionTimer=null,this.pillTransitionClassTimer=null,this.pillReady=!1,this.observedTabs=new Set,this.tabs=[],this.panels=[],this.handleCloseEvent=e=>{if(e.target===this)return;const t=e.target,i=t?.getAttribute("panel");i&&(e.stopImmediatePropagation(),e.stopPropagation(),this.syncIndicator(),this.emit("nile-close",{panel:i}))},this.tabGroupWasIntersecting=!1,this.lastNavClientWidth=0,this.hasScrollControls=!1,this.placement="top",this.activeTabProp="",this.noTrack=!1,this.noScrollControls=!1,this.centered=!1,this.variant="underline",this.indicatorPlacement="",this.fullWidth=!1,this.width="",this.showIndicatorOnHover=!1,this.activeTabName=""}get showScrollControlButtons(){return!this.noScrollControls&&this.hasScrollControls}connectedCallback(){super.connectedCallback(),this.resizeObserver=new ResizeObserver((()=>{this.setScrollControls();const e=this.nav?.clientWidth??0,t=0===this.lastNavClientWidth&&e>0;this.lastNavClientWidth=e,this.repositionIndicator({skipTransition:t}),this.debouncedPositionPill()})),this.mutationObserver=new MutationObserver((e=>{if(e.some((e=>!["aria-labelledby","aria-controls"].includes(e.attributeName)))&&setTimeout((()=>this.setAriaLabels())),e.some((e=>"disabled"===e.attributeName))&&this.syncTabsAndPanels(),e.some((e=>"active"===e.attributeName))){const e=this.getAllTabs({includeDisabled:!1}).find((e=>e.active));e&&e.panel!==this.activeTabName&&(this.activeTabName=e.panel)}e.some((e=>"childList"===e.type||"characterData"===e.type))&&(this.repositionIndicator(),this.debouncedPositionPill(),requestAnimationFrame((()=>this.setScrollControls())))})),this.updateComplete.then((async()=>{if(this.setScrollControls(),await Promise.all(this.getAllTabs({includeDisabled:!0}).map((e=>e.updateComplete))),await Promise.all(this.getAllPanels().map((e=>e.updateComplete))),this.syncTabsAndPanels(),this.activeTabProp)this.activeTabName=this.activeTabProp;else{const e=this.getActiveTab();this.activeTabName=e?e.panel:""}requestAnimationFrame((()=>{this.indicator&&(this.indicator.style.transition="none"),this.syncIndicator(),this.positionPill(),requestAnimationFrame((()=>{this.indicator&&(this.indicator.style.transition="")}))})),this.mutationObserver.observe(this,{attributes:!0,childList:!0,subtree:!0,characterData:!0}),this.resizeObserver.observe(this.nav),this.visibilityObserver=new IntersectionObserver((e=>{const t=e[0];if(t.isIntersecting&&t.intersectionRatio>0){this.setAriaLabels(),this.debouncedPositionPill();const e=!this.tabGroupWasIntersecting;this.tabGroupWasIntersecting=!0,this.repositionIndicator({skipTransition:e})}else this.tabGroupWasIntersecting=!1})),this.visibilityObserver.observe(this.tabGroup)})),this.addEventListener("nile-close",this.handleCloseEvent),this.addEventListener("click",this.handleNavClick),this.addEventListener("keydown",this.handleKeyDown)}disconnectedCallback(){this.mutationObserver.disconnect(),this.resizeObserver.disconnect(),this.observedTabs.clear(),this.visibilityObserver?.disconnect(),this.removeEventListener("nile-close",this.handleCloseEvent),this.removeEventListener("click",this.handleNavClick),this.removeEventListener("keydown",this.handleKeyDown)}updated(e){let t=e.has("activeTabName");if(e.has("activeTabProp")&&this.activeTabName!==this.activeTabProp&&(this.activeTabName=this.activeTabProp,t=!0),t){const e=this.getActiveTab();e&&this.setActiveTab(e,{scrollBehavior:"smooth"})}e.has("noScrollControls")&&requestAnimationFrame((()=>this.setScrollControls()))}syncIndicator(){if(requestAnimationFrame((()=>this.setScrollControls())),!this.indicator)return;const e=this.getActiveTab();e&&!e.disabled?(this.indicator.style.display="block",this.repositionIndicator()):this.indicator.style.display="none"}handleNavClick(e){const t=e.composedPath().find((e=>e instanceof HTMLElement&&"nile-nav-tab"===e.tagName.toLowerCase()));if(!t)return;if(!this.getAllTabs({includeDisabled:!0}).includes(t))return;if(t.hasAttribute("disabled")||t.disabled)return;Object.values(ut).some((t=>e[t]))||0!==e.button||(this.activeTabProp=t.panel,this.activeTabName=t.panel,t.focus())}positionPill(e=!1){const t=this.shadowRoot?.querySelector(".nav-tab-group__pill");if(!t)return;this.pillTransitionClassTimer&&(clearTimeout(this.pillTransitionClassTimer),this.pillTransitionClassTimer=null);const i=this.getActiveTab();if(!i||i.disabled)return t.classList.add("nav-tab-group__pill--inactive"),void t.classList.remove("nav-tab-group__pill--transitioning");t.classList.remove("nav-tab-group__pill--inactive");const n=i.shadowRoot?.querySelector(".nav-tab-container");if(!n)return;const o=this.shadowRoot?.querySelector(".nav-tab-group__tabs");if(!o)return;if(0===n.offsetWidth||0===n.offsetHeight)return;const M=this.getLayoutBoxRelativeToContainer(n,o);if(!M)return;const r=M.x,s=M.y,a=M.width,l=M.height,g=o.clientWidth,N=Math.max(0,g-r-a);if(e){const e="cubic-bezier(0.4, 0, 0.2, 1)";t.style.transition=`left 400ms ${e}, right 400ms ${e}, top 400ms ${e}, height 400ms ${e}`,"toggle"===this.variant&&t.classList.add("nav-tab-group__pill--transitioning")}else t.style.transition="","toggle"===this.variant&&t.classList.remove("nav-tab-group__pill--transitioning");if(t.style.transform="",t.style.left=`${r}px`,t.style.right=`${N}px`,t.style.width="auto",t.style.top=`${s}px`,t.style.height=`${l}px`,t.style.opacity="1",this.pillReady||(this.pillReady=!0),e){const e=()=>{t.style.transition="",t.removeEventListener("transitionend",e)};t.addEventListener("transitionend",e),"toggle"===this.variant&&(this.pillTransitionClassTimer=setTimeout((()=>{this.pillTransitionClassTimer=null,t.classList.remove("nav-tab-group__pill--transitioning")}),420))}}debouncedPositionPill(){this.pillRepositionTimer&&clearTimeout(this.pillRepositionTimer),this.pillRepositionTimer=setTimeout((()=>{this.pillRepositionTimer=null,this.positionPill()}),150)}handleTabHover(e){if(!this.showIndicatorOnHover)return;const t=e.composedPath().find((e=>e instanceof HTMLElement&&"nile-nav-tab"===e.tagName.toLowerCase()));if(!t||t.disabled||t.hasAttribute("disabled"))return;this.getAllTabs({includeDisabled:!0}).includes(t)&&this.positionHoverIndicator(t)}handleTabHoverLeave(){this.showIndicatorOnHover&&this.hoverIndicator&&(this.hoverIndicator.style.opacity="0")}positionHoverIndicator(e){if(!this.hoverIndicator)return;const t=this.shadowRoot?.querySelector(".nav-tab-group__tabs");if(!t)return;const i=e.shadowRoot?.querySelector(".nav-tab-container");if(!i)return;const n=this.getLayoutBoxRelativeToContainer(i,t);if(n){switch(this.hoverIndicator.style.transition="none",this.placement){case"top":case"bottom":this.hoverIndicator.style.width=`${i.offsetWidth}px`,this.hoverIndicator.style.height="auto",this.hoverIndicator.style.translate=`${n.x}px 0px`;break;case"start":case"end":this.hoverIndicator.style.height=`${i.offsetHeight}px`,this.hoverIndicator.style.width="auto",this.hoverIndicator.style.translate=`0px ${n.y}px`}this.hoverIndicator.style.opacity="1"}}render(){const e="filled"===this.variant||"neutral-filled"===this.variant||"toggle"===this.variant||"toggle-button"===this.variant,t="filled"!==this.variant&&"neutral-filled"!==this.variant&&"toggle-button"!==this.variant&&"toggle"!==this.variant,i="toggle"===this.variant;return _`
|
|
20824
20868
|
<div
|
|
20825
20869
|
part="base"
|
|
20826
20870
|
class=${xe({"nav-tab-group":!0,"nav-tab-group--top":"top"===this.placement,"nav-tab-group--bottom":"bottom"===this.placement,"nav-tab-group--start":"start"===this.placement,"nav-tab-group--end":"end"===this.placement,"nav-tab-group--rtl":!0,"nav-tab-group--has-scroll-controls":this.showScrollControlButtons,hide__track:this.noTrack})}
|
|
20827
|
-
style=${
|
|
20871
|
+
style=${tv(this.width?{"--nav-tab-item-width":this.width}:{})}
|
|
20828
20872
|
>
|
|
20829
20873
|
<nav class="nav-tab-group__nav-container" part="nav">
|
|
20830
20874
|
${i?_`<div class="nav-tab-group__toggle-frame" part="toggle-frame"></div>`:B}
|
|
@@ -20880,7 +20924,7 @@ const qk="important",Kk=" !"+qk,ev=Ae(class extends Oe{constructor(e){if(super(e
|
|
|
20880
20924
|
|
|
20881
20925
|
<slot part="body" class="nav-tab-group__body" @slotchange=${this.syncTabsAndPanels}></slot>
|
|
20882
20926
|
</div>
|
|
20883
|
-
`}getAllTabs(e={includeDisabled:!0}){const t=this.shadowRoot.querySelector('slot[name="nav"]').assignedElements().filter((e=>"nile-nav-tab"===e.tagName.toLowerCase()));return e.includeDisabled?t:t.filter((e=>!e.disabled))}getAllPanels(){return[...this.body.assignedElements()].filter((e=>"nile-nav-tab-panel"===e.tagName.toLowerCase()))}getActiveTab(){return this.tabs.find((e=>this.activeTabName?e.panel===this.activeTabName:e.active))??this.tabs.find((e=>!e.disabled))??this.tabs[0]}setScrollControls(){this.nav&&(this.noScrollControls?this.hasScrollControls=!1:this.hasScrollControls=["top","bottom"].includes(this.placement)&&this.nav.scrollWidth>this.nav.clientWidth)}handleKeyDown(e){const t=e.composedPath().find((e=>e instanceof HTMLElement&&"nile-nav-tab"===e.tagName.toLowerCase()));if(t?.disabled)return void e.preventDefault();if(!t||!this.tabs.includes(t))return;if("Enter"===e.key||" "===e.key)return e.preventDefault(),this.activeTabProp=t.panel,void(this.activeTabName=t.panel);if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key))return;let i=this.tabs.indexOf(t);const n=["top","bottom"].includes(this.placement),o="rtl"===getComputedStyle(this).direction;"Home"===e.key?i=0:"End"===e.key?i=this.tabs.length-1:n&&(o&&"ArrowRight"===e.key||!o&&"ArrowLeft"===e.key)||["start","end"].includes(this.placement)&&"ArrowUp"===e.key?i--:(n&&(o&&"ArrowLeft"===e.key||!o&&"ArrowRight"===e.key)||["start","end"].includes(this.placement)&&"ArrowDown"===e.key)&&i++,i<0&&(i=this.tabs.length-1),i>this.tabs.length-1&&(i=0),this.tabs[i].focus({preventScroll:!0}),n&&Ht(this.tabs[i],this.nav,"horizontal"),e.preventDefault()}handleScrollToStart(){this.nav.scroll({left:-this.nav.scrollWidth,behavior:"smooth"})}handleScrollToEnd(){this.nav.scroll({left:this.nav.scrollWidth,behavior:"smooth"})}setActiveTab(e,t){if(t={emitEvents:!0,scrollBehavior:"auto",...t},e!==this.activeTab&&!e.disabled){const i=this.activeTab;this.activeTab=e,this.activeTabProp!==this.activeTab.panel&&(this.activeTabProp=this.activeTab.panel),this.tabs.forEach((e=>e.active=e===this.activeTab)),this.panels.forEach((e=>e.active=e.name===this.activeTab?.panel)),this.syncIndicator(),this.positionPill(this.pillReady),["top","bottom"].includes(this.placement)&&Ht(this.activeTab,this.nav,"horizontal",t.scrollBehavior),t.emitEvents&&this.emit("nile-tab-change",{value:this.activeTab.panel,previousValue:i?.panel??null,index:this.tabs.indexOf(this.activeTab),previousIndex:i?this.tabs.indexOf(i):-1,link:this.activeTab.link})}}setAriaLabels(){const e=this.getAllTabs({includeDisabled:!0});for(const t of e){const e=this.panels.find((e=>e.name===t.panel));if(t.disabled){t.removeAttribute("aria-controls"),e&&e.removeAttribute("aria-labelledby");continue}if(!e)continue;const i=e.getAttribute("id"),n=t.getAttribute("id");i&&n&&(t.setAttribute("aria-controls",i),e.setAttribute("aria-labelledby",n))}}getRelativeOffsetToAncestor(e,t){let i=0,n=0,o=e;for(;o&&o!==t;)i+=o.offsetLeft,n+=o.offsetTop,o=o.offsetParent;return o===t?{x:i,y:n}:null}getLayoutBoxRelativeToContainer(e,t){const i=t.getBoundingClientRect(),n=e.getBoundingClientRect();if(0===n.width||0===n.height)return null;const o=t.offsetWidth>0?i.width/t.offsetWidth:1,M=t.offsetHeight>0?i.height/t.offsetHeight:1;if(o>0&&M>0&&Number.isFinite(o)&&Number.isFinite(M)){if(Math.abs(o-1)<.001&&Math.abs(M-1)<.001){const i=this.getRelativeOffsetToAncestor(e,t);if(i)return{x:i.x,y:i.y,width:e.offsetWidth,height:e.offsetHeight}}const r=(n.left-i.left)/o,s=(n.top-i.top)/M;let a=n.width/o,l=n.height/M;const g=e.offsetWidth,N=e.offsetHeight;return g>0&&(a=Math.min(a,g)),N>0&&(l=Math.min(l,N)),{x:r,y:s,width:a,height:l}}const r=this.getRelativeOffsetToAncestor(e,t);return r?{x:r.x,y:r.y,width:e.offsetWidth,height:e.offsetHeight}:null}repositionIndicator(e){const t=this.getActiveTab();if(!t||!this.indicator)return;const i=this.shadowRoot?.querySelector(".nav-tab-group__tabs");if(!i)return;const n=t.shadowRoot?.querySelector(".nav-tab-container");if(!n)return;const o=!0===e?.skipTransition;o&&(this.indicator.style.transition="none");const M=this.getLayoutBoxRelativeToContainer(n,i);if(!M)return void(o&&requestAnimationFrame((()=>{this.indicator&&(this.indicator.style.transition="")})));const r=M.x,s=M.y;switch(this.placement){case"top":case"bottom":this.indicator.style.width=`${M.width}px`,this.indicator.style.height="auto",this.indicator.style.translate=`${r}px 0px`;break;case"start":case"end":this.indicator.style.width="auto",this.indicator.style.height=`${M.height}px`,this.indicator.style.translate=`0px ${s}px`}o&&requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.indicator&&(this.indicator.style.transition="")}))}))}syncTabsAndPanels(){this.tabs=this.getAllTabs({includeDisabled:!1}),this.panels=this.getAllPanels();const e=this.getAllTabs({includeDisabled:!0}),t=this.getAllTabs({includeDisabled:!1}),i=t.length,n=new Set(e);for(const e of this.observedTabs)n.has(e)||(this.resizeObserver.unobserve(e),this.observedTabs.delete(e));e.forEach((e=>{if(e.centered=this.centered,e.disabled)e.removeAttribute("aria-posinset"),e.removeAttribute("aria-setsize");else{const n=t.indexOf(e);e.setAttribute("aria-posinset",String(n+1)),e.setAttribute("aria-setsize",String(i))}this.observedTabs.has(e)||(this.resizeObserver.observe(e),this.observedTabs.add(e))})),this.setScrollControls(),this.setAriaLabels()}};
|
|
20927
|
+
`}getAllTabs(e={includeDisabled:!0}){const t=this.shadowRoot.querySelector('slot[name="nav"]').assignedElements().filter((e=>"nile-nav-tab"===e.tagName.toLowerCase()));return e.includeDisabled?t:t.filter((e=>!e.disabled))}getAllPanels(){return[...this.body.assignedElements()].filter((e=>"nile-nav-tab-panel"===e.tagName.toLowerCase()))}getActiveTab(){return this.tabs.find((e=>this.activeTabName?e.panel===this.activeTabName:e.active))??this.tabs.find((e=>!e.disabled))??this.tabs[0]}setScrollControls(){this.nav&&(this.noScrollControls?this.hasScrollControls=!1:this.hasScrollControls=["top","bottom"].includes(this.placement)&&this.nav.scrollWidth>this.nav.clientWidth)}handleKeyDown(e){const t=e.composedPath().find((e=>e instanceof HTMLElement&&"nile-nav-tab"===e.tagName.toLowerCase()));if(t?.disabled)return void e.preventDefault();if(!t||!this.tabs.includes(t))return;if("Enter"===e.key||" "===e.key)return e.preventDefault(),this.activeTabProp=t.panel,void(this.activeTabName=t.panel);if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"].includes(e.key))return;let i=this.tabs.indexOf(t);const n=["top","bottom"].includes(this.placement),o="rtl"===getComputedStyle(this).direction;"Home"===e.key?i=0:"End"===e.key?i=this.tabs.length-1:n&&(o&&"ArrowRight"===e.key||!o&&"ArrowLeft"===e.key)||["start","end"].includes(this.placement)&&"ArrowUp"===e.key?i--:(n&&(o&&"ArrowLeft"===e.key||!o&&"ArrowRight"===e.key)||["start","end"].includes(this.placement)&&"ArrowDown"===e.key)&&i++,i<0&&(i=this.tabs.length-1),i>this.tabs.length-1&&(i=0),this.tabs[i].focus({preventScroll:!0}),n&&Ht(this.tabs[i],this.nav,"horizontal"),e.preventDefault()}handleScrollToStart(){this.nav.scroll({left:-this.nav.scrollWidth,behavior:"smooth"})}handleScrollToEnd(){this.nav.scroll({left:this.nav.scrollWidth,behavior:"smooth"})}setActiveTab(e,t){if(t={emitEvents:!0,scrollBehavior:"auto",...t},e!==this.activeTab&&!e.disabled){const i=this.activeTab;this.activeTab=e,this.activeTabProp!==this.activeTab.panel&&(this.activeTabProp=this.activeTab.panel),this.tabs.forEach((e=>e.active=e===this.activeTab)),this.panels.forEach((e=>e.active=e.name===this.activeTab?.panel)),this.syncIndicator(),this.positionPill(this.pillReady),["top","bottom"].includes(this.placement)&&Ht(this.activeTab,this.nav,"horizontal",t.scrollBehavior),t.emitEvents&&this.emit("nile-tab-change",{value:this.activeTab.panel,previousValue:i?.panel??null,index:this.tabs.indexOf(this.activeTab),previousIndex:i?this.tabs.indexOf(i):-1,link:this.activeTab.link})}}setAriaLabels(){const e=this.getAllTabs({includeDisabled:!0});for(const t of e){const e=this.panels.find((e=>e.name===t.panel));if(t.disabled){t.removeAttribute("aria-controls"),e&&e.removeAttribute("aria-labelledby");continue}if(!e)continue;const i=e.getAttribute("id"),n=t.getAttribute("id");i&&n&&(t.setAttribute("aria-controls",i),e.setAttribute("aria-labelledby",n))}}getRelativeOffsetToAncestor(e,t){let i=0,n=0,o=e;for(;o&&o!==t;)i+=o.offsetLeft,n+=o.offsetTop,o=o.offsetParent;return o===t?{x:i,y:n}:null}getLayoutBoxRelativeToContainer(e,t){const i=t.getBoundingClientRect(),n=e.getBoundingClientRect();if(0===n.width||0===n.height)return null;const o=t.offsetWidth>0?i.width/t.offsetWidth:1,M=t.offsetHeight>0?i.height/t.offsetHeight:1;if(o>0&&M>0&&Number.isFinite(o)&&Number.isFinite(M)){if(Math.abs(o-1)<.001&&Math.abs(M-1)<.001){const i=this.getRelativeOffsetToAncestor(e,t);if(i)return{x:i.x,y:i.y,width:e.offsetWidth,height:e.offsetHeight}}const r=(n.left-i.left)/o,s=(n.top-i.top)/M;let a=n.width/o,l=n.height/M;const g=e.offsetWidth,N=e.offsetHeight;return g>0&&(a=Math.min(a,g)),N>0&&(l=Math.min(l,N)),{x:r,y:s,width:a,height:l}}const r=this.getRelativeOffsetToAncestor(e,t);return r?{x:r.x,y:r.y,width:e.offsetWidth,height:e.offsetHeight}:null}repositionIndicator(e){const t=this.getActiveTab();if(!t||!this.indicator)return;const i=this.shadowRoot?.querySelector(".nav-tab-group__tabs");if(!i)return;const n=t.shadowRoot?.querySelector(".nav-tab-container");if(!n)return;const o=!0===e?.skipTransition;o&&(this.indicator.style.transition="none");const M=this.getLayoutBoxRelativeToContainer(n,i);if(!M)return void(o&&requestAnimationFrame((()=>{this.indicator&&(this.indicator.style.transition="")})));const r=M.x,s=M.y;switch(this.placement){case"top":case"bottom":this.indicator.style.width=`${M.width}px`,this.indicator.style.height="auto",this.indicator.style.translate=`${r}px 0px`;break;case"start":case"end":this.indicator.style.width="auto",this.indicator.style.height=`${M.height}px`,this.indicator.style.translate=`0px ${s}px`}o&&requestAnimationFrame((()=>{requestAnimationFrame((()=>{this.indicator&&(this.indicator.style.transition="")}))}))}syncTabsAndPanels(){this.tabs=this.getAllTabs({includeDisabled:!1}),this.panels=this.getAllPanels();const e=this.getAllTabs({includeDisabled:!0}),t=this.getAllTabs({includeDisabled:!1}),i=t.length,n=new Set(e);for(const e of this.observedTabs)n.has(e)||(this.resizeObserver.unobserve(e),this.observedTabs.delete(e));e.forEach((e=>{if(e.centered=this.centered,e.disabled)e.removeAttribute("aria-posinset"),e.removeAttribute("aria-setsize");else{const n=t.indexOf(e);e.setAttribute("aria-posinset",String(n+1)),e.setAttribute("aria-setsize",String(i))}this.observedTabs.has(e)||(this.resizeObserver.observe(e),this.observedTabs.add(e))})),this.setScrollControls(),this.setAriaLabels()}};nv.styles=iv,e([he(".nav-tab-group")],nv.prototype,"tabGroup",void 0),e([he(".nav-tab-group__body")],nv.prototype,"body",void 0),e([he(".nav-tab-group__nav")],nv.prototype,"nav",void 0),e([he(".nav-tab-group__indicator")],nv.prototype,"indicator",void 0),e([he(".nav-tab-group__hover-indicator")],nv.prototype,"hoverIndicator",void 0),e([ue({type:Boolean,reflect:!0,attribute:!0})],nv.prototype,"hasScrollControls",void 0),e([ue()],nv.prototype,"placement",void 0),e([ue({reflect:!0,attribute:"value",type:String})],nv.prototype,"activeTabProp",void 0),e([ue({type:Boolean,reflect:!0,attribute:"no-track"})],nv.prototype,"noTrack",void 0),e([ue({attribute:"no-scroll-controls",type:Boolean})],nv.prototype,"noScrollControls",void 0),e([ue({type:Boolean,reflect:!0})],nv.prototype,"centered",void 0),e([ue({type:String,reflect:!0})],nv.prototype,"variant",void 0),e([ue({type:String,reflect:!0})],nv.prototype,"indicatorPlacement",void 0),e([ue({type:Boolean,reflect:!0,attribute:!0})],nv.prototype,"fullWidth",void 0),e([ue({type:String,reflect:!0})],nv.prototype,"width",void 0),e([ue({type:Boolean,reflect:!0,attribute:!0})],nv.prototype,"showIndicatorOnHover",void 0),e([De()],nv.prototype,"activeTabName",void 0),e([We("placement",{waitUntilFirstUpdate:!0})],nv.prototype,"syncIndicator",null),nv=e([ge("nile-nav-tab-group")],nv);const ov=r`
|
|
20884
20928
|
[hidden] {
|
|
20885
20929
|
display: none;
|
|
20886
20930
|
}
|
|
@@ -20901,14 +20945,14 @@ const qk="important",Kk=" !"+qk,ev=Ae(class extends Oe{constructor(e){if(super(e
|
|
|
20901
20945
|
display: block;
|
|
20902
20946
|
padding: var(--padding);
|
|
20903
20947
|
}
|
|
20904
|
-
`;let
|
|
20948
|
+
`;let Mv=0,rv=class extends Fe{constructor(){super(...arguments),this.attrId=++Mv,this.componentId=`nile-nav-tab-panel-${this.attrId}`,this.name="",this.active=!1}connectedCallback(){super.connectedCallback(),this.id=this.id.length>0?this.id:this.componentId,this.setAttribute("role","tabpanel"),this.handleActiveChange()}handleActiveChange(){this.setAttribute("aria-hidden",this.active?"false":"true"),this.setAttribute("tabindex",this.active?"0":"-1")}render(){return _`
|
|
20905
20949
|
<div
|
|
20906
20950
|
part="base"
|
|
20907
20951
|
class=${xe({"nav-tab-panel":!0,"nav-tab-panel--active":this.active})}
|
|
20908
20952
|
>
|
|
20909
20953
|
<slot></slot>
|
|
20910
20954
|
</div>
|
|
20911
|
-
`}};
|
|
20955
|
+
`}};rv.styles=ov,e([ue({reflect:!0})],rv.prototype,"name",void 0),e([ue({type:Boolean,reflect:!0})],rv.prototype,"active",void 0),e([We("active")],rv.prototype,"handleActiveChange",null),rv=e([ge("nile-nav-tab-panel")],rv);const sv=r`
|
|
20912
20956
|
nile-floating-panel {
|
|
20913
20957
|
display: inline-block;
|
|
20914
20958
|
}
|
|
@@ -21060,7 +21104,7 @@ const qk="important",Kk=" !"+qk,ev=Ae(class extends Oe{constructor(e){if(super(e
|
|
|
21060
21104
|
border-color: transparent;
|
|
21061
21105
|
border-style: solid;
|
|
21062
21106
|
}
|
|
21063
|
-
`;var sv;!function(){if("undefined"==typeof document)return;const e="nile-floating-panel-styles";if(document.getElementById(e))return;const t=document.createElement("style");t.id=e,t.textContent=rv.cssText,document.head?.appendChild(t)}();let av=sv=class extends Fe{constructor(){super(...arguments),this.placement="bottom",this.trigger="click",this.distance=12,this.skidding=0,this.arrow="round",this.animation="fade",this.duration=200,this.delay=0,this.interactive=!0,this.interactiveBorder=2,this.maxWidth="none",this.zIndex=9999,this.followCursor=!1,this.hideOnClick=!0,this.inertia=!1,this.allowHTML=!1,this.flip=!0,this.for=null,this.open=!1,this.preventOverlayClose=!1,this.title="",this.disabled=!1,this.group=null,this.closeOnEscape=!0,this.panelClass="",this.enableVisibilityEffect=!1,this.enableTabClose=!1,this.tippyInstance=null,this.panelContainer=null,this.anchorEl=null,this._suppressOpenWatch=!1,this._panelId=`nile-fp-${Math.random().toString(36).slice(2,9)}`,this._boundEscHandler=this._handleEscapeKey.bind(this),this._pendingShowListener=null,this._pendingHideListener=null}static get prefersReducedMotion(){return sv._reducedMotionQuery||(sv._reducedMotionQuery=window.matchMedia("(prefers-reduced-motion: reduce)")),sv._reducedMotionQuery.matches}static get styles(){return[rv]}createRenderRoot(){return this}firstUpdated(){this._buildDOM(),this._attachTippy(),this._joinGroup(),this.visibilityManager=new mn({host:this,target:this.anchorEl||null,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:()=>this.open,onAnchorOutOfView:()=>{this._setOpen(!1),this.tippyInstance?.hide(),this.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view"})},onDocumentHidden:()=>{this._setOpen(!1),this.tippyInstance?.hide(),this.emit("nile-visibility-change",{visible:!1,reason:"document-hidden"})},emit:(e,t)=>this.emit(`nile-${e}`,t)}),this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),this._cleanupPendingShowListener(),this._cleanupPendingHideListener(),this.visibilityManager?.cleanup(),this._leaveGroup(),this._removeEscListener(),this._destroyTippy(),this.emit("nile-destroy")}updated(e){if(super.updated(e),!this.panelContainer)return;e.has("open")&&!this._suppressOpenWatch&&(this.open?(this.visibilityManager?.setup(),queueMicrotask((()=>this.tippyInstance?.show()))):(this.visibilityManager?.cleanup(),this.tippyInstance?.hide())),e.has("group")&&(this._leaveGroup(e.get("group")),this._joinGroup());["placement","trigger","distance","skidding","arrow","animation","duration","delay","interactive","interactiveBorder","maxWidth","zIndex","followCursor","hideOnClick","inertia","allowHTML","flip","preventOverlayClose","disabled","width","height","panelClass"].some((t=>e.has(t)))&&this._attachTippy()}show(){return this.open=!0,new Promise((e=>{this._cleanupPendingShowListener();const t=()=>{this._pendingShowListener=null,e()};this._pendingShowListener=t,this.addEventListener("nile-after-show",t,{once:!0})}))}hide(){return this.open=!1,new Promise((e=>{this._cleanupPendingHideListener();const t=()=>{this._pendingHideListener=null,e()};this._pendingHideListener=t,this.addEventListener("nile-after-hide",t,{once:!0})}))}_cleanupPendingShowListener(){this._pendingShowListener&&(this.removeEventListener("nile-after-show",this._pendingShowListener),this._pendingShowListener=null)}_cleanupPendingHideListener(){this._pendingHideListener&&(this.removeEventListener("nile-after-hide",this._pendingHideListener),this._pendingHideListener=null)}toggle(){this.open=!this.open}refresh(){this._attachTippy()}reposition(){this.tippyInstance?.popperInstance?.update()}getCurrentPlacement(){const e=this.tippyInstance?.popper,t=e?.querySelector(".tippy-box");return t?.dataset.placement??this.placement}isPositioningOptimal(){return this.getCurrentPlacement()===this.placement}_joinGroup(){if(!this.group)return;let e=sv._groups.get(this.group);e||(e=new Set,sv._groups.set(this.group,e)),e.add(this)}_leaveGroup(e){const t=e??this.group;if(!t)return;const i=sv._groups.get(t);i&&(i.delete(this),0===i.size&&sv._groups.delete(t))}_hideGroupSiblings(){if(!this.group)return;const e=sv._groups.get(this.group);e&&e.forEach((e=>{e!==this&&e.open&&(e._setOpen(!1),e.tippyInstance?.hide())}))}_addEscListener(){this.closeOnEscape&&document.addEventListener("keydown",this._boundEscHandler)}_removeEscListener(){document.removeEventListener("keydown",this._boundEscHandler)}_handleEscapeKey(e){"Escape"===e.key&&this.open&&(this._setOpen(!1),this.tippyInstance?.hide())}_applyAria(){this.anchorEl&&this.panelContainer&&(this.panelContainer.setAttribute("role","dialog"),this.panelContainer.id=this._panelId,this.anchorEl.setAttribute("aria-haspopup","dialog"),this._syncAriaExpanded())}_syncAriaExpanded(){this.anchorEl?.setAttribute("aria-expanded",String(this.open)),this.open?this.anchorEl?.setAttribute("aria-describedby",this._panelId):this.anchorEl?.removeAttribute("aria-describedby")}_buildDOM(){const e=Array.from(this.childNodes);this.anchorEl=null;const t=[],i=[],n=[];let o=!1;for(const M of e){if(M instanceof HTMLElement){const e=M.getAttribute("slot");if("title"===e){M.removeAttribute("slot"),t.push(M);continue}if("action"===e){M.removeAttribute("slot"),i.push(M);continue}if(!o&&!this.for){this.anchorEl=M,o=!0;continue}}n.push(M)}if(this.for){const e=document.getElementById(this.for);e&&(this.anchorEl=e)}for(;this.firstChild;)this.removeChild(this.firstChild);this.anchorEl&&!this.for&&this.appendChild(this.anchorEl),this.panelContainer=document.createElement("div"),this.panelContainer.className="nile-floating-panel__content",this.panelContainer.style.display="none";const M=document.createElement("div");if(M.className="nile-floating-panel__body",t.length>0||this.title){const e=document.createElement("div");e.className="nile-floating-panel__title",this.title?e.textContent=this.title:t.forEach((t=>e.appendChild(t))),M.appendChild(e)}if(n.length>0){const e=document.createElement("div");e.className="nile-floating-panel__main",n.forEach((t=>e.appendChild(t))),M.appendChild(e)}if(i.length>0){const e=document.createElement("div");e.className="nile-floating-panel__action",i.forEach((t=>e.appendChild(t))),M.appendChild(e)}this.panelContainer.appendChild(M),this.appendChild(this.panelContainer),this._applyAria()}_resolveArrow(){switch(this.arrow){case"round":return sb;case"none":return!1;default:return!0}}_setOpen(e){this._suppressOpenWatch=!0,this.open=e,this._syncAriaExpanded(),this._suppressOpenWatch=!1}_getEffectiveDuration(){return sv.prefersReducedMotion?0:uk(this.duration)}_getEffectiveAnimation(){return!sv.prefersReducedMotion&&this.animation}_attachTippy(){if(this._destroyTippy(),this.disabled||!this.anchorEl||!this.panelContainer)return;const e=ck(this.followCursor),t=!this.preventOverlayClose&&this.hideOnClick,i={content:this.panelContainer,placement:this.placement,trigger:this.trigger,offset:[this.skidding,this.distance],theme:"floating-panel",animation:this._getEffectiveAnimation(),interactive:this.interactive,arrow:this._resolveArrow(),duration:this._getEffectiveDuration(),allowHTML:this.allowHTML,delay:this.delay,maxWidth:this.maxWidth,zIndex:this.zIndex,hideOnClick:t,inertia:!sv.prefersReducedMotion&&this.inertia,interactiveBorder:this.interactiveBorder,appendTo:document.body,followCursor:e,plugins:e?[Nk]:[],popperOptions:{modifiers:[{name:"flip",enabled:this.flip}]},onMount:e=>{this.panelContainer&&(this.panelContainer.style.display=""),this.panelClass&&this.panelClass.split(/\s+/).filter(Boolean).forEach((t=>{e.popper.classList.add(t)}))},onShow:e=>{this.panelContainer&&(this.panelContainer.style.display="");const t=e.popper.querySelector(".tippy-content");t&&(this.width&&(t.style.width=this.width),this.height&&(t.style.height=this.height,t.style.overflow="auto")),this._hideGroupSiblings(),this._setOpen(!0),this._addEscListener(),this.dispatchEvent(new CustomEvent("nile-show",{detail:{instance:e,target:e.reference}})),this.dispatchEvent(new CustomEvent("nile-toggle",{detail:{open:!0,instance:e,target:e.reference}}))},onShown:e=>{this.dispatchEvent(new CustomEvent("nile-after-show",{detail:{instance:e,target:e.reference}}))},onHide:e=>{this._setOpen(!1),this._removeEscListener(),this.dispatchEvent(new CustomEvent("nile-hide",{detail:{instance:e,target:e.reference}})),this.dispatchEvent(new CustomEvent("nile-toggle",{detail:{open:!1,instance:e,target:e.reference}}))},onHidden:e=>{this.panelContainer&&(this.panelContainer.style.display="none"),this.dispatchEvent(new CustomEvent("nile-after-hide",{detail:{instance:e,target:e.reference}}))}};this.tippyInstance=Mk(this.anchorEl,i),this.open&&queueMicrotask((()=>this.tippyInstance?.show()))}_destroyTippy(){this.tippyInstance&&(this.tippyInstance.destroy(),this.tippyInstance=null),this.panelContainer&&(this.panelContainer.style.display="none",this.panelContainer.parentElement!==this&&this.appendChild(this.panelContainer))}};av._groups=new Map,av._reducedMotionQuery=null,e([ue({type:String})],av.prototype,"placement",void 0),e([ue({type:String})],av.prototype,"trigger",void 0),e([ue({type:Number})],av.prototype,"distance",void 0),e([ue({type:Number})],av.prototype,"skidding",void 0),e([ue({type:String,reflect:!0})],av.prototype,"arrow",void 0),e([ue({type:String,reflect:!0})],av.prototype,"animation",void 0),e([ue({type:String,reflect:!0})],av.prototype,"duration",void 0),e([ue({type:String,reflect:!0})],av.prototype,"delay",void 0),e([ue({type:Boolean,reflect:!0})],av.prototype,"interactive",void 0),e([ue({type:Number,reflect:!0})],av.prototype,"interactiveBorder",void 0),e([ue({type:String,reflect:!0})],av.prototype,"maxWidth",void 0),e([ue({type:Number,reflect:!0})],av.prototype,"zIndex",void 0),e([ue({type:String,reflect:!0})],av.prototype,"followCursor",void 0),e([ue({type:Boolean,reflect:!0})],av.prototype,"hideOnClick",void 0),e([ue({type:Boolean,reflect:!0})],av.prototype,"inertia",void 0),e([ue({type:Boolean,reflect:!0})],av.prototype,"allowHTML",void 0),e([ue({type:Boolean,reflect:!0})],av.prototype,"flip",void 0),e([ue({type:String,attribute:"for"})],av.prototype,"for",void 0),e([ue({type:Boolean,reflect:!0})],av.prototype,"open",void 0),e([ue({type:Boolean,reflect:!0})],av.prototype,"preventOverlayClose",void 0),e([ue({type:String,reflect:!0})],av.prototype,"title",void 0),e([ue({type:Boolean,reflect:!0})],av.prototype,"disabled",void 0),e([ue({type:String,reflect:!0})],av.prototype,"width",void 0),e([ue({type:String,reflect:!0})],av.prototype,"height",void 0),e([ue({type:String,reflect:!0})],av.prototype,"group",void 0),e([ue({type:Boolean,reflect:!0})],av.prototype,"closeOnEscape",void 0),e([ue({type:String,reflect:!0,attribute:!0})],av.prototype,"panelClass",void 0),e([ue({type:Boolean,reflect:!0})],av.prototype,"enableVisibilityEffect",void 0),e([ue({type:Boolean,reflect:!0})],av.prototype,"enableTabClose",void 0),av=sv=e([ge("nile-floating-panel")],av);const lv=r`
|
|
21107
|
+
`;var av;!function(){if("undefined"==typeof document)return;const e="nile-floating-panel-styles";if(document.getElementById(e))return;const t=document.createElement("style");t.id=e,t.textContent=sv.cssText,document.head?.appendChild(t)}();let lv=av=class extends Fe{constructor(){super(...arguments),this.placement="bottom",this.trigger="click",this.distance=12,this.skidding=0,this.arrow="round",this.animation="fade",this.duration=200,this.delay=0,this.interactive=!0,this.interactiveBorder=2,this.maxWidth="none",this.zIndex=9999,this.followCursor=!1,this.hideOnClick=!0,this.inertia=!1,this.allowHTML=!1,this.flip=!0,this.for=null,this.open=!1,this.preventOverlayClose=!1,this.title="",this.disabled=!1,this.group=null,this.closeOnEscape=!0,this.panelClass="",this.enableVisibilityEffect=!1,this.enableTabClose=!1,this.tippyInstance=null,this.panelContainer=null,this.anchorEl=null,this._suppressOpenWatch=!1,this._panelId=`nile-fp-${Math.random().toString(36).slice(2,9)}`,this._boundEscHandler=this._handleEscapeKey.bind(this),this._pendingShowListener=null,this._pendingHideListener=null}static get prefersReducedMotion(){return av._reducedMotionQuery||(av._reducedMotionQuery=window.matchMedia("(prefers-reduced-motion: reduce)")),av._reducedMotionQuery.matches}static get styles(){return[sv]}createRenderRoot(){return this}firstUpdated(){this._buildDOM(),this._attachTippy(),this._joinGroup(),this.visibilityManager=new mn({host:this,target:this.anchorEl||null,enableVisibilityEffect:this.enableVisibilityEffect,enableTabClose:this.enableTabClose,isOpen:()=>this.open,onAnchorOutOfView:()=>{this._setOpen(!1),this.tippyInstance?.hide(),this.emit("nile-visibility-change",{visible:!1,reason:"anchor-out-of-view"})},onDocumentHidden:()=>{this._setOpen(!1),this.tippyInstance?.hide(),this.emit("nile-visibility-change",{visible:!1,reason:"document-hidden"})},emit:(e,t)=>this.emit(`nile-${e}`,t)}),this.emit("nile-init")}disconnectedCallback(){super.disconnectedCallback(),this._cleanupPendingShowListener(),this._cleanupPendingHideListener(),this.visibilityManager?.cleanup(),this._leaveGroup(),this._removeEscListener(),this._destroyTippy(),this.emit("nile-destroy")}updated(e){if(super.updated(e),!this.panelContainer)return;e.has("open")&&!this._suppressOpenWatch&&(this.open?(this.visibilityManager?.setup(),queueMicrotask((()=>this.tippyInstance?.show()))):(this.visibilityManager?.cleanup(),this.tippyInstance?.hide())),e.has("group")&&(this._leaveGroup(e.get("group")),this._joinGroup());["placement","trigger","distance","skidding","arrow","animation","duration","delay","interactive","interactiveBorder","maxWidth","zIndex","followCursor","hideOnClick","inertia","allowHTML","flip","preventOverlayClose","disabled","width","height","panelClass"].some((t=>e.has(t)))&&this._attachTippy()}show(){return this.open=!0,new Promise((e=>{this._cleanupPendingShowListener();const t=()=>{this._pendingShowListener=null,e()};this._pendingShowListener=t,this.addEventListener("nile-after-show",t,{once:!0})}))}hide(){return this.open=!1,new Promise((e=>{this._cleanupPendingHideListener();const t=()=>{this._pendingHideListener=null,e()};this._pendingHideListener=t,this.addEventListener("nile-after-hide",t,{once:!0})}))}_cleanupPendingShowListener(){this._pendingShowListener&&(this.removeEventListener("nile-after-show",this._pendingShowListener),this._pendingShowListener=null)}_cleanupPendingHideListener(){this._pendingHideListener&&(this.removeEventListener("nile-after-hide",this._pendingHideListener),this._pendingHideListener=null)}toggle(){this.open=!this.open}refresh(){this._attachTippy()}reposition(){this.tippyInstance?.popperInstance?.update()}getCurrentPlacement(){const e=this.tippyInstance?.popper,t=e?.querySelector(".tippy-box");return t?.dataset.placement??this.placement}isPositioningOptimal(){return this.getCurrentPlacement()===this.placement}_joinGroup(){if(!this.group)return;let e=av._groups.get(this.group);e||(e=new Set,av._groups.set(this.group,e)),e.add(this)}_leaveGroup(e){const t=e??this.group;if(!t)return;const i=av._groups.get(t);i&&(i.delete(this),0===i.size&&av._groups.delete(t))}_hideGroupSiblings(){if(!this.group)return;const e=av._groups.get(this.group);e&&e.forEach((e=>{e!==this&&e.open&&(e._setOpen(!1),e.tippyInstance?.hide())}))}_addEscListener(){this.closeOnEscape&&document.addEventListener("keydown",this._boundEscHandler)}_removeEscListener(){document.removeEventListener("keydown",this._boundEscHandler)}_handleEscapeKey(e){"Escape"===e.key&&this.open&&(this._setOpen(!1),this.tippyInstance?.hide())}_applyAria(){this.anchorEl&&this.panelContainer&&(this.panelContainer.setAttribute("role","dialog"),this.panelContainer.id=this._panelId,this.anchorEl.setAttribute("aria-haspopup","dialog"),this._syncAriaExpanded())}_syncAriaExpanded(){this.anchorEl?.setAttribute("aria-expanded",String(this.open)),this.open?this.anchorEl?.setAttribute("aria-describedby",this._panelId):this.anchorEl?.removeAttribute("aria-describedby")}_buildDOM(){const e=Array.from(this.childNodes);this.anchorEl=null;const t=[],i=[],n=[];let o=!1;for(const M of e){if(M instanceof HTMLElement){const e=M.getAttribute("slot");if("title"===e){M.removeAttribute("slot"),t.push(M);continue}if("action"===e){M.removeAttribute("slot"),i.push(M);continue}if(!o&&!this.for){this.anchorEl=M,o=!0;continue}}n.push(M)}if(this.for){const e=document.getElementById(this.for);e&&(this.anchorEl=e)}for(;this.firstChild;)this.removeChild(this.firstChild);this.anchorEl&&!this.for&&this.appendChild(this.anchorEl),this.panelContainer=document.createElement("div"),this.panelContainer.className="nile-floating-panel__content",this.panelContainer.style.display="none";const M=document.createElement("div");if(M.className="nile-floating-panel__body",t.length>0||this.title){const e=document.createElement("div");e.className="nile-floating-panel__title",this.title?e.textContent=this.title:t.forEach((t=>e.appendChild(t))),M.appendChild(e)}if(n.length>0){const e=document.createElement("div");e.className="nile-floating-panel__main",n.forEach((t=>e.appendChild(t))),M.appendChild(e)}if(i.length>0){const e=document.createElement("div");e.className="nile-floating-panel__action",i.forEach((t=>e.appendChild(t))),M.appendChild(e)}this.panelContainer.appendChild(M),this.appendChild(this.panelContainer),this._applyAria()}_resolveArrow(){switch(this.arrow){case"round":return sb;case"none":return!1;default:return!0}}_setOpen(e){this._suppressOpenWatch=!0,this.open=e,this._syncAriaExpanded(),this._suppressOpenWatch=!1}_getEffectiveDuration(){return av.prefersReducedMotion?0:uk(this.duration)}_getEffectiveAnimation(){return!av.prefersReducedMotion&&this.animation}_attachTippy(){if(this._destroyTippy(),this.disabled||!this.anchorEl||!this.panelContainer)return;const e=ck(this.followCursor),t=!this.preventOverlayClose&&this.hideOnClick,i={content:this.panelContainer,placement:this.placement,trigger:this.trigger,offset:[this.skidding,this.distance],theme:"floating-panel",animation:this._getEffectiveAnimation(),interactive:this.interactive,arrow:this._resolveArrow(),duration:this._getEffectiveDuration(),allowHTML:this.allowHTML,delay:this.delay,maxWidth:this.maxWidth,zIndex:this.zIndex,hideOnClick:t,inertia:!av.prefersReducedMotion&&this.inertia,interactiveBorder:this.interactiveBorder,appendTo:document.body,followCursor:e,plugins:e?[Nk]:[],popperOptions:{modifiers:[{name:"flip",enabled:this.flip}]},onMount:e=>{this.panelContainer&&(this.panelContainer.style.display=""),this.panelClass&&this.panelClass.split(/\s+/).filter(Boolean).forEach((t=>{e.popper.classList.add(t)}))},onShow:e=>{this.panelContainer&&(this.panelContainer.style.display="");const t=e.popper.querySelector(".tippy-content");t&&(this.width&&(t.style.width=this.width),this.height&&(t.style.height=this.height,t.style.overflow="auto")),this._hideGroupSiblings(),this._setOpen(!0),this._addEscListener(),this.dispatchEvent(new CustomEvent("nile-show",{detail:{instance:e,target:e.reference}})),this.dispatchEvent(new CustomEvent("nile-toggle",{detail:{open:!0,instance:e,target:e.reference}}))},onShown:e=>{this.dispatchEvent(new CustomEvent("nile-after-show",{detail:{instance:e,target:e.reference}}))},onHide:e=>{this._setOpen(!1),this._removeEscListener(),this.dispatchEvent(new CustomEvent("nile-hide",{detail:{instance:e,target:e.reference}})),this.dispatchEvent(new CustomEvent("nile-toggle",{detail:{open:!1,instance:e,target:e.reference}}))},onHidden:e=>{this.panelContainer&&(this.panelContainer.style.display="none"),this.dispatchEvent(new CustomEvent("nile-after-hide",{detail:{instance:e,target:e.reference}}))}};this.tippyInstance=Mk(this.anchorEl,i),this.open&&queueMicrotask((()=>this.tippyInstance?.show()))}_destroyTippy(){this.tippyInstance&&(this.tippyInstance.destroy(),this.tippyInstance=null),this.panelContainer&&(this.panelContainer.style.display="none",this.panelContainer.parentElement!==this&&this.appendChild(this.panelContainer))}};lv._groups=new Map,lv._reducedMotionQuery=null,e([ue({type:String})],lv.prototype,"placement",void 0),e([ue({type:String})],lv.prototype,"trigger",void 0),e([ue({type:Number})],lv.prototype,"distance",void 0),e([ue({type:Number})],lv.prototype,"skidding",void 0),e([ue({type:String,reflect:!0})],lv.prototype,"arrow",void 0),e([ue({type:String,reflect:!0})],lv.prototype,"animation",void 0),e([ue({type:String,reflect:!0})],lv.prototype,"duration",void 0),e([ue({type:String,reflect:!0})],lv.prototype,"delay",void 0),e([ue({type:Boolean,reflect:!0})],lv.prototype,"interactive",void 0),e([ue({type:Number,reflect:!0})],lv.prototype,"interactiveBorder",void 0),e([ue({type:String,reflect:!0})],lv.prototype,"maxWidth",void 0),e([ue({type:Number,reflect:!0})],lv.prototype,"zIndex",void 0),e([ue({type:String,reflect:!0})],lv.prototype,"followCursor",void 0),e([ue({type:Boolean,reflect:!0})],lv.prototype,"hideOnClick",void 0),e([ue({type:Boolean,reflect:!0})],lv.prototype,"inertia",void 0),e([ue({type:Boolean,reflect:!0})],lv.prototype,"allowHTML",void 0),e([ue({type:Boolean,reflect:!0})],lv.prototype,"flip",void 0),e([ue({type:String,attribute:"for"})],lv.prototype,"for",void 0),e([ue({type:Boolean,reflect:!0})],lv.prototype,"open",void 0),e([ue({type:Boolean,reflect:!0})],lv.prototype,"preventOverlayClose",void 0),e([ue({type:String,reflect:!0})],lv.prototype,"title",void 0),e([ue({type:Boolean,reflect:!0})],lv.prototype,"disabled",void 0),e([ue({type:String,reflect:!0})],lv.prototype,"width",void 0),e([ue({type:String,reflect:!0})],lv.prototype,"height",void 0),e([ue({type:String,reflect:!0})],lv.prototype,"group",void 0),e([ue({type:Boolean,reflect:!0})],lv.prototype,"closeOnEscape",void 0),e([ue({type:String,reflect:!0,attribute:!0})],lv.prototype,"panelClass",void 0),e([ue({type:Boolean,reflect:!0})],lv.prototype,"enableVisibilityEffect",void 0),e([ue({type:Boolean,reflect:!0})],lv.prototype,"enableTabClose",void 0),lv=av=e([ge("nile-floating-panel")],lv);const gv=r`
|
|
21064
21108
|
:host {
|
|
21065
21109
|
box-sizing: border-box;
|
|
21066
21110
|
-webkit-font-smoothing: var(--nile-webkit-font-smoothing, var(--ng-webkit-font-smoothing));
|
|
@@ -21110,7 +21154,7 @@ const qk="important",Kk=" !"+qk,ev=Ae(class extends Oe{constructor(e){if(super(e
|
|
|
21110
21154
|
height: 1px;
|
|
21111
21155
|
background: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
|
21112
21156
|
}
|
|
21113
|
-
`;!function(){if("undefined"==typeof document)return;const e="nile-context-menu-overrides";if(document.getElementById(e))return;const t=document.createElement("style");t.id=e,t.textContent="\n .nile-context-menu-panel .nile-floating-panel__body {\n min-width: 0;\n padding: var(--nile-spacing-none, var(--ng-spacing-none));\n gap: var(--nile-spacing-none, var(--ng-spacing-none));\n }\n .nile-context-menu-panel .nile-floating-panel__main {\n padding: var(--nile-spacing-none, var(--ng-spacing-none));\n margin: var(--nile-spacing-none, var(--ng-spacing-none));\n }\n .nile-context-menu-panel .tippy-box[data-theme~='floating-panel'] {\n padding: var(--nile-spacing-none, var(--ng-spacing-none));\n background: transparent;\n border: none;\n border-radius: var(--nile-radius-none, var(--ng-radius-none));\n box-shadow: none;\n }\n .nile-context-menu__menu[role='menu'] {\n min-width: 200px;\n max-width: 540px;\n max-height: min(60vh, 400px);\n padding: var(--nile-spacing-xs, var(--ng-spacing-xs)) var(--nile-spacing-none, var(--ng-spacing-none));\n background: var(--nile-colors-white-base, var(--ng-colors-bg-primary));\n border: solid 1px var(--nile-colors-border-surface, var(--ng-colors-border-secondary-alt));\n border-radius: var(--nile-radius-radius-lg, var(--ng-radius-md));\n box-shadow: 0px 20px 24px -4px rgba(16, 24, 40, 0.08),\n 0px 8px 8px -4px rgba(16, 24, 40, 0.03);\n overflow-y: auto;\n overflow-x: hidden;\n font-family: var(--nile-font-family-sans-serif, var(--ng-font-family-body));\n font-size: var(--nile-type-scale-4, var(--ng-font-size-text-sm));\n font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-semibold));\n line-height: var(--nile-line-height-1-8, var(--ng-line-height-text-md));\n color: var(--nile-colors-text-default, var(--ng-colors-text-secondary-700));\n user-select: none;\n }\n .nile-context-menu__menu[role='menu'] nile-context-menu-item,\n .nile-context-menu__menu[role='menu'] nile-context-menu-group {\n font-family: inherit;\n }\n .nile-context-menu__menu[role='menu'] nile-context-menu-group + nile-context-menu-group {\n position: relative;\n margin-top: var(--nile-spacing-xs, var(--ng-spacing-xs));\n padding-top: var(--nile-spacing-xs, var(--ng-spacing-xs));\n }\n .nile-context-menu__menu[role='menu'] nile-context-menu-group + nile-context-menu-group::before {\n content: '';\n position: absolute;\n top: 0;\n left: var(--nile-spacing-xl, var(--ng-spacing-lg));\n right: var(--nile-spacing-xl, var(--ng-spacing-lg));\n height: 1px;\n background: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n }\n",document.head?.appendChild(t)}();const
|
|
21157
|
+
`;!function(){if("undefined"==typeof document)return;const e="nile-context-menu-overrides";if(document.getElementById(e))return;const t=document.createElement("style");t.id=e,t.textContent="\n .nile-context-menu-panel .nile-floating-panel__body {\n min-width: 0;\n padding: var(--nile-spacing-none, var(--ng-spacing-none));\n gap: var(--nile-spacing-none, var(--ng-spacing-none));\n }\n .nile-context-menu-panel .nile-floating-panel__main {\n padding: var(--nile-spacing-none, var(--ng-spacing-none));\n margin: var(--nile-spacing-none, var(--ng-spacing-none));\n }\n .nile-context-menu-panel .tippy-box[data-theme~='floating-panel'] {\n padding: var(--nile-spacing-none, var(--ng-spacing-none));\n background: transparent;\n border: none;\n border-radius: var(--nile-radius-none, var(--ng-radius-none));\n box-shadow: none;\n }\n .nile-context-menu__menu[role='menu'] {\n min-width: 200px;\n max-width: 540px;\n max-height: min(60vh, 400px);\n padding: var(--nile-spacing-xs, var(--ng-spacing-xs)) var(--nile-spacing-none, var(--ng-spacing-none));\n background: var(--nile-colors-white-base, var(--ng-colors-bg-primary));\n border: solid 1px var(--nile-colors-border-surface, var(--ng-colors-border-secondary-alt));\n border-radius: var(--nile-radius-radius-lg, var(--ng-radius-md));\n box-shadow: 0px 20px 24px -4px rgba(16, 24, 40, 0.08),\n 0px 8px 8px -4px rgba(16, 24, 40, 0.03);\n overflow-y: auto;\n overflow-x: hidden;\n font-family: var(--nile-font-family-sans-serif, var(--ng-font-family-body));\n font-size: var(--nile-type-scale-4, var(--ng-font-size-text-sm));\n font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-semibold));\n line-height: var(--nile-line-height-1-8, var(--ng-line-height-text-md));\n color: var(--nile-colors-text-default, var(--ng-colors-text-secondary-700));\n user-select: none;\n }\n .nile-context-menu__menu[role='menu'] nile-context-menu-item,\n .nile-context-menu__menu[role='menu'] nile-context-menu-group {\n font-family: inherit;\n }\n .nile-context-menu__menu[role='menu'] nile-context-menu-group + nile-context-menu-group {\n position: relative;\n margin-top: var(--nile-spacing-xs, var(--ng-spacing-xs));\n padding-top: var(--nile-spacing-xs, var(--ng-spacing-xs));\n }\n .nile-context-menu__menu[role='menu'] nile-context-menu-group + nile-context-menu-group::before {\n content: '';\n position: absolute;\n top: 0;\n left: var(--nile-spacing-xl, var(--ng-spacing-lg));\n right: var(--nile-spacing-xl, var(--ng-spacing-lg));\n height: 1px;\n background: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n }\n",document.head?.appendChild(t)}();const Nv=r`
|
|
21114
21158
|
:host {
|
|
21115
21159
|
box-sizing: border-box;
|
|
21116
21160
|
display: block;
|
|
@@ -21129,7 +21173,7 @@ const qk="important",Kk=" !"+qk,ev=Ae(class extends Oe{constructor(e){if(super(e
|
|
|
21129
21173
|
line-height: var(--nile-line-height-1-8, var(--ng-line-height-text-md));
|
|
21130
21174
|
color: var(--nile-colors-neutral-500, var(--ng-colors-text-placeholder-subtle));
|
|
21131
21175
|
}
|
|
21132
|
-
`;var
|
|
21176
|
+
`;var cv;let uv=cv=class extends Fe{constructor(){super(...arguments),this.label="",this._labelId="nile-context-menu-group-label-"+ ++cv._idSeq}static get styles(){return[Nv]}render(){const e=this.label||this.id;return _`
|
|
21133
21177
|
<div
|
|
21134
21178
|
part="group"
|
|
21135
21179
|
class="group"
|
|
@@ -21139,7 +21183,7 @@ const qk="important",Kk=" !"+qk,ev=Ae(class extends Oe{constructor(e){if(super(e
|
|
|
21139
21183
|
${e?_`<div part="label" class="label" id=${this._labelId}>${e}</div>`:null}
|
|
21140
21184
|
<slot></slot>
|
|
21141
21185
|
</div>
|
|
21142
|
-
`}};
|
|
21186
|
+
`}};uv._idSeq=0,e([ue({attribute:!0,type:String,reflect:!0})],uv.prototype,"label",void 0),uv=cv=e([ge("nile-context-menu-group")],uv);const Dv=r`
|
|
21143
21187
|
:host {
|
|
21144
21188
|
box-sizing: border-box;
|
|
21145
21189
|
display: block;
|
|
@@ -21210,7 +21254,7 @@ const qk="important",Kk=" !"+qk,ev=Ae(class extends Oe{constructor(e){if(super(e
|
|
|
21210
21254
|
line-height: 1;
|
|
21211
21255
|
opacity: 0.6;
|
|
21212
21256
|
}
|
|
21213
|
-
`;let
|
|
21257
|
+
`;let dv=class extends Fe{constructor(){super(...arguments),this.value="",this.disabled=!1,this.open=!1,this._hasSubmenu=!1,this._hasIcon=!1,this._submenuExpanded=!1,this._onSlotChange=e=>{const t=e.target.assignedElements({flatten:!0});this._hasSubmenu=t.some((e=>"nile-context-submenu"===e.tagName.toLowerCase()))},this._onIconSlotChange=e=>{const t=e.target;this._hasIcon=t.assignedNodes({flatten:!0}).some((e=>e.nodeType===Node.ELEMENT_NODE||""!==(e.textContent??"").trim()))}}static get styles(){return[Dv]}setSubmenuExpanded(e){this._submenuExpanded=e}focus(e){const t=this.shadowRoot?.querySelector(".item");t?.focus(e)}get hasSubmenu(){return this._hasSubmenu}render(){return _`
|
|
21214
21258
|
<div
|
|
21215
21259
|
part="item"
|
|
21216
21260
|
class="item"
|
|
@@ -21229,9 +21273,9 @@ const qk="important",Kk=" !"+qk,ev=Ae(class extends Oe{constructor(e){if(super(e
|
|
|
21229
21273
|
<nile-glyph name="ng-chevron-right" size="16" method="stroke"></nile-glyph>
|
|
21230
21274
|
</span>`:""}
|
|
21231
21275
|
</div>
|
|
21232
|
-
`}};var
|
|
21276
|
+
`}};var hv;e([ue({attribute:!0,type:String,reflect:!0})],dv.prototype,"value",void 0),e([ue({attribute:!0,type:Boolean,reflect:!0})],dv.prototype,"disabled",void 0),e([ue({attribute:!0,type:Boolean,reflect:!0})],dv.prototype,"open",void 0),e([De()],dv.prototype,"_hasSubmenu",void 0),e([De()],dv.prototype,"_hasIcon",void 0),e([De()],dv.prototype,"_submenuExpanded",void 0),dv=e([ge("nile-context-menu-item")],dv);const jv="nile-context-menu-item",Iv="nile-context-submenu";let zv=0,yv=hv=class extends Fe{constructor(){super(...arguments),this.zIndex=9999,this._open=!1,this._parentItem=null,this._proxyId="nile-context-submenu-anchor-"+ ++zv,this._menuContainerRef=null,this._setupDone=!1,this._repositionQueued=!1,this._onParentEnter=()=>{this._parentItem?.disabled||(this._clearTimers(),this._open||(this._openTimer=window.setTimeout((()=>this.openSubmenu()),100)))},this._onParentLeave=()=>{null!=this._openTimer&&(clearTimeout(this._openTimer),this._openTimer=void 0),this._pinnedOpen||this._open&&(this._closeTimer=window.setTimeout((()=>this.closeSubmenu()),300))},this._onParentClick=e=>{e.stopPropagation(),this._parentItem?.disabled||(this._clearTimers(),this._open?this._pinnedOpen||this.closeSubmenu():this.openSubmenu())},this._onPanelEnter=()=>{this._clearTimers()},this._onReposition=()=>{!this._repositionQueued&&this._open&&(this._repositionQueued=!0,requestAnimationFrame((()=>{this._repositionQueued=!1,this._open&&(this._syncProxyToParent(),this._floatingPanelEl?.reposition())})))},this._onPanelLeave=()=>{this._pinnedOpen||this._open&&(this._closeTimer=window.setTimeout((()=>{hv.openStack.some((e=>e!==this&&this._menuContainerRef?.contains(e)))||this.closeSubmenu()}),300))},this._onMenuMouseOver=e=>{const t=e.composedPath().find((e=>e instanceof HTMLElement&&e.tagName.toLowerCase()===jv));t&&!t.disabled&&t.focus()},this._onNestedSelect=e=>{e.target!==this&&"click"===e.detail?.type&&this.emit("nile-change",e.detail)},this._onMenuClick=e=>{const t=e.composedPath().find((e=>e instanceof HTMLElement&&e.tagName.toLowerCase()===jv));if(!t||t.disabled)return;if(t.querySelector(`:scope > ${Iv}`))return;const i={id:t.id,value:t.value,name:(t.textContent??"").trim(),target:null,originalEvent:e};try{t.onSelect?.(i)}catch(e){console.error("[nile-context-submenu] onSelect callback threw:",e)}this.emit("nile-change",{type:"click",...i})}}static get styles(){return[r`
|
|
21233
21277
|
:host { display: contents; }
|
|
21234
|
-
`]}get _pinnedOpen(){return!(!this._parentItem?.open||this._parentItem.disabled)}connectedCallback(){super.connectedCallback();let e=this.parentElement;for(;e&&e.tagName.toLowerCase()!==hv;)e=e.parentElement;this._parentItem=e,this._ensureProxy(),this._parentItem&&(this._parentItem.setSubmenuExpanded?.(!1),this._parentItem.addEventListener("mouseenter",this._onParentEnter),this._parentItem.addEventListener("mouseleave",this._onParentLeave),this._parentItem.addEventListener("click",this._onParentClick,!0),this._parentObserver=new MutationObserver((()=>{this._pinnedOpen?this._isParentVisible()&&this.openSubmenu():this._open&&this.closeSubmenu()})),this._parentObserver.observe(this._parentItem,{attributes:!0,attributeFilter:["open"]})),this._ensureBodyPanel()}_isParentVisible(){const e=this._parentItem?.getBoundingClientRect();return!!e&&e.width>0&&e.height>0}_ensureProxy(){if(this._proxyEl)return;const e=document.createElement("div");e.id=this._proxyId,e.setAttribute("aria-hidden","true"),e.style.cssText="position: fixed; top: 0; left: 0; width: 0; height: 0; pointer-events: none;",document.body.appendChild(e),this._proxyEl=e}_syncProxyToParent(){if(!this._proxyEl||!this._parentItem)return;const e=this._parentItem.getBoundingClientRect();this._pinnedOpen?(this._proxyEl.style.position="absolute",this._proxyEl.style.left=`${e.left+window.scrollX}px`,this._proxyEl.style.top=`${e.top+window.scrollY}px`):(this._proxyEl.style.position="fixed",this._proxyEl.style.left=`${e.left}px`,this._proxyEl.style.top=`${e.top}px`),this._proxyEl.style.width=`${e.width}px`,this._proxyEl.style.height=`${e.height}px`}disconnectedCallback(){super.disconnectedCallback(),this._parentItem&&(this._parentItem.removeEventListener("mouseenter",this._onParentEnter),this._parentItem.removeEventListener("mouseleave",this._onParentLeave),this._parentItem.removeEventListener("click",this._onParentClick,!0)),this._parentObserver?.disconnect(),this._parentObserver=void 0,this._clearTimers(),this._open&&this.closeSubmenu(),this._teardownBodyArtifacts(),dv.openStack=dv.openStack.filter((e=>e!==this))}_teardownBodyArtifacts(){const e=this._menuContainerRef;if(e)for(e.removeEventListener("click",this._onMenuClick),e.removeEventListener("mouseover",this._onMenuMouseOver),e.removeEventListener("mouseenter",this._onPanelEnter),e.removeEventListener("mouseleave",this._onPanelLeave),e.removeEventListener("nile-change",this._onNestedSelect);e.firstChild;)this.appendChild(e.firstChild);this._floatingPanelEl?.remove(),this._floatingPanelEl=void 0,this._menuContainerRef=null,this._setupDone=!1,this._proxyEl?.remove(),this._proxyEl=void 0}_ensureBodyPanel(){if(this._setupDone)return;const e=document.createElement("nile-floating-panel");e.setAttribute("for",this._proxyId),e.setAttribute("trigger","manual"),e.setAttribute("placement","right-start"),e.panelClass="nile-context-menu-panel",e.zIndex=this.zIndex,e.interactive=!0,e.hideOnClick=!1,e.closeOnEscape=!1,e.arrow="none",e.distance=0;const t=document.createElement("div");t.className="nile-context-menu__menu",t.setAttribute("role","menu"),e.appendChild(t),document.body.appendChild(e),this._floatingPanelEl=e,this._menuContainerRef=t,t.addEventListener("click",this._onMenuClick),t.addEventListener("mouseover",this._onMenuMouseOver),t.addEventListener("mouseenter",this._onPanelEnter),t.addEventListener("mouseleave",this._onPanelLeave),t.addEventListener("nile-change",this._onNestedSelect),this._relocateLightChildren(),this._setupDone=!0}firstUpdated(){this._relocateLightChildren()}_relocateLightChildren(){if(this._menuContainerRef)for(const e of Array.from(this.children))this._menuContainerRef.appendChild(e)}_clearTimers(){null!=this._openTimer&&(clearTimeout(this._openTimer),this._openTimer=void 0),null!=this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=void 0)}openSubmenu(){this._open||this._parentItem?.disabled||(this._closeSiblingSubmenus(),this._ensureProxy(),this._ensureBodyPanel(),this._syncProxyToParent(),this._open=!0,this._floatingPanelEl&&(this._floatingPanelEl.addEventListener("nile-after-show",(()=>{this._open&&this._openPinnedDescendants()}),{once:!0}),this._floatingPanelEl.open=!0),dv.openStack.push(this),window.addEventListener("scroll",this._onReposition,!0),window.addEventListener("resize",this._onReposition),requestAnimationFrame((()=>requestAnimationFrame((()=>{this._open&&this._openPinnedDescendants()})))),this._parentItem?.setSubmenuExpanded?.(!0))}_openPinnedDescendants(){if(!this._menuContainerRef)return;const e=Array.from(this._menuContainerRef.querySelectorAll(hv));for(const t of e){if(!this._isDirectChildItem(t))continue;if(!t.open||t.disabled)continue;const e=t.querySelector(`:scope > ${jv}`);e?.openSubmenu()}}_isDirectChildItem(e){let t=e.parentElement;for(;t&&t!==this._menuContainerRef;){if(t.tagName.toLowerCase()===jv)return!1;t=t.parentElement}return!0}closeSubmenu(){if(this._open){for(const e of[...dv.openStack])e!==this&&this._menuContainerRef?.contains(e)&&e.closeSubmenu();this._open=!1,this._floatingPanelEl&&(this._floatingPanelEl.open=!1),window.removeEventListener("scroll",this._onReposition,!0),window.removeEventListener("resize",this._onReposition),dv.openStack=dv.openStack.filter((e=>e!==this)),this._clearTimers(),this._parentItem?.setSubmenuExpanded?.(!1)}}get isOpen(){return this._open}static findByContainer(e){for(const t of dv.openStack)if(t._menuContainerRef===e)return t;return null}get parentItem(){return this._parentItem}focusFirstItem(){if(!this._menuContainerRef)return;const e=Array.from(this._menuContainerRef.querySelectorAll(hv));for(const t of e)if(this._isDirectChildItem(t)&&!t.disabled)return void t.focus()}_closeSiblingSubmenus(){const e=this._parentLevel();for(const t of[...dv.openStack])t!==this&&(t._pinnedOpen||t._parentLevel()===e&&t.closeSubmenu())}_parentLevel(){const e=this._parentItem;return e?e.parentElement?.closest(".nile-context-menu__menu")??null:null}render(){return _``}};var yv;zv.openStack=[],e([ue({attribute:!0,type:Number,reflect:!0})],zv.prototype,"zIndex",void 0),e([De()],zv.prototype,"_open",void 0),zv=dv=e([ge("nile-context-submenu")],zv);const pv="nile-context-menu-item",Tv="nile-context-submenu",Av="nile-context-menu__menu",Ov=["value","disabled"];let xv=0,Lv=yv=class extends Fe{constructor(){super(...arguments),this.for="",this.trigger="right",this.skipOn="",this.zIndex=9999,this.open=!1,this.items=[],this._items=[],this._open=!1,this._pinned=!1,this._openContext=null,this._targetEl=null,this._previouslyFocused=null,this._proxyId="nile-context-menu-anchor-"+ ++xv,this._wasDataMode=!1,this._onPinnedReposition=()=>{if(!this._open||!this._pinned||!this._targetEl)return;const e=this._targetEl.getBoundingClientRect();this._positionProxyAt(e.left,e.bottom)},this._menuContainerRef=null,this._onKeydown=e=>{if(this._open)switch(e.key){case"Escape":return e.preventDefault(),void this.close("escape");case"Tab":return void this.close("programmatic");case"ArrowDown":return e.preventDefault(),void this._moveFocus(1);case"ArrowUp":return e.preventDefault(),void this._moveFocus(-1);case"ArrowRight":{const{item:t}=this._getFocusedItemAnyLevel(),i=t?.querySelector(`:scope > ${Tv}`);if(!i)return;return e.preventDefault(),i.openSubmenu?.(),void requestAnimationFrame((()=>{i.focusFirstItem?.()}))}case"ArrowLeft":{const{item:t,container:i}=this._getFocusedItemAnyLevel();if(!t||!i)return;const n=this._findSubmenuOwning(i);if(!n)return;return e.preventDefault(),n.parentItem?.open||n.closeSubmenu?.(),void n.parentItem?.focus()}case"Enter":case" ":{e.preventDefault();const{item:t}=this._getFocusedItemAnyLevel();if(!t||t.disabled)return;const i=t.querySelector(`:scope > ${Tv}`);return i?(i.openSubmenu?.(),void requestAnimationFrame((()=>{const e=i.shadowRoot?.querySelector(`.${Av}`),t=e?this._enabledItemsIn(e)[0]:void 0;t?.focus()}))):void this._selectItem(t)}}},this._onScroll=e=>{if(!this._open)return;if(this._pinned)return void this._onPinnedReposition();const t=e.composedPath();if(!this._menuContainerRef||!t.includes(this._menuContainerRef)){for(const e of t)if(e instanceof HTMLElement&&e.classList?.contains(Av))return;this.close("programmatic")}},this._onOutsidePointer=e=>{if(!this._open)return;const t=e.composedPath();if(!this._menuContainerRef||!t.includes(this._menuContainerRef)){for(const e of t)if(e instanceof HTMLElement&&e.classList?.contains(Av))return;this.close("outside-click")}},this._onDescendantSelect=e=>{"click"===e.detail?.type&&this.close("select")},this._onPanelShown=e=>{e.stopPropagation(),this._openPinnedSubmenus()},this._onMenuMouseOver=e=>{const t=e.composedPath().find((e=>e instanceof HTMLElement&&e.tagName.toLowerCase()===pv));t&&!t.disabled&&t.focus()},this._onMenuClick=e=>{const t=e.composedPath().find((e=>e instanceof HTMLElement&&e.tagName.toLowerCase()===pv));t&&!t.disabled&&(t.querySelector(`:scope > ${Tv}`)||this._selectItem(t))}}static get styles(){return[lv]}get _isDataMode(){return Array.isArray(this.items)&&this.items.length>0}connectedCallback(){super.connectedCallback(),this._ensureProxy(),this._resolveTarget(),this._attachTriggers(),this._lightObserver=new MutationObserver((()=>{this._isDataMode||this._relocateLightChildren()})),this._lightObserver.observe(this,{childList:!0}),this.open&&!this._open&&this.updateComplete.then((()=>{this.isConnected&&this.open&&!this._open&&(this._pinned=!0,this._openAtTarget())}))}updated(e){super.updated(e),(e.has("for")||e.has("trigger")||e.has("skipOn"))&&this._open&&this.close("programmatic"),e.has("for")?(this._resolveTarget(),this._attachTriggers()):(e.has("trigger")||e.has("skipOn"))&&this._attachTriggers(),e.has("items")&&this._menuContainerRef&&(this._isDataMode?(this._renderDataItems(),this._wasDataMode=!0):this._wasDataMode&&(this._renderDataItems(),this._wasDataMode=!1)),e.has("open")&&(this.open&&!this._open?(this._pinned=!0,this._openAtTarget()):!this.open&&this._open&&this.close("programmatic"))}_openAtTarget(){const e=this._targetEl?.getBoundingClientRect();this.openAt({x:e?e.left:0,y:e?e.bottom:0,target:this._targetEl??void 0})}_resolveTarget(){const e=this.for?.trim();if(!e)return void(this._targetEl=null);const t=this.getRootNode()??document;/^[#.\[:]/.test(e)?this._targetEl=t.querySelector(e):this._targetEl="getElementById"in t?t.getElementById(e):document.getElementById(e)}get targetElement(){return this._targetEl}_attachTriggers(){this._detachTriggers?.(),this._detachTriggers=void 0;const e=this.trigger;if("manual"===e)return;const t=[];if("global"===e){const e=this.skipOn?.trim()??"",i=t=>!(!t||!e)&&!!t.closest(e),n=e=>{const t=e;i(t.target)||(t.preventDefault(),this._open||this.openAt({x:t.clientX,y:t.clientY,target:t.target??void 0,originalEvent:t}))};return window.addEventListener("contextmenu",n,!0),t.push((()=>window.removeEventListener("contextmenu",n,!0))),void(this._detachTriggers=()=>t.forEach((e=>e())))}const i=this._targetEl;if(!i)return;const n="left"===e||"both"===e;if("right"===e||"both"===e){const e=e=>{const t=e;t.preventDefault(),this.openAt({x:t.clientX,y:t.clientY,target:i,originalEvent:t})};i.addEventListener("contextmenu",e),t.push((()=>i.removeEventListener("contextmenu",e)))}if(n){const e=e=>{const t=e;this.openAt({x:t.clientX,y:t.clientY,target:i,originalEvent:t})};i.addEventListener("click",e),t.push((()=>i.removeEventListener("click",e)))}0!==t.length&&(this._detachTriggers=()=>t.forEach((e=>e())))}disconnectedCallback(){super.disconnectedCallback(),yv._openInstances.delete(this),this._open=!1,this._detachTriggers?.(),this._detachTriggers=void 0,this._lightObserver?.disconnect(),this._lightObserver=void 0,this._menuObserver?.disconnect(),this._menuObserver=void 0,this._menuContainerRef?.removeEventListener("click",this._onMenuClick),this._menuContainerRef?.removeEventListener("mouseover",this._onMenuMouseOver),this._menuContainerRef?.removeEventListener("nile-change",this._onDescendantSelect),document.removeEventListener("pointerdown",this._onOutsidePointer,!0),document.removeEventListener("keydown",this._onKeydown,!0),window.removeEventListener("scroll",this._onScroll,!0),window.removeEventListener("resize",this._onPinnedReposition),this._proxyEl?.remove(),this._proxyEl=void 0}firstUpdated(){this._menuContainerRef=this.renderRoot.querySelector(".nile-context-menu__menu"),this._isDataMode?(this._renderDataItems(),this._wasDataMode=!0):this._relocateLightChildren(),this._menuContainerRef&&(this._menuObserver=new MutationObserver((()=>this._parseChildren())),this._menuObserver.observe(this._menuContainerRef,{childList:!0,subtree:!0,attributes:!0,attributeFilter:Ov}),this._menuContainerRef.addEventListener("click",this._onMenuClick),this._menuContainerRef.addEventListener("mouseover",this._onMenuMouseOver),this._menuContainerRef.addEventListener("nile-change",this._onDescendantSelect)),this._parseChildren()}_ensureProxy(){if(this._proxyEl)return;const e=document.createElement("div");e.id=this._proxyId,e.setAttribute("aria-hidden","true"),e.style.cssText="position: fixed; top: 0; left: 0; width: 0; height: 0; pointer-events: none;",document.body.appendChild(e),this._proxyEl=e}_positionProxyAt(e,t){if(this._proxyEl){if(this._pinned&&this._targetEl){const e=this._targetEl.getBoundingClientRect();return this._proxyEl.style.position="absolute",this._proxyEl.style.left=`${e.left+window.scrollX}px`,this._proxyEl.style.top=`${e.top+window.scrollY}px`,this._proxyEl.style.width=`${e.width}px`,void(this._proxyEl.style.height=`${e.height}px`)}this._proxyEl.style.position="fixed",this._proxyEl.style.left=`${e}px`,this._proxyEl.style.top=`${t}px`,this._proxyEl.style.width="0",this._proxyEl.style.height="0"}}_relocateLightChildren(){if(!this._menuContainerRef)return;const e=Array.from(this.children);if(0!==e.length)for(const t of e)this._menuContainerRef.appendChild(t)}_renderDataItems(){const e=this._menuContainerRef;if(e){for(;e.firstChild;)e.removeChild(e.firstChild);for(const t of this.items){const i=this._createDataNode(t);i&&e.appendChild(i)}}}_createDataNode(e){if("group"===e.type){const t=document.createElement("nile-context-menu-group");e.name&&(t.label=e.name);for(const i of e.data??[])t.appendChild(this._createItemNode(i));return t}return null}_createItemNode(e){const t=document.createElement("nile-context-menu-item");if(e.id&&(t.id=e.id),t.value=e.value??e.id??"",e.disabled&&(t.disabled=!0),e.open&&(t.open=!0),e.icon){const i=document.createElement("nile-glyph");i.setAttribute("slot","icon"),i.setAttribute("name",e.icon),e.iconSet&&i.setAttribute("set",e.iconSet),e.iconSize&&i.setAttribute("size",e.iconSize),e.iconMethod&&i.setAttribute("method",e.iconMethod),e.iconColor&&i.setAttribute("color",e.iconColor),t.appendChild(i)}if(t.appendChild(document.createTextNode(e.label)),e.submenu&&e.submenu.length>0){const i=document.createElement("nile-context-submenu");for(const t of e.submenu){const e=this._createDataNode(t);e&&i.appendChild(e)}t.appendChild(i)}return t}_parseChildren(){const e=this._menuContainerRef??this,t=Array.from(e.querySelectorAll(pv));this._items=t.filter((t=>!this._isInsideDescendantSubmenu(t,e)))}_isInsideDescendantSubmenu(e,t){let i=e.parentElement;for(;i&&i!==t;){if(i.tagName.toLowerCase()===Tv)return!0;i=i.parentElement}return!1}get menuItems(){return this._items}getItemByValue(e){return this._items.find((t=>t.value===e))}get isOpen(){return this._open}openAt(e){if(!this._open){for(const e of yv._openInstances)e!==this&&e.close("programmatic");this._previouslyFocused=document.activeElement,this._openContext={x:e.x,y:e.y,target:e.target??null,originalEvent:e.originalEvent??null},this._ensureProxy(),this._positionProxyAt(e.x,e.y),this._open=!0,this.open=!0,yv._openInstances.add(this),document.addEventListener("pointerdown",this._onOutsidePointer,!0),document.addEventListener("keydown",this._onKeydown,!0),this._pinned&&window.addEventListener("resize",this._onPinnedReposition),requestAnimationFrame((()=>{this._open&&window.addEventListener("scroll",this._onScroll,!0),requestAnimationFrame((()=>this._openPinnedSubmenus()))})),this.emit("nile-change",{type:"open",...this._openContext})}}close(e="programmatic"){if(!this._open)return;this._open=!1,this.open=!1,this._pinned=!1,this._openContext=null,yv._openInstances.delete(this);const t=this._menuContainerRef?.querySelectorAll(Tv);t?.forEach((e=>e.closeSubmenu?.())),document.removeEventListener("pointerdown",this._onOutsidePointer,!0),document.removeEventListener("keydown",this._onKeydown,!0),window.removeEventListener("scroll",this._onScroll,!0),window.removeEventListener("resize",this._onPinnedReposition);const i=document.activeElement;(i===this||this._items.some((e=>e===i||e.shadowRoot?.contains(i))))&&this._previouslyFocused?.focus?.(),this._previouslyFocused=null,this.emit("nile-change",{type:"close",reason:e})}_enabledItems(){return this._items.filter((e=>!e.disabled))}_getFocusedItem(){const e=document.activeElement;for(const t of this._items)if(t===e||t.shadowRoot?.contains(e))return t;return null}_getFocusedItemAnyLevel(){let e=document.activeElement;for(;e&&e.tagName?.toLowerCase()!==pv;){const t=e.getRootNode();e=t instanceof ShadowRoot?t.host:e.parentElement}if(!e)return{item:null,container:null};const t=e.closest(`.${Av}`);return{item:e,container:t}}_enabledItemsIn(e){return Array.from(e.querySelectorAll(pv)).filter((t=>!t.disabled&&!this._isInsideDescendantSubmenu(t,e)))}_focusFirstEnabled(){const e=this._enabledItems();e[0]?.focus()}_moveFocus(e){const{item:t,container:i}=this._getFocusedItemAnyLevel(),n=i??this._menuContainerRef??this,o=this._enabledItemsIn(n);if(0===o.length)return;const M=t?o.indexOf(t):-1;o[((M+e)%o.length+o.length)%o.length].focus()}_findSubmenuOwning(e){const t=window.customElements.get(Tv);return t?.findByContainer?.(e)??null}_stop(e){e.stopPropagation()}_openPinnedSubmenus(){if(this._open&&this._menuContainerRef)for(const e of this._items){if(!e.open||e.disabled)continue;const t=e.querySelector(`:scope > ${Tv}`);t?.openSubmenu?.()}}_selectItem(e){const t={id:e.id,value:e.value,name:(e.textContent??"").trim(),target:this._openContext?.target??null,originalEvent:this._openContext?.originalEvent??null};try{e.onSelect?.(t)}catch(e){console.error("[nile-context-menu] onSelect callback threw:",e)}this.emit("nile-change",{type:"click",...t}),this.close("select")}render(){return _`
|
|
21278
|
+
`]}get _pinnedOpen(){return!(!this._parentItem?.open||this._parentItem.disabled)}connectedCallback(){super.connectedCallback();let e=this.parentElement;for(;e&&e.tagName.toLowerCase()!==jv;)e=e.parentElement;this._parentItem=e,this._ensureProxy(),this._parentItem&&(this._parentItem.setSubmenuExpanded?.(!1),this._parentItem.addEventListener("mouseenter",this._onParentEnter),this._parentItem.addEventListener("mouseleave",this._onParentLeave),this._parentItem.addEventListener("click",this._onParentClick,!0),this._parentObserver=new MutationObserver((()=>{this._pinnedOpen?this._isParentVisible()&&this.openSubmenu():this._open&&this.closeSubmenu()})),this._parentObserver.observe(this._parentItem,{attributes:!0,attributeFilter:["open"]})),this._ensureBodyPanel()}_isParentVisible(){const e=this._parentItem?.getBoundingClientRect();return!!e&&e.width>0&&e.height>0}_ensureProxy(){if(this._proxyEl)return;const e=document.createElement("div");e.id=this._proxyId,e.setAttribute("aria-hidden","true"),e.style.cssText="position: fixed; top: 0; left: 0; width: 0; height: 0; pointer-events: none;",document.body.appendChild(e),this._proxyEl=e}_syncProxyToParent(){if(!this._proxyEl||!this._parentItem)return;const e=this._parentItem.getBoundingClientRect();this._pinnedOpen?(this._proxyEl.style.position="absolute",this._proxyEl.style.left=`${e.left+window.scrollX}px`,this._proxyEl.style.top=`${e.top+window.scrollY}px`):(this._proxyEl.style.position="fixed",this._proxyEl.style.left=`${e.left}px`,this._proxyEl.style.top=`${e.top}px`),this._proxyEl.style.width=`${e.width}px`,this._proxyEl.style.height=`${e.height}px`}disconnectedCallback(){super.disconnectedCallback(),this._parentItem&&(this._parentItem.removeEventListener("mouseenter",this._onParentEnter),this._parentItem.removeEventListener("mouseleave",this._onParentLeave),this._parentItem.removeEventListener("click",this._onParentClick,!0)),this._parentObserver?.disconnect(),this._parentObserver=void 0,this._clearTimers(),this._open&&this.closeSubmenu(),this._teardownBodyArtifacts(),hv.openStack=hv.openStack.filter((e=>e!==this))}_teardownBodyArtifacts(){const e=this._menuContainerRef;if(e)for(e.removeEventListener("click",this._onMenuClick),e.removeEventListener("mouseover",this._onMenuMouseOver),e.removeEventListener("mouseenter",this._onPanelEnter),e.removeEventListener("mouseleave",this._onPanelLeave),e.removeEventListener("nile-change",this._onNestedSelect);e.firstChild;)this.appendChild(e.firstChild);this._floatingPanelEl?.remove(),this._floatingPanelEl=void 0,this._menuContainerRef=null,this._setupDone=!1,this._proxyEl?.remove(),this._proxyEl=void 0}_ensureBodyPanel(){if(this._setupDone)return;const e=document.createElement("nile-floating-panel");e.setAttribute("for",this._proxyId),e.setAttribute("trigger","manual"),e.setAttribute("placement","right-start"),e.panelClass="nile-context-menu-panel",e.zIndex=this.zIndex,e.interactive=!0,e.hideOnClick=!1,e.closeOnEscape=!1,e.arrow="none",e.distance=0;const t=document.createElement("div");t.className="nile-context-menu__menu",t.setAttribute("role","menu"),e.appendChild(t),document.body.appendChild(e),this._floatingPanelEl=e,this._menuContainerRef=t,t.addEventListener("click",this._onMenuClick),t.addEventListener("mouseover",this._onMenuMouseOver),t.addEventListener("mouseenter",this._onPanelEnter),t.addEventListener("mouseleave",this._onPanelLeave),t.addEventListener("nile-change",this._onNestedSelect),this._relocateLightChildren(),this._setupDone=!0}firstUpdated(){this._relocateLightChildren()}_relocateLightChildren(){if(this._menuContainerRef)for(const e of Array.from(this.children))this._menuContainerRef.appendChild(e)}_clearTimers(){null!=this._openTimer&&(clearTimeout(this._openTimer),this._openTimer=void 0),null!=this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=void 0)}openSubmenu(){this._open||this._parentItem?.disabled||(this._closeSiblingSubmenus(),this._ensureProxy(),this._ensureBodyPanel(),this._syncProxyToParent(),this._open=!0,this._floatingPanelEl&&(this._floatingPanelEl.addEventListener("nile-after-show",(()=>{this._open&&this._openPinnedDescendants()}),{once:!0}),this._floatingPanelEl.open=!0),hv.openStack.push(this),window.addEventListener("scroll",this._onReposition,!0),window.addEventListener("resize",this._onReposition),requestAnimationFrame((()=>requestAnimationFrame((()=>{this._open&&this._openPinnedDescendants()})))),this._parentItem?.setSubmenuExpanded?.(!0))}_openPinnedDescendants(){if(!this._menuContainerRef)return;const e=Array.from(this._menuContainerRef.querySelectorAll(jv));for(const t of e){if(!this._isDirectChildItem(t))continue;if(!t.open||t.disabled)continue;const e=t.querySelector(`:scope > ${Iv}`);e?.openSubmenu()}}_isDirectChildItem(e){let t=e.parentElement;for(;t&&t!==this._menuContainerRef;){if(t.tagName.toLowerCase()===Iv)return!1;t=t.parentElement}return!0}closeSubmenu(){if(this._open){for(const e of[...hv.openStack])e!==this&&this._menuContainerRef?.contains(e)&&e.closeSubmenu();this._open=!1,this._floatingPanelEl&&(this._floatingPanelEl.open=!1),window.removeEventListener("scroll",this._onReposition,!0),window.removeEventListener("resize",this._onReposition),hv.openStack=hv.openStack.filter((e=>e!==this)),this._clearTimers(),this._parentItem?.setSubmenuExpanded?.(!1)}}get isOpen(){return this._open}static findByContainer(e){for(const t of hv.openStack)if(t._menuContainerRef===e)return t;return null}get parentItem(){return this._parentItem}focusFirstItem(){if(!this._menuContainerRef)return;const e=Array.from(this._menuContainerRef.querySelectorAll(jv));for(const t of e)if(this._isDirectChildItem(t)&&!t.disabled)return void t.focus()}_closeSiblingSubmenus(){const e=this._parentLevel();for(const t of[...hv.openStack])t!==this&&(t._pinnedOpen||t._parentLevel()===e&&t.closeSubmenu())}_parentLevel(){const e=this._parentItem;return e?e.parentElement?.closest(".nile-context-menu__menu")??null:null}render(){return _``}};var pv;yv.openStack=[],e([ue({attribute:!0,type:Number,reflect:!0})],yv.prototype,"zIndex",void 0),e([De()],yv.prototype,"_open",void 0),yv=hv=e([ge("nile-context-submenu")],yv);const Tv="nile-context-menu-item",Av="nile-context-submenu",Ov="nile-context-menu__menu",xv=["value","disabled"];let Lv=0,mv=pv=class extends Fe{constructor(){super(...arguments),this.for="",this.trigger="right",this.skipOn="",this.zIndex=9999,this.open=!1,this.items=[],this._items=[],this._open=!1,this._pinned=!1,this._openContext=null,this._targetEl=null,this._previouslyFocused=null,this._proxyId="nile-context-menu-anchor-"+ ++Lv,this._wasDataMode=!1,this._onPinnedReposition=()=>{if(!this._open||!this._pinned||!this._targetEl)return;const e=this._targetEl.getBoundingClientRect();this._positionProxyAt(e.left,e.bottom)},this._menuContainerRef=null,this._onKeydown=e=>{if(this._open)switch(e.key){case"Escape":return e.preventDefault(),void this.close("escape");case"Tab":return void this.close("programmatic");case"ArrowDown":return e.preventDefault(),void this._moveFocus(1);case"ArrowUp":return e.preventDefault(),void this._moveFocus(-1);case"ArrowRight":{const{item:t}=this._getFocusedItemAnyLevel(),i=t?.querySelector(`:scope > ${Av}`);if(!i)return;return e.preventDefault(),i.openSubmenu?.(),void requestAnimationFrame((()=>{i.focusFirstItem?.()}))}case"ArrowLeft":{const{item:t,container:i}=this._getFocusedItemAnyLevel();if(!t||!i)return;const n=this._findSubmenuOwning(i);if(!n)return;return e.preventDefault(),n.parentItem?.open||n.closeSubmenu?.(),void n.parentItem?.focus()}case"Enter":case" ":{e.preventDefault();const{item:t}=this._getFocusedItemAnyLevel();if(!t||t.disabled)return;const i=t.querySelector(`:scope > ${Av}`);return i?(i.openSubmenu?.(),void requestAnimationFrame((()=>{const e=i.shadowRoot?.querySelector(`.${Ov}`),t=e?this._enabledItemsIn(e)[0]:void 0;t?.focus()}))):void this._selectItem(t)}}},this._onScroll=e=>{if(!this._open)return;if(this._pinned)return void this._onPinnedReposition();const t=e.composedPath();if(!this._menuContainerRef||!t.includes(this._menuContainerRef)){for(const e of t)if(e instanceof HTMLElement&&e.classList?.contains(Ov))return;this.close("programmatic")}},this._onOutsidePointer=e=>{if(!this._open)return;const t=e.composedPath();if(!this._menuContainerRef||!t.includes(this._menuContainerRef)){for(const e of t)if(e instanceof HTMLElement&&e.classList?.contains(Ov))return;this.close("outside-click")}},this._onDescendantSelect=e=>{"click"===e.detail?.type&&this.close("select")},this._onPanelShown=e=>{e.stopPropagation(),this._openPinnedSubmenus()},this._onMenuMouseOver=e=>{const t=e.composedPath().find((e=>e instanceof HTMLElement&&e.tagName.toLowerCase()===Tv));t&&!t.disabled&&t.focus()},this._onMenuClick=e=>{const t=e.composedPath().find((e=>e instanceof HTMLElement&&e.tagName.toLowerCase()===Tv));t&&!t.disabled&&(t.querySelector(`:scope > ${Av}`)||this._selectItem(t))}}static get styles(){return[gv]}get _isDataMode(){return Array.isArray(this.items)&&this.items.length>0}connectedCallback(){super.connectedCallback(),this._ensureProxy(),this._resolveTarget(),this._attachTriggers(),this._lightObserver=new MutationObserver((()=>{this._isDataMode||this._relocateLightChildren()})),this._lightObserver.observe(this,{childList:!0}),this.open&&!this._open&&this.updateComplete.then((()=>{this.isConnected&&this.open&&!this._open&&(this._pinned=!0,this._openAtTarget())}))}updated(e){super.updated(e),(e.has("for")||e.has("trigger")||e.has("skipOn"))&&this._open&&this.close("programmatic"),e.has("for")?(this._resolveTarget(),this._attachTriggers()):(e.has("trigger")||e.has("skipOn"))&&this._attachTriggers(),e.has("items")&&this._menuContainerRef&&(this._isDataMode?(this._renderDataItems(),this._wasDataMode=!0):this._wasDataMode&&(this._renderDataItems(),this._wasDataMode=!1)),e.has("open")&&(this.open&&!this._open?(this._pinned=!0,this._openAtTarget()):!this.open&&this._open&&this.close("programmatic"))}_openAtTarget(){const e=this._targetEl?.getBoundingClientRect();this.openAt({x:e?e.left:0,y:e?e.bottom:0,target:this._targetEl??void 0})}_resolveTarget(){const e=this.for?.trim();if(!e)return void(this._targetEl=null);const t=this.getRootNode()??document;/^[#.\[:]/.test(e)?this._targetEl=t.querySelector(e):this._targetEl="getElementById"in t?t.getElementById(e):document.getElementById(e)}get targetElement(){return this._targetEl}_attachTriggers(){this._detachTriggers?.(),this._detachTriggers=void 0;const e=this.trigger;if("manual"===e)return;const t=[];if("global"===e){const e=this.skipOn?.trim()??"",i=t=>!(!t||!e)&&!!t.closest(e),n=e=>{const t=e;i(t.target)||(t.preventDefault(),this._open||this.openAt({x:t.clientX,y:t.clientY,target:t.target??void 0,originalEvent:t}))};return window.addEventListener("contextmenu",n,!0),t.push((()=>window.removeEventListener("contextmenu",n,!0))),void(this._detachTriggers=()=>t.forEach((e=>e())))}const i=this._targetEl;if(!i)return;const n="left"===e||"both"===e;if("right"===e||"both"===e){const e=e=>{const t=e;t.preventDefault(),this.openAt({x:t.clientX,y:t.clientY,target:i,originalEvent:t})};i.addEventListener("contextmenu",e),t.push((()=>i.removeEventListener("contextmenu",e)))}if(n){const e=e=>{const t=e;this.openAt({x:t.clientX,y:t.clientY,target:i,originalEvent:t})};i.addEventListener("click",e),t.push((()=>i.removeEventListener("click",e)))}0!==t.length&&(this._detachTriggers=()=>t.forEach((e=>e())))}disconnectedCallback(){super.disconnectedCallback(),pv._openInstances.delete(this),this._open=!1,this._detachTriggers?.(),this._detachTriggers=void 0,this._lightObserver?.disconnect(),this._lightObserver=void 0,this._menuObserver?.disconnect(),this._menuObserver=void 0,this._menuContainerRef?.removeEventListener("click",this._onMenuClick),this._menuContainerRef?.removeEventListener("mouseover",this._onMenuMouseOver),this._menuContainerRef?.removeEventListener("nile-change",this._onDescendantSelect),document.removeEventListener("pointerdown",this._onOutsidePointer,!0),document.removeEventListener("keydown",this._onKeydown,!0),window.removeEventListener("scroll",this._onScroll,!0),window.removeEventListener("resize",this._onPinnedReposition),this._proxyEl?.remove(),this._proxyEl=void 0}firstUpdated(){this._menuContainerRef=this.renderRoot.querySelector(".nile-context-menu__menu"),this._isDataMode?(this._renderDataItems(),this._wasDataMode=!0):this._relocateLightChildren(),this._menuContainerRef&&(this._menuObserver=new MutationObserver((()=>this._parseChildren())),this._menuObserver.observe(this._menuContainerRef,{childList:!0,subtree:!0,attributes:!0,attributeFilter:xv}),this._menuContainerRef.addEventListener("click",this._onMenuClick),this._menuContainerRef.addEventListener("mouseover",this._onMenuMouseOver),this._menuContainerRef.addEventListener("nile-change",this._onDescendantSelect)),this._parseChildren()}_ensureProxy(){if(this._proxyEl)return;const e=document.createElement("div");e.id=this._proxyId,e.setAttribute("aria-hidden","true"),e.style.cssText="position: fixed; top: 0; left: 0; width: 0; height: 0; pointer-events: none;",document.body.appendChild(e),this._proxyEl=e}_positionProxyAt(e,t){if(this._proxyEl){if(this._pinned&&this._targetEl){const e=this._targetEl.getBoundingClientRect();return this._proxyEl.style.position="absolute",this._proxyEl.style.left=`${e.left+window.scrollX}px`,this._proxyEl.style.top=`${e.top+window.scrollY}px`,this._proxyEl.style.width=`${e.width}px`,void(this._proxyEl.style.height=`${e.height}px`)}this._proxyEl.style.position="fixed",this._proxyEl.style.left=`${e}px`,this._proxyEl.style.top=`${t}px`,this._proxyEl.style.width="0",this._proxyEl.style.height="0"}}_relocateLightChildren(){if(!this._menuContainerRef)return;const e=Array.from(this.children);if(0!==e.length)for(const t of e)this._menuContainerRef.appendChild(t)}_renderDataItems(){const e=this._menuContainerRef;if(e){for(;e.firstChild;)e.removeChild(e.firstChild);for(const t of this.items){const i=this._createDataNode(t);i&&e.appendChild(i)}}}_createDataNode(e){if("group"===e.type){const t=document.createElement("nile-context-menu-group");e.name&&(t.label=e.name);for(const i of e.data??[])t.appendChild(this._createItemNode(i));return t}return null}_createItemNode(e){const t=document.createElement("nile-context-menu-item");if(e.id&&(t.id=e.id),t.value=e.value??e.id??"",e.disabled&&(t.disabled=!0),e.open&&(t.open=!0),e.icon){const i=document.createElement("nile-glyph");i.setAttribute("slot","icon"),i.setAttribute("name",e.icon),e.iconSet&&i.setAttribute("set",e.iconSet),e.iconSize&&i.setAttribute("size",e.iconSize),e.iconMethod&&i.setAttribute("method",e.iconMethod),e.iconColor&&i.setAttribute("color",e.iconColor),t.appendChild(i)}if(t.appendChild(document.createTextNode(e.label)),e.submenu&&e.submenu.length>0){const i=document.createElement("nile-context-submenu");for(const t of e.submenu){const e=this._createDataNode(t);e&&i.appendChild(e)}t.appendChild(i)}return t}_parseChildren(){const e=this._menuContainerRef??this,t=Array.from(e.querySelectorAll(Tv));this._items=t.filter((t=>!this._isInsideDescendantSubmenu(t,e)))}_isInsideDescendantSubmenu(e,t){let i=e.parentElement;for(;i&&i!==t;){if(i.tagName.toLowerCase()===Av)return!0;i=i.parentElement}return!1}get menuItems(){return this._items}getItemByValue(e){return this._items.find((t=>t.value===e))}get isOpen(){return this._open}openAt(e){if(!this._open){for(const e of pv._openInstances)e!==this&&e.close("programmatic");this._previouslyFocused=document.activeElement,this._openContext={x:e.x,y:e.y,target:e.target??null,originalEvent:e.originalEvent??null},this._ensureProxy(),this._positionProxyAt(e.x,e.y),this._open=!0,this.open=!0,pv._openInstances.add(this),document.addEventListener("pointerdown",this._onOutsidePointer,!0),document.addEventListener("keydown",this._onKeydown,!0),this._pinned&&window.addEventListener("resize",this._onPinnedReposition),requestAnimationFrame((()=>{this._open&&window.addEventListener("scroll",this._onScroll,!0),requestAnimationFrame((()=>this._openPinnedSubmenus()))})),this.emit("nile-change",{type:"open",...this._openContext})}}close(e="programmatic"){if(!this._open)return;this._open=!1,this.open=!1,this._pinned=!1,this._openContext=null,pv._openInstances.delete(this);const t=this._menuContainerRef?.querySelectorAll(Av);t?.forEach((e=>e.closeSubmenu?.())),document.removeEventListener("pointerdown",this._onOutsidePointer,!0),document.removeEventListener("keydown",this._onKeydown,!0),window.removeEventListener("scroll",this._onScroll,!0),window.removeEventListener("resize",this._onPinnedReposition);const i=document.activeElement;(i===this||this._items.some((e=>e===i||e.shadowRoot?.contains(i))))&&this._previouslyFocused?.focus?.(),this._previouslyFocused=null,this.emit("nile-change",{type:"close",reason:e})}_enabledItems(){return this._items.filter((e=>!e.disabled))}_getFocusedItem(){const e=document.activeElement;for(const t of this._items)if(t===e||t.shadowRoot?.contains(e))return t;return null}_getFocusedItemAnyLevel(){let e=document.activeElement;for(;e&&e.tagName?.toLowerCase()!==Tv;){const t=e.getRootNode();e=t instanceof ShadowRoot?t.host:e.parentElement}if(!e)return{item:null,container:null};const t=e.closest(`.${Ov}`);return{item:e,container:t}}_enabledItemsIn(e){return Array.from(e.querySelectorAll(Tv)).filter((t=>!t.disabled&&!this._isInsideDescendantSubmenu(t,e)))}_focusFirstEnabled(){const e=this._enabledItems();e[0]?.focus()}_moveFocus(e){const{item:t,container:i}=this._getFocusedItemAnyLevel(),n=i??this._menuContainerRef??this,o=this._enabledItemsIn(n);if(0===o.length)return;const M=t?o.indexOf(t):-1;o[((M+e)%o.length+o.length)%o.length].focus()}_findSubmenuOwning(e){const t=window.customElements.get(Av);return t?.findByContainer?.(e)??null}_stop(e){e.stopPropagation()}_openPinnedSubmenus(){if(this._open&&this._menuContainerRef)for(const e of this._items){if(!e.open||e.disabled)continue;const t=e.querySelector(`:scope > ${Av}`);t?.openSubmenu?.()}}_selectItem(e){const t={id:e.id,value:e.value,name:(e.textContent??"").trim(),target:this._openContext?.target??null,originalEvent:this._openContext?.originalEvent??null};try{e.onSelect?.(t)}catch(e){console.error("[nile-context-menu] onSelect callback threw:",e)}this.emit("nile-change",{type:"click",...t}),this.close("select")}render(){return _`
|
|
21235
21279
|
<nile-floating-panel
|
|
21236
21280
|
for=${this._proxyId}
|
|
21237
21281
|
trigger="manual"
|
|
@@ -21255,7 +21299,7 @@ const qk="important",Kk=" !"+qk,ev=Ae(class extends Oe{constructor(e){if(super(e
|
|
|
21255
21299
|
>
|
|
21256
21300
|
<div class="nile-context-menu__menu" role="menu"></div>
|
|
21257
21301
|
</nile-floating-panel>
|
|
21258
|
-
`}};
|
|
21302
|
+
`}};mv._openInstances=new Set,e([ue({attribute:!0,type:String,reflect:!0})],mv.prototype,"for",void 0),e([ue({attribute:!0,type:String,reflect:!0})],mv.prototype,"trigger",void 0),e([ue({attribute:!0,type:String,reflect:!0})],mv.prototype,"skipOn",void 0),e([ue({attribute:!0,type:Number,reflect:!0})],mv.prototype,"zIndex",void 0),e([ue({attribute:!0,type:Boolean,reflect:!0})],mv.prototype,"open",void 0),e([ue({attribute:!1})],mv.prototype,"items",void 0),e([he("nile-floating-panel")],mv.prototype,"_floatingPanel",void 0),e([De()],mv.prototype,"_items",void 0),e([De()],mv.prototype,"_open",void 0),mv=pv=e([ge("nile-context-menu")],mv);const Sv=r`
|
|
21259
21303
|
:host {
|
|
21260
21304
|
font-family: var(--nile-font-family-sans-serif, var(--ng-font-family-body));
|
|
21261
21305
|
}
|
|
@@ -21282,7 +21326,7 @@ const qk="important",Kk=" !"+qk,ev=Ae(class extends Oe{constructor(e){if(super(e
|
|
|
21282
21326
|
:host([disabled]) .item-header .body-content .header-text {
|
|
21283
21327
|
color: var(--nile-colors-neutral-500, var(--ng-colors-text-disabled));
|
|
21284
21328
|
}
|
|
21285
|
-
`;let
|
|
21329
|
+
`;let wv=class extends Fe{constructor(){super(...arguments),this.active=!1,this.disabled=!1}static get styles(){return[Sv]}render(){return _`
|
|
21286
21330
|
<div class="item-header" part="item-header">
|
|
21287
21331
|
<div class="prefix-content" part="prefix-content">
|
|
21288
21332
|
<slot name="prefix"></slot>
|
|
@@ -21297,7 +21341,7 @@ const qk="important",Kk=" !"+qk,ev=Ae(class extends Oe{constructor(e){if(super(e
|
|
|
21297
21341
|
<slot name="suffix"></slot>
|
|
21298
21342
|
</div>
|
|
21299
21343
|
</div>
|
|
21300
|
-
`}};e([ue({type:Boolean,reflect:!0,attribute:!0})],
|
|
21344
|
+
`}};e([ue({type:Boolean,reflect:!0,attribute:!0})],wv.prototype,"active",void 0),e([ue({type:Boolean,reflect:!0,attribute:!0})],wv.prototype,"disabled",void 0),wv=e([ge("nile-inline-sidebar-item-header")],wv);const Ev=r`
|
|
21301
21345
|
:host {
|
|
21302
21346
|
display: block;
|
|
21303
21347
|
min-width: 0;
|
|
@@ -21349,7 +21393,7 @@ const qk="important",Kk=" !"+qk,ev=Ae(class extends Oe{constructor(e){if(super(e
|
|
|
21349
21393
|
:host([disabled]) .body-content {
|
|
21350
21394
|
color: var(--nile-colors-neutral-300, var(--ng-colors-text-disabled));
|
|
21351
21395
|
}
|
|
21352
|
-
`;let
|
|
21396
|
+
`;let bv=class extends Fe{constructor(){super(...arguments),this.lines=2,this.content="",this.showTooltip=!1,this.isTruncated=!1,this.disabled=!1,this.active=!1}static get styles(){return[Ev]}firstUpdated(){this.checkTruncation(),this.bodyContentEl&&(this.resizeObserver=new ResizeObserver((()=>this.checkTruncation())),this.resizeObserver.observe(this.bodyContentEl))}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.disconnect()}checkTruncation(){if(this.bodyContentEl){const e=this.bodyContentEl.scrollHeight>this.bodyContentEl.clientHeight;e!==this.isTruncated&&(this.isTruncated=e)}}get contentTemplate(){const e=_`<div class="body-text" part="body-text">${this.content}</div>`;return this.isTruncated&&this.showTooltip?_`<nile-lite-tooltip content=${this.content} hoist>${e}</nile-lite-tooltip>`:e}render(){return _`
|
|
21353
21397
|
<div class="item-body" part="item-body">
|
|
21354
21398
|
<div class="prefix-content" part="prefix-content">
|
|
21355
21399
|
<slot name="prefix"></slot>
|
|
@@ -21361,20 +21405,20 @@ const qk="important",Kk=" !"+qk,ev=Ae(class extends Oe{constructor(e){if(super(e
|
|
|
21361
21405
|
<slot name="suffix"></slot>
|
|
21362
21406
|
</div>
|
|
21363
21407
|
</div>
|
|
21364
|
-
`}};e([ue({type:Number,reflect:!0})],
|
|
21408
|
+
`}};e([ue({type:Number,reflect:!0})],bv.prototype,"lines",void 0),e([ue({type:String,reflect:!0})],bv.prototype,"content",void 0),e([ue({type:Boolean,reflect:!0})],bv.prototype,"showTooltip",void 0),e([De()],bv.prototype,"isTruncated",void 0),e([he(".body-content")],bv.prototype,"bodyContentEl",void 0),e([ue({type:Boolean,reflect:!0,attribute:!0})],bv.prototype,"disabled",void 0),e([ue({type:Boolean,reflect:!0,attribute:!0})],bv.prototype,"active",void 0),bv=e([ge("nile-inline-sidebar-item-body")],bv);
|
|
21365
21409
|
/**
|
|
21366
21410
|
* @license
|
|
21367
21411
|
* Copyright 2021 Google LLC
|
|
21368
21412
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
21369
21413
|
*/
|
|
21370
|
-
class
|
|
21414
|
+
class kv{constructor(e){this._map=new Map,this._roundAverageSize=!1,this.totalSize=0,!0===e?.roundAverageSize&&(this._roundAverageSize=!0)}set(e,t){const i=this._map.get(e)||0;this._map.set(e,t),this.totalSize+=t-i}get averageSize(){if(this._map.size>0){const e=this.totalSize/this._map.size;return this._roundAverageSize?Math.round(e):e}return 0}getSize(e){return this._map.get(e)}clear(){this._map.clear(),this.totalSize=0}}
|
|
21371
21415
|
/**
|
|
21372
21416
|
* @license
|
|
21373
21417
|
* Copyright 2021 Google LLC
|
|
21374
21418
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
21375
|
-
*/function
|
|
21419
|
+
*/function vv(e){return"horizontal"===e?"width":"height"}class fv{_getDefaultConfig(){return{direction:"vertical"}}constructor(e,t){this._latestCoords={left:0,top:0},this._direction=null,this._viewportSize={width:0,height:0},this.totalScrollSize={width:0,height:0},this.offsetWithinScroller={left:0,top:0},this._pendingReflow=!1,this._pendingLayoutUpdate=!1,this._pin=null,this._firstVisible=0,this._lastVisible=0,this._physicalMin=0,this._physicalMax=0,this._first=-1,this._last=-1,this._sizeDim="height",this._secondarySizeDim="width",this._positionDim="top",this._secondaryPositionDim="left",this._scrollPosition=0,this._scrollError=0,this._items=[],this._scrollSize=1,this._overhang=1e3,this._hostSink=e,Promise.resolve().then((()=>this.config=t||this._getDefaultConfig()))}set config(e){Object.assign(this,Object.assign({},this._getDefaultConfig(),e))}get config(){return{direction:this.direction}}get items(){return this._items}set items(e){this._setItems(e)}_setItems(e){e!==this._items&&(this._items=e,this._scheduleReflow())}get direction(){return this._direction}set direction(e){(e="horizontal"===e?e:"vertical")!==this._direction&&(this._direction=e,this._sizeDim="horizontal"===e?"width":"height",this._secondarySizeDim="horizontal"===e?"height":"width",this._positionDim="horizontal"===e?"left":"top",this._secondaryPositionDim="horizontal"===e?"top":"left",this._triggerReflow())}get viewportSize(){return this._viewportSize}set viewportSize(e){const{_viewDim1:t,_viewDim2:i}=this;Object.assign(this._viewportSize,e),i!==this._viewDim2?this._scheduleLayoutUpdate():t!==this._viewDim1&&this._checkThresholds()}get viewportScroll(){return this._latestCoords}set viewportScroll(e){Object.assign(this._latestCoords,e);const t=this._scrollPosition;this._scrollPosition=this._latestCoords[this._positionDim];Math.abs(t-this._scrollPosition)>=1&&this._checkThresholds()}reflowIfNeeded(e=!1){(e||this._pendingReflow)&&(this._pendingReflow=!1,this._reflow())}set pin(e){this._pin=e,this._triggerReflow()}get pin(){if(null!==this._pin){const{index:e,block:t}=this._pin;return{index:Math.max(0,Math.min(e,this.items.length-1)),block:t}}return null}_clampScrollPosition(e){return Math.max(-this.offsetWithinScroller[this._positionDim],Math.min(e,this.totalScrollSize[vv(this.direction)]-this._viewDim1))}unpin(){null!==this._pin&&(this._sendUnpinnedMessage(),this._pin=null)}_updateLayout(){}get _viewDim1(){return this._viewportSize[this._sizeDim]}get _viewDim2(){return this._viewportSize[this._secondarySizeDim]}_scheduleReflow(){this._pendingReflow=!0}_scheduleLayoutUpdate(){this._pendingLayoutUpdate=!0,this._scheduleReflow()}_triggerReflow(){this._scheduleLayoutUpdate(),Promise.resolve().then((()=>this.reflowIfNeeded()))}_reflow(){this._pendingLayoutUpdate&&(this._updateLayout(),this._pendingLayoutUpdate=!1),this._updateScrollSize(),this._setPositionFromPin(),this._getActiveItems(),this._updateVisibleIndices(),this._sendStateChangedMessage()}_setPositionFromPin(){if(null!==this.pin){const e=this._scrollPosition,{index:t,block:i}=this.pin;this._scrollPosition=this._calculateScrollIntoViewPosition({index:t,block:i||"start"})-this.offsetWithinScroller[this._positionDim],this._scrollError=e-this._scrollPosition}}_calculateScrollIntoViewPosition(e){const{block:t}=e,i=Math.min(this.items.length,Math.max(0,e.index)),n=this._getItemPosition(i)[this._positionDim];let o=n;if("start"!==t){const e=this._getItemSize(i)[this._sizeDim];if("center"===t)o=n-.5*this._viewDim1+.5*e;else{const i=n-this._viewDim1+e;if("end"===t)o=i;else{const e=this._scrollPosition;o=Math.abs(e-n)<Math.abs(e-i)?n:i}}}return o+=this.offsetWithinScroller[this._positionDim],this._clampScrollPosition(o)}getScrollIntoViewCoordinates(e){return{[this._positionDim]:this._calculateScrollIntoViewPosition(e)}}_sendUnpinnedMessage(){this._hostSink({type:"unpinned"})}_sendVisibilityChangedMessage(){this._hostSink({type:"visibilityChanged",firstVisible:this._firstVisible,lastVisible:this._lastVisible})}_sendStateChangedMessage(){const e=new Map;if(-1!==this._first&&-1!==this._last)for(let t=this._first;t<=this._last;t++)e.set(t,this._getItemPosition(t));const t={type:"stateChanged",scrollSize:{[this._sizeDim]:this._scrollSize,[this._secondarySizeDim]:null},range:{first:this._first,last:this._last,firstVisible:this._firstVisible,lastVisible:this._lastVisible},childPositions:e};this._scrollError&&(t.scrollError={[this._positionDim]:this._scrollError,[this._secondaryPositionDim]:0},this._scrollError=0),this._hostSink(t)}get _num(){return-1===this._first||-1===this._last?0:this._last-this._first+1}_checkThresholds(){if(0===this._viewDim1&&this._num>0||null!==this._pin)this._scheduleReflow();else{const e=Math.max(0,this._scrollPosition-this._overhang),t=Math.min(this._scrollSize,this._scrollPosition+this._viewDim1+this._overhang);this._physicalMin>e||this._physicalMax<t?this._scheduleReflow():this._updateVisibleIndices({emit:!0})}}_updateVisibleIndices(e){if(-1===this._first||-1===this._last)return;let t=this._first;for(;t<this._last&&Math.round(this._getItemPosition(t)[this._positionDim]+this._getItemSize(t)[this._sizeDim])<=Math.round(this._scrollPosition);)t++;let i=this._last;for(;i>this._first&&Math.round(this._getItemPosition(i)[this._positionDim])>=Math.round(this._scrollPosition+this._viewDim1);)i--;t===this._firstVisible&&i===this._lastVisible||(this._firstVisible=t,this._lastVisible=i,e&&e.emit&&this._sendVisibilityChangedMessage())}}
|
|
21376
21420
|
/**
|
|
21377
21421
|
* @license
|
|
21378
21422
|
* Copyright 2021 Google LLC
|
|
21379
21423
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
21380
|
-
*/function
|
|
21424
|
+
*/function Qv(e){return"horizontal"===e?"marginLeft":"marginTop"}function Cv(e){return"horizontal"===e?"marginRight":"marginBottom"}function Uv(e){return"horizontal"===e?"xOffset":"yOffset"}function Yv(e,t){const i=[e,t].sort();return i[1]<=0?Math.min(...i):i[0]>=0?Math.max(...i):i[0]+i[1]}class Zv{constructor(){this._childSizeCache=new kv,this._marginSizeCache=new kv,this._metricsCache=new Map}update(e,t){const i=new Set;Object.keys(e).forEach((n=>{const o=Number(n);this._metricsCache.set(o,e[o]),this._childSizeCache.set(o,e[o][vv(t)]),i.add(o),i.add(o+1)}));for(const e of i){const i=this._metricsCache.get(e)?.[Qv(t)]||0,n=this._metricsCache.get(e-1)?.[Cv(t)]||0;this._marginSizeCache.set(e,Yv(i,n))}}get averageChildSize(){return this._childSizeCache.averageSize}get totalChildSize(){return this._childSizeCache.totalSize}get averageMarginSize(){return this._marginSizeCache.averageSize}get totalMarginSize(){return this._marginSizeCache.totalSize}getLeadingMarginValue(e,t){return this._metricsCache.get(e)?.[Qv(t)]||0}getChildSize(e){return this._childSizeCache.getSize(e)}getMarginSize(e){return this._marginSizeCache.getSize(e)}clear(){this._childSizeCache.clear(),this._marginSizeCache.clear(),this._metricsCache.clear()}}var Vv=Object.freeze({__proto__:null,FlowLayout:class extends fv{constructor(){super(...arguments),this._itemSize={width:100,height:100},this._physicalItems=new Map,this._newPhysicalItems=new Map,this._metricsCache=new Zv,this._anchorIdx=null,this._anchorPos=null,this._stable=!0,this._measureChildren=!0,this._estimate=!0}get measureChildren(){return this._measureChildren}updateItemSizes(e){this._metricsCache.update(e,this.direction),this._scheduleReflow()}_getPhysicalItem(e){return this._newPhysicalItems.get(e)??this._physicalItems.get(e)}_getSize(e){return this._getPhysicalItem(e)&&this._metricsCache.getChildSize(e)}_getAverageSize(){return this._metricsCache.averageChildSize||this._itemSize[this._sizeDim]}_estimatePosition(e){const t=this._metricsCache;if(-1===this._first||-1===this._last)return t.averageMarginSize+e*(t.averageMarginSize+this._getAverageSize());if(e<this._first){const i=this._first-e;return this._getPhysicalItem(this._first).pos-(t.getMarginSize(this._first-1)||t.averageMarginSize)-(i*t.averageChildSize+(i-1)*t.averageMarginSize)}{const i=e-this._last;return this._getPhysicalItem(this._last).pos+(t.getChildSize(this._last)||t.averageChildSize)+(t.getMarginSize(this._last)||t.averageMarginSize)+i*(t.averageChildSize+t.averageMarginSize)}}_getPosition(e){const t=this._getPhysicalItem(e),{averageMarginSize:i}=this._metricsCache;return 0===e?this._metricsCache.getMarginSize(0)??i:t?t.pos:this._estimatePosition(e)}_calculateAnchor(e,t){return e<=0?0:t>this._scrollSize-this._viewDim1?this.items.length-1:Math.max(0,Math.min(this.items.length-1,Math.floor((e+t)/2/this._delta)))}_getAnchor(e,t){if(0===this._physicalItems.size)return this._calculateAnchor(e,t);if(this._first<0)return this._calculateAnchor(e,t);if(this._last<0)return this._calculateAnchor(e,t);const i=this._getPhysicalItem(this._first),n=this._getPhysicalItem(this._last),o=i.pos;if(n.pos+this._metricsCache.getChildSize(this._last)<e)return this._calculateAnchor(e,t);if(o>t)return this._calculateAnchor(e,t);let M=this._firstVisible-1,r=-1/0;for(;r<e;){r=this._getPhysicalItem(++M).pos+this._metricsCache.getChildSize(M)}return M}_getActiveItems(){0===this._viewDim1||0===this.items.length?this._clearItems():this._getItems()}_clearItems(){this._first=-1,this._last=-1,this._physicalMin=0,this._physicalMax=0;const e=this._newPhysicalItems;this._newPhysicalItems=this._physicalItems,this._newPhysicalItems.clear(),this._physicalItems=e,this._stable=!0}_getItems(){const e=this._newPhysicalItems;let t,i;if(this._stable=!0,null!==this.pin){const{index:e}=this.pin;this._anchorIdx=e,this._anchorPos=this._getPosition(e)}if(t=this._scrollPosition-this._overhang,i=this._scrollPosition+this._viewDim1+this._overhang,i<0||t>this._scrollSize)return void this._clearItems();null!==this._anchorIdx&&null!==this._anchorPos||(this._anchorIdx=this._getAnchor(t,i),this._anchorPos=this._getPosition(this._anchorIdx));let n=this._getSize(this._anchorIdx);void 0===n&&(this._stable=!1,n=this._getAverageSize());const o=this._metricsCache.getMarginSize(this._anchorIdx)??this._metricsCache.averageMarginSize,M=this._metricsCache.getMarginSize(this._anchorIdx+1)??this._metricsCache.averageMarginSize;0===this._anchorIdx&&(this._anchorPos=o),this._anchorIdx===this.items.length-1&&(this._anchorPos=this._scrollSize-M-n);let r=0;for(this._anchorPos+n+M<t&&(r=t-(this._anchorPos+n+M)),this._anchorPos-o>i&&(r=i-(this._anchorPos-o)),r&&(this._scrollPosition-=r,t-=r,i-=r,this._scrollError+=r),e.set(this._anchorIdx,{pos:this._anchorPos,size:n}),this._first=this._last=this._anchorIdx,this._physicalMin=this._anchorPos-o,this._physicalMax=this._anchorPos+n+M;this._physicalMin>t&&this._first>0;){let t=this._getSize(--this._first);void 0===t&&(this._stable=!1,t=this._getAverageSize());let i=this._metricsCache.getMarginSize(this._first);void 0===i&&(this._stable=!1,i=this._metricsCache.averageMarginSize),this._physicalMin-=t;const n=this._physicalMin;if(e.set(this._first,{pos:n,size:t}),this._physicalMin-=i,!1===this._stable&&!1===this._estimate)break}for(;this._physicalMax<i&&this._last<this.items.length-1;){let t=this._getSize(++this._last);void 0===t&&(this._stable=!1,t=this._getAverageSize());let i=this._metricsCache.getMarginSize(this._last);void 0===i&&(this._stable=!1,i=this._metricsCache.averageMarginSize);const n=this._physicalMax;if(e.set(this._last,{pos:n,size:t}),this._physicalMax+=t+i,!this._stable&&!this._estimate)break}const s=this._calculateError();s&&(this._physicalMin-=s,this._physicalMax-=s,this._anchorPos-=s,this._scrollPosition-=s,e.forEach((e=>e.pos-=s)),this._scrollError+=s),this._stable&&(this._newPhysicalItems=this._physicalItems,this._newPhysicalItems.clear(),this._physicalItems=e)}_calculateError(){return 0===this._first?this._physicalMin:this._physicalMin<=0?this._physicalMin-this._first*this._delta:this._last===this.items.length-1?this._physicalMax-this._scrollSize:this._physicalMax>=this._scrollSize?this._physicalMax-this._scrollSize+(this.items.length-1-this._last)*this._delta:0}_reflow(){const{_first:e,_last:t}=this;super._reflow(),(-1===this._first&&-1==this._last||this._first===e&&this._last===t)&&this._resetReflowState()}_resetReflowState(){this._anchorIdx=null,this._anchorPos=null,this._stable=!0}_updateScrollSize(){const{averageMarginSize:e}=this._metricsCache;this._scrollSize=Math.max(1,this.items.length*(e+this._getAverageSize())+e)}get _delta(){const{averageMarginSize:e}=this._metricsCache;return this._getAverageSize()+e}_getItemPosition(e){return{[this._positionDim]:this._getPosition(e),[this._secondaryPositionDim]:0,[Uv(this.direction)]:-(this._metricsCache.getLeadingMarginValue(e,this.direction)??this._metricsCache.averageMarginSize)}}_getItemSize(e){return{[this._sizeDim]:this._getSize(e)||this._getAverageSize(),[this._secondarySizeDim]:this._itemSize[this._secondarySizeDim]}}_viewDim2Changed(){this._metricsCache.clear(),this._scheduleReflow()}}});export{kL as NileAccordion,Vo as NileAutoComplete,Kx as NileAvatar,kt as NileBadge,Dx as NileBreadcrumb,hx as NileBreadcrumbItem,Xe as NileButton,fx as NileButtonFilter,YM as NileButtonToggle,VM as NileButtonToggleGroup,kM as NileCalendar,yx as NileCard,Lx as NileCarousel,Tx as NileCarouselItem,oi as NileCheckbox,ri as NileCheckboxGroup,pM as NileChip,Cx as NileCircularProgressbar,ax as NileCodeEditor,JS as NileColorPicker,qS as NileColorSwatch,zM as NileCombobox,HM as NileContentEditor,mv as NileContextMenu,uv as NileContextMenuGroup,dv as NileContextMenuItem,mM as NileDatePicker,Tk as NileDetail,JM as NileDialog,fL as NileDivider,ii as NileDrawer,fo as NileDropdown,nL as NileEmptyState,wM as NileErrorMessage,qM as NileErrorNotification,_m as NileFilePreview,Sm as NileFileUpload,JL as NileFilterChip,lv as NileFloatingPanel,At as NileFormErrorMessage,Ix as NileFormGroup,pt as NileFormHelpText,dL as NileFormatDate,NS as NileGrid,uS as NileGridBody,zS as NileGridCellItem,pS as NileGridHead,jS as NileGridHeadItem,dS as NileGridRow,qe as NileHeading,ML as NileHero,NL as NileHeroHeader,ke as NileIcon,wt as NileIconButton,BL as NileInlineEdit,fw as NileInlineSidebar,kw as NileInlineSidebarGroup,Cw as NileInlineSidebarItem,bv as NileInlineSidebarItemBody,wv as NileInlineSidebarItemHeader,Yw as NileInlineSidebarPanel,Vw as NileInlineSidebarPanelGroup,gt as NileInput,QM as NileLink,EL as NileList,SL as NileListItem,kn as NileLoader,Lt as NileMenu,So as NileMenuItem,qk as NileNavTab,nv as NileNavTabGroup,rv as NileNavTabPanel,Lo as NileOption,Bm as NileOptionGroup,Ot as NileOtpInput,tL as NilePageHeader,KL as NilePagination,kx as NilePopover,xn as NilePopup,fn as NileProgressBar,$k as NileQrCode,ai as NileRadio,gi as NileRadioGroup,BS as NileRichTextEditor,YL as NileSectionMessage,Oo as NileSelect,ew as NileSideBar,Ow as NileSideBarAction,Ew as NileSideBarActionMenu,Sw as NileSideBarActionMenuItem,rw as NileSideBarExpand,hw as NileSideBarFooter,Iw as NileSideBarFooterItem,Lw as NileSideBarFooterText,aw as NileSideBarGroup,gw as NileSideBarGroupItem,cw as NileSideBarGroupItemIcon,Dw as NileSideBarGroupItemText,iw as NileSideBarHeader,ow as NileSideBarLogo,hk as NileSideBarPanel,Yn as NileSkeletonLoader,En as NileSlideToggle,sm as NileSlider,Cn as NileSpinner,IL as NileSplitPanel,ft as NileStatusLight,lL as NileStepper,sL as NileStepperItem,GM as NileSwitcher,nr as NileTab,er as NileTabGroup,rr as NileTabPanel,FL as NileTable,$x as NileTableBody,Bx as NileTableCellItem,Xx as NileTableHeaderItem,Fx as NileTableRow,Pn as NileTag,AM as NileTextarea,CL as NileTitle,cx as NileToast,VL as NileToolbar,Sn as NileTooltip,LL as NileTree,AL as NileTreeItem,uL as NileVerticalStepperItem,po as NileVirtualSelect,Dk as NileliteTooltip};
|