@ahriknow/lux 0.0.1
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/LICENSE +21 -0
- package/README.md +127 -0
- package/README_zh-CN.md +127 -0
- package/dist/components/lux-button/index.iife.min.js +292 -0
- package/dist/components/lux-button/index.min.js +292 -0
- package/dist/components/lux-code/index.iife.min.js +290 -0
- package/dist/components/lux-code/index.min.js +290 -0
- package/dist/components/lux-dropdown/index.iife.min.js +162 -0
- package/dist/components/lux-dropdown/index.min.js +162 -0
- package/dist/components/lux-example/index.iife.min.js +88 -0
- package/dist/components/lux-example/index.min.js +88 -0
- package/dist/components/lux-icon/index.iife.min.js +22 -0
- package/dist/components/lux-icon/index.min.js +22 -0
- package/dist/components/lux-input/index.iife.min.js +238 -0
- package/dist/components/lux-input/index.min.js +238 -0
- package/dist/components/lux-layout/index.iife.min.js +90 -0
- package/dist/components/lux-layout/index.min.js +90 -0
- package/dist/components/lux-menu/index.iife.min.js +193 -0
- package/dist/components/lux-menu/index.min.js +193 -0
- package/dist/components/lux-scroll/index.iife.min.js +137 -0
- package/dist/components/lux-scroll/index.min.js +137 -0
- package/dist/components/lux-switch/index.iife.min.js +116 -0
- package/dist/components/lux-switch/index.min.js +116 -0
- package/dist/components/lux-table/index.iife.min.js +67 -0
- package/dist/components/lux-table/index.min.js +67 -0
- package/dist/lux.core.min.js +1 -0
- package/dist/lux.i18n.min.js +1 -0
- package/dist/lux.iife.js +1822 -0
- package/dist/lux.iife.js.map +1 -0
- package/dist/lux.iife.min.js +1 -0
- package/dist/lux.js +1792 -0
- package/dist/lux.js.map +1 -0
- package/dist/lux.min.js +1 -0
- package/dist/lux.router.min.js +1 -0
- package/dist/lux.template.min.js +1 -0
- package/dist/lux.theme.min.js +1 -0
- package/dist/themes/dark.css +130 -0
- package/dist/themes/light.css +128 -0
- package/package.json +64 -0
- package/src/components/lux-button/index.js +319 -0
- package/src/components/lux-code/index.js +382 -0
- package/src/components/lux-dropdown/index.js +256 -0
- package/src/components/lux-example/index.js +117 -0
- package/src/components/lux-icon/index.js +180 -0
- package/src/components/lux-input/index.js +363 -0
- package/src/components/lux-layout/index.js +222 -0
- package/src/components/lux-menu/index.js +283 -0
- package/src/components/lux-scroll/index.js +349 -0
- package/src/components/lux-switch/index.js +203 -0
- package/src/components/lux-table/index.js +105 -0
- package/src/core.js +7 -0
- package/src/element.js +477 -0
- package/src/i18n/format.js +108 -0
- package/src/i18n/index.js +102 -0
- package/src/i18n/locale.js +26 -0
- package/src/index.js +22 -0
- package/src/router.js +330 -0
- package/src/template.js +402 -0
- package/src/theme/color.js +148 -0
- package/src/theme/create.js +97 -0
- package/src/theme/index.js +2 -0
- package/src/theme/tokens.js +128 -0
- package/src/themes/dark.css +130 -0
- package/src/themes/light.css +128 -0
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
var LuxMenu=function(){"use strict";const e=Symbol.for("lux-nothing");function t(e,...t){return{_$luxType$:1,strings:e,values:t}}function s(e,...t){return{_$luxType$:3,strings:e,values:t}}function r(e){return e&&void 0!==e._$luxType$}const i=/(?:([@.?][\w-]+)|(ref)|(class))=\s*$/;function n(t,s,i){if(s!==e&&null!=s)if(function(e){return e&&"repeat"===e._type}(s))!function(e,t){const{items:s,keyFn:i,renderFn:n}=t,o=e._repeatState;if(o)for(const e of o.entries)e.span&&e.span.parentNode&&e.span.parentNode.removeChild(e.span);const c=document.createDocumentFragment(),l=[];for(const e of s){const t=i(e),s=n(e),o=document.createElement("span");o.style.display="contents",r(s)?a(s,o):null!=s&&!1!==s&&o.appendChild(document.createTextNode(String(s))),c.appendChild(o),l.push({key:t,result:s,span:o})}e.appendChild(c),e._repeatState={entries:l}}(t,s);else if(r(s))a(s,t);else if(Array.isArray(s)){o(t);for(const e of s)if(r(e)){const s=document.createElement("span");s.style.display="contents",a(e,s),t.appendChild(s)}else e instanceof Node?t.appendChild(e):null!=e&&!1!==e&&t.appendChild(document.createTextNode(String(e)))}else{if(s instanceof Node)return o(t),void t.appendChild(s);1===t.childNodes.length&&t.firstChild.nodeType===Node.TEXT_NODE?t.firstChild.textContent=String(s):(o(t),t.appendChild(document.createTextNode(String(s))))}else o(t)}function o(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function c(t,s){const{element:r,name:i,prefix:n}=t;switch(n){case"@":{const n=t.committedValue,o=null==s||s===e,c=o&&null!=n||s?.capture!==n?.capture||s?.once!==n?.once||s?.passive!==n?.passive,a=!o&&(null==n||c);if(c&&r.removeEventListener(i,t._handler||n,n),a)if("function"==typeof s){const e=t._host||(t._host={handleEvent(e){const s=t.committedValue;if("function"==typeof s){const t=r.getRootNode().host||r;s.call(t,e)}}});t._handler=e,r.addEventListener(i,e)}else if("object"==typeof s&&s?.handleEvent){const e={handleEvent:e=>s.handleEvent.call(s,e)};t._handler=e,r.addEventListener(i,e,{capture:s.capture,once:s.once,passive:s.passive})}t.committedValue=s;break}case".":r[i]=s===e?void 0:s;break;case"?":r.toggleAttribute(i,!!s);break;case"ref":"function"==typeof s&&s(r);break;case"class":if("string"==typeof s)r.className=s;else if("object"==typeof s&&null!=s){const e=r.className||"",t=e?e.split(/\s+/):[];for(const[e,r]of Object.entries(s))if(r)t.includes(e)||t.push(e);else{const s=t.indexOf(e);-1!==s&&t.splice(s,1)}r.className=t.filter(Boolean).join(" ")}break;default:null==s||!1===s?r.removeAttribute(i):r.setAttribute(i,!0===s?"":String(s))}}function a(e,t,s){if(!r(e))return void(t.textContent=e??"");const{strings:o,values:a}=e;if(t._luxActiveParts&&t._luxStrings===o){for(const e of t._luxActiveParts)e.index<a.length&&("child"===e.type?n(e.span,a[e.index]):c(e,a[e.index]));return}const l=document.createElement("template"),h=function(e){const t=[];let s="";for(let r=0;r<e.length;r++)if(s+=e[r],r<e.length-1){const e=s.match(i);if(e){const i=e[1],n=!!e[2],o=!!e[3];let c="",a="";i?(c=i[0],a=i.slice(1)):n?(c="ref",a="ref"):o&&(c="class",a="class");const l=`lux-attr-${r}`;s=s.slice(0,-e[0].length)+`${l}="${a}" `,t.push({type:"attr",name:a,prefix:c,marker:l,index:r})}else{const e=`lux-${r}`;s+=`\x3c!--${e}--\x3e`,t.push({type:"child",marker:e,index:r})}}return{html:s,parts:t}}(o);l.innerHTML=h.html;const d=l.content.cloneNode(!0),p=[];for(const e of h.parts)if("child"===e.type){const t=document.createTreeWalker(d,NodeFilter.SHOW_COMMENT);let s;for(;s=t.nextNode();)if(s.data===e.marker){const t=document.createElement("span");t.style.display="contents",s.parentNode.replaceChild(t,s),n(t,a[e.index]),p.push({type:"child",span:t,index:e.index});break}}else{const t=d.querySelector(`[${e.marker}]`);if(t){t.removeAttribute(e.marker);const s={type:"attr",element:t,name:e.name,prefix:e.prefix,index:e.index,committedValue:void 0};c(s,a[e.index]),p.push(s)}}t.textContent="",t.appendChild(d),t._luxActiveParts=p,t._luxStrings=o}const l=new Set;let h=!1;function d(e){var t;l.add(e),h||(h=!0,t=()=>{h=!1;const e=[...l];l.clear();for(const t of e)t._$performUpdate()},Promise.resolve().then(t))}const p={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?null:JSON.stringify(e);default:return e}},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return Number(e);case Object:case Array:try{return JSON.parse(e)}catch{return null}default:return e}}};class u extends HTMLElement{static properties={};static styles=void 0;static finalized=!1;static elementProperties=new Map;static __prepare(){if(this.hasOwnProperty("elementProperties"))return;const e=Object.getPrototypeOf(this);e.finalize&&e.finalize(),this.elementProperties=new Map(e.elementProperties)}static get observedAttributes(){return this.finalize(),this.__attributeToPropertyMap?[...this.__attributeToPropertyMap.keys()]:[]}static finalize(){if(!this.hasOwnProperty("finalized")){if(this.finalized=!0,this.__prepare(),this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const s of t)this.createProperty(s,e[s])}this.__attributeToPropertyMap=new Map;for(const[e,t]of this.elementProperties){const s=this.__attributeNameForProperty(e,t);void 0!==s&&this.__attributeToPropertyMap.set(s,e)}this.elementStyles=this.styles}}static __attributeNameForProperty(e,t){const s=t.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof e?e.replace(/([A-Z])/g,"-$1").toLowerCase():void 0}static createProperty(e,t={}){if(this.__prepare(),!this.elementProperties.has(e)&&(t.state&&(t={...t,attribute:!1}),this.elementProperties.set(e,t),!t.noAccessor)){const s=Symbol(),r=this.getPropertyDescriptor(e,s,t);void 0!==r&&Object.defineProperty(this.prototype,e,r)}}static getPropertyDescriptor(e,t,s){const{type:r,reflect:i,converter:n}=s;return{get(){return this[t]},set(r){const i=this[t];this[t]=r,this.requestUpdate(e,i,s)},configurable:!0,enumerable:!0}}static _initializers=[];static addInitializer(e){this._initializers=[...this._initializers||[],e]}static shadowRootOptions={mode:"open"};constructor(){super(),this.__updatePending=!1,this.__hasUpdated=!1,this.__controllers=new Set,this.__reflectingProperty=null,this.constructor.hasOwnProperty("finalized")||this.constructor.finalize(),this.__saveInstanceProperties(),this.requestUpdate();for(const e of this.constructor._initializers||[])e(this)}__saveInstanceProperties(){const e=this.constructor.elementProperties;if(e)for(const[t,s]of e)if(!s.noAccessor&&this.hasOwnProperty(t)){const e=this[t];delete this[t],this.__instancePropertyValues=this.__instancePropertyValues||new Map,this.__instancePropertyValues.set(t,e)}}connectedCallback(){this.__controllers.forEach(e=>e.hostConnected?.()),this.constructor.hasOwnProperty("finalized")||this.constructor.finalize();const e=this.constructor.__attributeToPropertyMap;if(e)for(const[t,s]of e){const e=this.getAttribute(t);if(null!==e){const t=this.constructor.elementProperties.get(s);if(t){const r=t.converter?.fromAttribute??p.fromAttribute;this[s]=r(e,t.type)}}}if(this.__instancePropertyValues){for(const[e,t]of this.__instancePropertyValues)this[e]=t;this.__instancePropertyValues=void 0}this.renderRoot,this.__hasUpdated||this.requestUpdate()}disconnectedCallback(){this.__controllers.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){const r=this.constructor.__attributeToPropertyMap?.get(e);if(void 0!==r&&this.__reflectingProperty!==r){const e=this.constructor.elementProperties.get(r);if(e){const t="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:p;this.__reflectingProperty=r;const i=t.fromAttribute(s,e.type);this[r]=i,this.__reflectingProperty=null}}}get renderRoot(){return this._renderRoot||(this._renderRoot=this.createRenderRoot(),this.__adoptStyles()),this._renderRoot}createRenderRoot(){return this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions)}__adoptStyles(){const e=this.constructor.elementStyles;if(!e)return;const t=Array.isArray(e)?e:[e],s=[];for(const e of t)"string"==typeof e?s.push(e):r(e)&&s.push(e.strings.join(""));if(0!==s.length)if(void 0!==this._renderRoot.adoptedStyleSheets){const e=new CSSStyleSheet;e.replaceSync(s.join("\n")),this._renderRoot.adoptedStyleSheets=[...this._renderRoot.adoptedStyleSheets,e]}else{const e=document.createElement("style");e.textContent=s.join("\n"),this._renderRoot.appendChild(e)}}enableUpdating(e){}get updateComplete(){return this.__updateCompletePromise??Promise.resolve()}get hasUpdated(){return this.__hasUpdated}get isUpdatePending(){return this.__updatePending}requestUpdate(e,t,s){if(void 0!==e){if(!(s?.hasChanged??((e,t)=>!Object.is(e,t)))(this[e],t))return}this.__updatePending||(this.__updatePending=!0,d(this))}async performUpdate(){if(this.isUpdatePending){this.__updatePending=!1,this.willUpdate(new Map),this.__controllers.forEach(e=>e.hostUpdate?.()),this.update(new Map),this.__hasUpdated=!0;for(const[e,t]of this.constructor.elementProperties)if(t.reflect){const s=this[e],r=t.converter?.toAttribute??p.toAttribute,i=this.constructor.__attributeNameForProperty(e,t);if(void 0!==i){this.__reflectingProperty=e;const n=r(s,t.type);null==n?this.removeAttribute(i):this.setAttribute(i,String(n)),this.__reflectingProperty=null}}this.__controllers.forEach(e=>e.hostUpdated?.()),this.firstUpdated(new Map),this.updated(new Map)}}_$performUpdate(){this.performUpdate()}shouldUpdate(e){return!0}willUpdate(e){}update(e){const t=this.render();t&&a(t,this.renderRoot)}render(){return t``}firstUpdated(e){}updated(e){}propertyChangedCallback(e,t,s){}addController(e){this.__controllers.add(e),this.isConnected&&e.hostConnected?.()}removeController(e){this.__controllers.delete(e)}emit(e,t,s={}){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0,...s}))}$(e){return this.renderRoot.querySelector(e)}$$(e){return this.renderRoot.querySelectorAll(e)}}function m(e,t){if(!e.includes("-"))throw new Error(`Component name must contain a hyphen: ${e}`);customElements.get(e)||customElements.define(e,t)}const v={check:'<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"/>',content_copy:'<path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/>',close:'<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/>',search:'<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>',menu:'<path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/>',arrow_back:'<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/>',arrow_forward:'<path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"/>',add:'<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>',remove:'<path d="M19 13H5v-2h14v2z"/>',edit:'<path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"/>',delete:'<path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/>',home:'<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>',settings:'<path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.07.62-.07.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"/>',star:'<path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"/>',heart:'<path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>',share:'<path d="M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"/>',link:'<path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.1 0-2-.9-2-2s.9-2 2-2h4v-1.9H7c-2.76 0-5 2.24-5 5zm7-3h4v1.9h-4V9zm3.9 6h-4v1.9h4c1.1 0 2-.9 2-2s-.9-2-2-2h-4v-1.9h4c2.76 0 5 2.24 5 5s-2.24 5-5 5z"/>',download:'<path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/>',upload:'<path d="M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"/>',refresh:'<path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.73 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"/>',more_vert:'<path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>',more_horiz:'<path d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm8 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm8 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>',expand_more:'<path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"/>',expand_less:'<path d="M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"/>',visibility:'<path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/>',visibility_off:'<path d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.12 2.12C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.21.53-2.76 0-5-2.24-5-5 0-.8.2-1.54.53-2.21zm4.21-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/>',info:'<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>',warning:'<path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/>',error_outline:'<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>',help_outline:'<path d="M11 18h2v-2h-2v2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 1-2.5 3-5V8c-1.1 0-2-.9-2-2zm0 10c-.59 0-1-.51-1-1s.41-1 1-1 1 .51 1 1-.41 1-1 1z"/>',light_mode:'<path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z"/>',dark_mode:'<path d="M9.37 5.51c-.18.64-.27 1.31-.27 1.99 0 4.08 3.32 7.4 7.4 7.4.68 0 1.35-.09 1.99-.27C17.45 17.19 14.93 19 12 19c-3.86 0-7-3.14-7-7 0-2.93 1.81-5.45 4.37-6.49zM12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1z"/>',view_quilt:'<path d="M3 3v8h8V3H3zm6 6H5V5h4v4zm-6 4v8h8v-8H3zm6 6H5v-4h4v4zm4-16v8h8V3h-8zm6 6h-4V5h4v4zm-6 4v8h8v-8h-8zm6 6h-4v-4h4v4z"/>',code:'<path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0L19.2 12l-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"/>',toggle_on:'<path d="M6 7h12a5 5 0 010 10H6a5 5 0 010-10z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><circle cx="18" cy="12" r="3"/>',swap_vert:'<path d="M16 17.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3z"/>',arrow_down:'<path d="M3 8l9 9 9-9H3z"/>',language:'<path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56zM12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zM4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2 0 .68.06 1.34.14 2H4.26zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56zm2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8zM12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zM14.34 14H9.66c-.09-.66-.16-1.32-.16-2 0-.68.07-1.35.16-2h4.68c.09.65.16 1.32.16 2 0 .68-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56zM16.36 14c.08-.66.14-1.32.14-2 0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z"/>',smart_button:'<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4v2z"/>',table_chart:'<path d="M3 3v18h18V3H3zm8 16H5v-6h6v6zm0-8H5V5h6v6zm8 8h-6v-6h6v6zm0-8h-6V5h6v6z"/>',check_circle:'<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>',cancel:'<path d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"/>',pause:'<path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/>',play:'<path d="M8 5v14l11-7z"/>',stop:'<path d="M6 6h12v12H6z"/>',save:'<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>',folder:'<path d="M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"/>',file:'<path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"/>',email:'<path d="M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"/>',person:'<path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/>',lock:'<path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/>',filter:'<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>',sort:'<path d="M3 18h6v-2H3v2zM3 6v2h18V6H3zm0 7h12v-2H3v2z"/>',calendar:'<path d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11z"/>',map:'<path d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM15 19l-6-2.11V5l6 2.11V19z"/>',camera:'<path d="M12 12m-3.2 0a3.2 3.2 0 1 0 6.4 0a3.2 3.2 0 1 0-6.4 0M9 2L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2H9zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z"/>',bookmark:'<path d="M17 3H7c-1.1 0-2 .9-2 2v16l7-3 7 3V5c0-1.1-.9-2-2-2z"/>',clock:'<path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"/>',chat:'<path d="M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z"/>',phone:'<path d="M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z"/>',notification:'<path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/>',cloud:'<path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z"/>',download_done:'<path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/>',github:'<path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/>',npm:'<path d="M1.763 0C.786 0 0 .786 0 1.763v20.474C0 23.214.786 24 1.763 24h20.474c.977 0 1.763-.786 1.763-1.763V1.763C24 .786 23.214 0 22.237 0zM5.13 5.323l13.837.019-.009 13.836h-3.464l.01-10.382h-3.456L12.04 19.17H5.113z"/>'},f=s`
|
|
2
|
+
:host {
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
width: 1em;
|
|
7
|
+
height: 1em;
|
|
8
|
+
vertical-align: middle;
|
|
9
|
+
fill: currentColor;
|
|
10
|
+
flex-shrink: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:host([size]) {
|
|
14
|
+
width: var(--icon-size);
|
|
15
|
+
height: var(--icon-size);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
svg {
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
}
|
|
22
|
+
`;m("lux-icon",class extends u{static styles=f;static properties={name:{type:String,reflect:!0},size:{type:String,reflect:!0},color:{type:String,reflect:!0}};constructor(){super()}updated(){this.size&&this.style.setProperty("--icon-size",this._parseSize(this.size)),this.color&&(this.style.color=this.color);const e=this.renderRoot.querySelector(".icon-svg");e&&this.name&&v[this.name]&&(e.innerHTML=v[this.name])}_parseSize(e){return null==e?"":"number"==typeof e||/^\d+(\.\d+)?$/.test(e)?e+"px":e}render(){return this.childNodes.length>0?t`<slot></slot>`:this.name&&v[this.name]?t`<svg class="icon-svg" viewBox="0 0 24 24"></svg>`:t`<span style="font-size:0.75em;font-weight:600">${this.name||"?"}</span>`}});const z=s`
|
|
23
|
+
:host {
|
|
24
|
+
display: block;
|
|
25
|
+
width: 100%;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.menu {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
gap: 2px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.item {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
gap: 10px;
|
|
38
|
+
padding: 6px 12px;
|
|
39
|
+
border-radius: 6px;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
color: rgb(var(--lux-text-secondary));
|
|
42
|
+
font-size: 14px;
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
user-select: none;
|
|
45
|
+
min-height: 36px;
|
|
46
|
+
transition: all 150ms ease;
|
|
47
|
+
text-decoration: none;
|
|
48
|
+
}
|
|
49
|
+
.item:hover {
|
|
50
|
+
background: rgb(var(--lux-hover));
|
|
51
|
+
color: rgb(var(--lux-text));
|
|
52
|
+
}
|
|
53
|
+
.item.active {
|
|
54
|
+
background: rgb(var(--lux-primary-400) / 10%);
|
|
55
|
+
color: rgb(var(--lux-primary-400));
|
|
56
|
+
font-weight: 500;
|
|
57
|
+
}
|
|
58
|
+
.item.disabled {
|
|
59
|
+
opacity: 0.4;
|
|
60
|
+
pointer-events: none;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.item-icon {
|
|
64
|
+
flex-shrink: 0;
|
|
65
|
+
display: inline-flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
width: 22px;
|
|
69
|
+
height: 22px;
|
|
70
|
+
}
|
|
71
|
+
.item-label {
|
|
72
|
+
flex: 1;
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
text-overflow: ellipsis;
|
|
75
|
+
}
|
|
76
|
+
.item-arrow {
|
|
77
|
+
flex-shrink: 0;
|
|
78
|
+
display: inline-flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
width: 24px;
|
|
82
|
+
height: 24px;
|
|
83
|
+
transition: transform 150ms ease;
|
|
84
|
+
font-size: 22px;
|
|
85
|
+
}
|
|
86
|
+
.item-arrow.open {
|
|
87
|
+
transform: rotate(90deg);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.divider {
|
|
91
|
+
height: 1px;
|
|
92
|
+
background: rgb(var(--lux-border));
|
|
93
|
+
margin: 4px 12px;
|
|
94
|
+
}
|
|
95
|
+
.children {
|
|
96
|
+
padding-left: 16px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
:host([collapsed]) .menu {
|
|
100
|
+
width: 48px;
|
|
101
|
+
align-items: center;
|
|
102
|
+
}
|
|
103
|
+
:host([collapsed]) .item {
|
|
104
|
+
justify-content: center;
|
|
105
|
+
padding: 8px;
|
|
106
|
+
width: 36px;
|
|
107
|
+
height: 36px;
|
|
108
|
+
min-height: auto;
|
|
109
|
+
position: relative;
|
|
110
|
+
}
|
|
111
|
+
:host([collapsed]) .item-label,
|
|
112
|
+
:host([collapsed]) .item-arrow {
|
|
113
|
+
display: none;
|
|
114
|
+
}
|
|
115
|
+
:host([collapsed]) .children {
|
|
116
|
+
display: none;
|
|
117
|
+
}
|
|
118
|
+
:host([collapsed]) .divider {
|
|
119
|
+
width: 24px;
|
|
120
|
+
margin: 4px auto;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
:host([collapsed]) .item::after {
|
|
124
|
+
content: attr(data-label);
|
|
125
|
+
display: none;
|
|
126
|
+
position: absolute;
|
|
127
|
+
left: 100%;
|
|
128
|
+
top: 50%;
|
|
129
|
+
transform: translateY(-50%);
|
|
130
|
+
margin-left: 8px;
|
|
131
|
+
padding: 4px 8px;
|
|
132
|
+
background: rgb(var(--lux-card));
|
|
133
|
+
border: 1px solid rgb(var(--lux-border));
|
|
134
|
+
border-radius: 6px;
|
|
135
|
+
box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
|
|
136
|
+
font-size: 12px;
|
|
137
|
+
color: rgb(var(--lux-text));
|
|
138
|
+
white-space: nowrap;
|
|
139
|
+
z-index: 1001;
|
|
140
|
+
pointer-events: none;
|
|
141
|
+
}
|
|
142
|
+
:host([collapsed]) .item:hover::after {
|
|
143
|
+
display: block;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
:host([collapsed]) .popup-wrap {
|
|
147
|
+
position: relative;
|
|
148
|
+
display: inline-flex;
|
|
149
|
+
}
|
|
150
|
+
:host([collapsed]) .children-popup {
|
|
151
|
+
display: none;
|
|
152
|
+
position: absolute;
|
|
153
|
+
left: 100%;
|
|
154
|
+
top: 0;
|
|
155
|
+
min-width: 180px;
|
|
156
|
+
background: rgb(var(--lux-card));
|
|
157
|
+
border: 1px solid rgb(var(--lux-border));
|
|
158
|
+
border-radius: 6px;
|
|
159
|
+
box-shadow: 0 4px 12px rgb(0 0 0 / 20%);
|
|
160
|
+
padding: 4px;
|
|
161
|
+
z-index: 1000;
|
|
162
|
+
}
|
|
163
|
+
:host([collapsed]) .popup-wrap:hover > .children-popup {
|
|
164
|
+
display: block;
|
|
165
|
+
}
|
|
166
|
+
:host([collapsed]) .children-popup .item {
|
|
167
|
+
width: auto;
|
|
168
|
+
min-height: auto;
|
|
169
|
+
justify-content: flex-start;
|
|
170
|
+
padding: 6px 12px;
|
|
171
|
+
}
|
|
172
|
+
:host([collapsed]) .children-popup .item-label {
|
|
173
|
+
display: block;
|
|
174
|
+
}
|
|
175
|
+
:host([collapsed]) .children-popup .children {
|
|
176
|
+
display: block;
|
|
177
|
+
padding-left: 12px;
|
|
178
|
+
}
|
|
179
|
+
:host([collapsed]) .children-popup .divider {
|
|
180
|
+
margin: 4px 8px;
|
|
181
|
+
}
|
|
182
|
+
`;class y extends u{static styles=z;static properties={items:{type:Array,attribute:!1},collapseWidth:{type:Number,attribute:"collapse-width",reflect:!0},collapsed:{type:Boolean,reflect:!0},activeKey:{type:String,attribute:"active-key",reflect:!0}};constructor(){super(),this._expandedKeys=new Set,this._resizeObserver=null}connectedCallback(){super.connectedCallback(),this._syncItems(),this._resizeObserver=new ResizeObserver(()=>{const e=parseInt(this.getAttribute("collapse-width"));e&&(this.collapsed=this.offsetWidth<e)}),this._resizeObserver.observe(this)}disconnectedCallback(){this._resizeObserver?.disconnect()}_syncItems(){const e=this.items;if(Array.isArray(e)&&e.length>0)return void this.requestUpdate();const t=this.getAttribute("data-items");if(t)try{this.items=JSON.parse(t)}catch{}}attributeChangedCallback(e,t,s){if("data-items"===e&&s!==t)try{this.items=JSON.parse(s)}catch{}}_toggleExpand(e){this._expandedKeys.has(e)?this._expandedKeys.delete(e):this._expandedKeys.add(e),this.requestUpdate()}_onItemClick(e){e.disabled||(e.children&&e.children.length&&this._toggleExpand(e.key),this.activeKey=e.key,this.setAttribute("active-key",e.key),this.requestUpdate(),this.emit("select",{key:e.key,item:e}))}_renderItems(e){if(!e||!e.length)return"";const s=this.activeKey||this.getAttribute("active-key")||"";return e.map(e=>{if(e.divider)return t`<div class="divider"></div>`;const r=e.children&&e.children.length>0,i=e.key===s,n=this._expandedKeys.has(e.key);return t`
|
|
183
|
+
<div
|
|
184
|
+
class=${{item:!0,active:i,disabled:e.disabled}}
|
|
185
|
+
data-label="${e.label||""}"
|
|
186
|
+
@click=${()=>this._onItemClick(e)}
|
|
187
|
+
>
|
|
188
|
+
${e.icon?t`<span class="item-icon"><lux-icon .name=${e.icon} size="20px"></lux-icon></span>`:""}
|
|
189
|
+
<span class="item-label">${e.label||""}</span>
|
|
190
|
+
${r?t`<span class=${{"item-arrow":!0,open:n}}>›</span>`:""}
|
|
191
|
+
</div>
|
|
192
|
+
${r&&n?t`<div class="children">${this._renderItems(e.children)}</div>`:""}
|
|
193
|
+
`})}render(){return t`<div class="menu">${this._renderItems(this.items||[])}</div>`}}return m("lux-menu",y),y}();
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
const e=Symbol.for("lux-nothing");function t(e,...t){return{_$luxType$:1,strings:e,values:t}}function s(e,...t){return{_$luxType$:3,strings:e,values:t}}function r(e){return e&&void 0!==e._$luxType$}const i=/(?:([@.?][\w-]+)|(ref)|(class))=\s*$/;function n(t,s,i){if(s!==e&&null!=s)if(function(e){return e&&"repeat"===e._type}(s))!function(e,t){const{items:s,keyFn:i,renderFn:n}=t,o=e._repeatState;if(o)for(const e of o.entries)e.span&&e.span.parentNode&&e.span.parentNode.removeChild(e.span);const c=document.createDocumentFragment(),l=[];for(const e of s){const t=i(e),s=n(e),o=document.createElement("span");o.style.display="contents",r(s)?a(s,o):null!=s&&!1!==s&&o.appendChild(document.createTextNode(String(s))),c.appendChild(o),l.push({key:t,result:s,span:o})}e.appendChild(c),e._repeatState={entries:l}}(t,s);else if(r(s))a(s,t);else if(Array.isArray(s)){o(t);for(const e of s)if(r(e)){const s=document.createElement("span");s.style.display="contents",a(e,s),t.appendChild(s)}else e instanceof Node?t.appendChild(e):null!=e&&!1!==e&&t.appendChild(document.createTextNode(String(e)))}else{if(s instanceof Node)return o(t),void t.appendChild(s);1===t.childNodes.length&&t.firstChild.nodeType===Node.TEXT_NODE?t.firstChild.textContent=String(s):(o(t),t.appendChild(document.createTextNode(String(s))))}else o(t)}function o(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function c(t,s){const{element:r,name:i,prefix:n}=t;switch(n){case"@":{const n=t.committedValue,o=null==s||s===e,c=o&&null!=n||s?.capture!==n?.capture||s?.once!==n?.once||s?.passive!==n?.passive,a=!o&&(null==n||c);if(c&&r.removeEventListener(i,t._handler||n,n),a)if("function"==typeof s){const e=t._host||(t._host={handleEvent(e){const s=t.committedValue;if("function"==typeof s){const t=r.getRootNode().host||r;s.call(t,e)}}});t._handler=e,r.addEventListener(i,e)}else if("object"==typeof s&&s?.handleEvent){const e={handleEvent:e=>s.handleEvent.call(s,e)};t._handler=e,r.addEventListener(i,e,{capture:s.capture,once:s.once,passive:s.passive})}t.committedValue=s;break}case".":r[i]=s===e?void 0:s;break;case"?":r.toggleAttribute(i,!!s);break;case"ref":"function"==typeof s&&s(r);break;case"class":if("string"==typeof s)r.className=s;else if("object"==typeof s&&null!=s){const e=r.className||"",t=e?e.split(/\s+/):[];for(const[e,r]of Object.entries(s))if(r)t.includes(e)||t.push(e);else{const s=t.indexOf(e);-1!==s&&t.splice(s,1)}r.className=t.filter(Boolean).join(" ")}break;default:null==s||!1===s?r.removeAttribute(i):r.setAttribute(i,!0===s?"":String(s))}}function a(e,t,s){if(!r(e))return void(t.textContent=e??"");const{strings:o,values:a}=e;if(t._luxActiveParts&&t._luxStrings===o){for(const e of t._luxActiveParts)e.index<a.length&&("child"===e.type?n(e.span,a[e.index]):c(e,a[e.index]));return}const l=document.createElement("template"),h=function(e){const t=[];let s="";for(let r=0;r<e.length;r++)if(s+=e[r],r<e.length-1){const e=s.match(i);if(e){const i=e[1],n=!!e[2],o=!!e[3];let c="",a="";i?(c=i[0],a=i.slice(1)):n?(c="ref",a="ref"):o&&(c="class",a="class");const l=`lux-attr-${r}`;s=s.slice(0,-e[0].length)+`${l}="${a}" `,t.push({type:"attr",name:a,prefix:c,marker:l,index:r})}else{const e=`lux-${r}`;s+=`\x3c!--${e}--\x3e`,t.push({type:"child",marker:e,index:r})}}return{html:s,parts:t}}(o);l.innerHTML=h.html;const d=l.content.cloneNode(!0),p=[];for(const e of h.parts)if("child"===e.type){const t=document.createTreeWalker(d,NodeFilter.SHOW_COMMENT);let s;for(;s=t.nextNode();)if(s.data===e.marker){const t=document.createElement("span");t.style.display="contents",s.parentNode.replaceChild(t,s),n(t,a[e.index]),p.push({type:"child",span:t,index:e.index});break}}else{const t=d.querySelector(`[${e.marker}]`);if(t){t.removeAttribute(e.marker);const s={type:"attr",element:t,name:e.name,prefix:e.prefix,index:e.index,committedValue:void 0};c(s,a[e.index]),p.push(s)}}t.textContent="",t.appendChild(d),t._luxActiveParts=p,t._luxStrings=o}const l=new Set;let h=!1;function d(e){var t;l.add(e),h||(h=!0,t=()=>{h=!1;const e=[...l];l.clear();for(const t of e)t._$performUpdate()},Promise.resolve().then(t))}const p={toAttribute(e,t){switch(t){case Boolean:return e?"":null;case Object:case Array:return null==e?null:JSON.stringify(e);default:return e}},fromAttribute(e,t){switch(t){case Boolean:return null!==e;case Number:return Number(e);case Object:case Array:try{return JSON.parse(e)}catch{return null}default:return e}}};class u extends HTMLElement{static properties={};static styles=void 0;static finalized=!1;static elementProperties=new Map;static __prepare(){if(this.hasOwnProperty("elementProperties"))return;const e=Object.getPrototypeOf(this);e.finalize&&e.finalize(),this.elementProperties=new Map(e.elementProperties)}static get observedAttributes(){return this.finalize(),this.__attributeToPropertyMap?[...this.__attributeToPropertyMap.keys()]:[]}static finalize(){if(!this.hasOwnProperty("finalized")){if(this.finalized=!0,this.__prepare(),this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const s of t)this.createProperty(s,e[s])}this.__attributeToPropertyMap=new Map;for(const[e,t]of this.elementProperties){const s=this.__attributeNameForProperty(e,t);void 0!==s&&this.__attributeToPropertyMap.set(s,e)}this.elementStyles=this.styles}}static __attributeNameForProperty(e,t){const s=t.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof e?e.replace(/([A-Z])/g,"-$1").toLowerCase():void 0}static createProperty(e,t={}){if(this.__prepare(),!this.elementProperties.has(e)&&(t.state&&(t={...t,attribute:!1}),this.elementProperties.set(e,t),!t.noAccessor)){const s=Symbol(),r=this.getPropertyDescriptor(e,s,t);void 0!==r&&Object.defineProperty(this.prototype,e,r)}}static getPropertyDescriptor(e,t,s){const{type:r,reflect:i,converter:n}=s;return{get(){return this[t]},set(r){const i=this[t];this[t]=r,this.requestUpdate(e,i,s)},configurable:!0,enumerable:!0}}static _initializers=[];static addInitializer(e){this._initializers=[...this._initializers||[],e]}static shadowRootOptions={mode:"open"};constructor(){super(),this.__updatePending=!1,this.__hasUpdated=!1,this.__controllers=new Set,this.__reflectingProperty=null,this.constructor.hasOwnProperty("finalized")||this.constructor.finalize(),this.__saveInstanceProperties(),this.requestUpdate();for(const e of this.constructor._initializers||[])e(this)}__saveInstanceProperties(){const e=this.constructor.elementProperties;if(e)for(const[t,s]of e)if(!s.noAccessor&&this.hasOwnProperty(t)){const e=this[t];delete this[t],this.__instancePropertyValues=this.__instancePropertyValues||new Map,this.__instancePropertyValues.set(t,e)}}connectedCallback(){this.__controllers.forEach(e=>e.hostConnected?.()),this.constructor.hasOwnProperty("finalized")||this.constructor.finalize();const e=this.constructor.__attributeToPropertyMap;if(e)for(const[t,s]of e){const e=this.getAttribute(t);if(null!==e){const t=this.constructor.elementProperties.get(s);if(t){const r=t.converter?.fromAttribute??p.fromAttribute;this[s]=r(e,t.type)}}}if(this.__instancePropertyValues){for(const[e,t]of this.__instancePropertyValues)this[e]=t;this.__instancePropertyValues=void 0}this.renderRoot,this.__hasUpdated||this.requestUpdate()}disconnectedCallback(){this.__controllers.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,s){const r=this.constructor.__attributeToPropertyMap?.get(e);if(void 0!==r&&this.__reflectingProperty!==r){const e=this.constructor.elementProperties.get(r);if(e){const t="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:p;this.__reflectingProperty=r;const i=t.fromAttribute(s,e.type);this[r]=i,this.__reflectingProperty=null}}}get renderRoot(){return this._renderRoot||(this._renderRoot=this.createRenderRoot(),this.__adoptStyles()),this._renderRoot}createRenderRoot(){return this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions)}__adoptStyles(){const e=this.constructor.elementStyles;if(!e)return;const t=Array.isArray(e)?e:[e],s=[];for(const e of t)"string"==typeof e?s.push(e):r(e)&&s.push(e.strings.join(""));if(0!==s.length)if(void 0!==this._renderRoot.adoptedStyleSheets){const e=new CSSStyleSheet;e.replaceSync(s.join("\n")),this._renderRoot.adoptedStyleSheets=[...this._renderRoot.adoptedStyleSheets,e]}else{const e=document.createElement("style");e.textContent=s.join("\n"),this._renderRoot.appendChild(e)}}enableUpdating(e){}get updateComplete(){return this.__updateCompletePromise??Promise.resolve()}get hasUpdated(){return this.__hasUpdated}get isUpdatePending(){return this.__updatePending}requestUpdate(e,t,s){if(void 0!==e){if(!(s?.hasChanged??((e,t)=>!Object.is(e,t)))(this[e],t))return}this.__updatePending||(this.__updatePending=!0,d(this))}async performUpdate(){if(this.isUpdatePending){this.__updatePending=!1,this.willUpdate(new Map),this.__controllers.forEach(e=>e.hostUpdate?.()),this.update(new Map),this.__hasUpdated=!0;for(const[e,t]of this.constructor.elementProperties)if(t.reflect){const s=this[e],r=t.converter?.toAttribute??p.toAttribute,i=this.constructor.__attributeNameForProperty(e,t);if(void 0!==i){this.__reflectingProperty=e;const n=r(s,t.type);null==n?this.removeAttribute(i):this.setAttribute(i,String(n)),this.__reflectingProperty=null}}this.__controllers.forEach(e=>e.hostUpdated?.()),this.firstUpdated(new Map),this.updated(new Map)}}_$performUpdate(){this.performUpdate()}shouldUpdate(e){return!0}willUpdate(e){}update(e){const t=this.render();t&&a(t,this.renderRoot)}render(){return t``}firstUpdated(e){}updated(e){}propertyChangedCallback(e,t,s){}addController(e){this.__controllers.add(e),this.isConnected&&e.hostConnected?.()}removeController(e){this.__controllers.delete(e)}emit(e,t,s={}){return this.dispatchEvent(new CustomEvent(e,{detail:t,bubbles:!0,composed:!0,...s}))}$(e){return this.renderRoot.querySelector(e)}$$(e){return this.renderRoot.querySelectorAll(e)}}function m(e,t){if(!e.includes("-"))throw new Error(`Component name must contain a hyphen: ${e}`);customElements.get(e)||customElements.define(e,t)}const v={check:'<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z"/>',content_copy:'<path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/>',close:'<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/>',search:'<path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>',menu:'<path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/>',arrow_back:'<path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/>',arrow_forward:'<path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"/>',add:'<path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>',remove:'<path d="M19 13H5v-2h14v2z"/>',edit:'<path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"/>',delete:'<path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"/>',home:'<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>',settings:'<path d="M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.07.62-.07.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61l-2.01-1.58zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6z"/>',star:'<path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"/>',heart:'<path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>',share:'<path d="M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"/>',link:'<path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.1 0-2-.9-2-2s.9-2 2-2h4v-1.9H7c-2.76 0-5 2.24-5 5zm7-3h4v1.9h-4V9zm3.9 6h-4v1.9h4c1.1 0 2-.9 2-2s-.9-2-2-2h-4v-1.9h4c2.76 0 5 2.24 5 5s-2.24 5-5 5z"/>',download:'<path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/>',upload:'<path d="M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"/>',refresh:'<path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.73 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"/>',more_vert:'<path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>',more_horiz:'<path d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm8 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm8 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>',expand_more:'<path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"/>',expand_less:'<path d="M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"/>',visibility:'<path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/>',visibility_off:'<path d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.12 2.12C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.21.53-2.76 0-5-2.24-5-5 0-.8.2-1.54.53-2.21zm4.21-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/>',info:'<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>',warning:'<path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/>',error_outline:'<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>',help_outline:'<path d="M11 18h2v-2h-2v2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 1-2.5 3-5V8c-1.1 0-2-.9-2-2zm0 10c-.59 0-1-.51-1-1s.41-1 1-1 1 .51 1 1-.41 1-1 1z"/>',light_mode:'<path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zM2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1zm18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1zM11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1zm0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1zM5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41L5.99 4.58zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41l-1.06-1.06zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0l1.06-1.06z"/>',dark_mode:'<path d="M9.37 5.51c-.18.64-.27 1.31-.27 1.99 0 4.08 3.32 7.4 7.4 7.4.68 0 1.35-.09 1.99-.27C17.45 17.19 14.93 19 12 19c-3.86 0-7-3.14-7-7 0-2.93 1.81-5.45 4.37-6.49zM12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1z"/>',view_quilt:'<path d="M3 3v8h8V3H3zm6 6H5V5h4v4zm-6 4v8h8v-8H3zm6 6H5v-4h4v4zm4-16v8h8V3h-8zm6 6h-4V5h4v4zm-6 4v8h8v-8h-8zm6 6h-4v-4h4v4z"/>',code:'<path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0L19.2 12l-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"/>',toggle_on:'<path d="M6 7h12a5 5 0 010 10H6a5 5 0 010-10z" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><circle cx="18" cy="12" r="3"/>',swap_vert:'<path d="M16 17.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3z"/>',arrow_down:'<path d="M3 8l9 9 9-9H3z"/>',language:'<path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56zM12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zM4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2 0 .68.06 1.34.14 2H4.26zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56zm2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8zM12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zM14.34 14H9.66c-.09-.66-.16-1.32-.16-2 0-.68.07-1.35.16-2h4.68c.09.65.16 1.32.16 2 0 .68-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56zM16.36 14c.08-.66.14-1.32.14-2 0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z"/>',smart_button:'<path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4v2z"/>',table_chart:'<path d="M3 3v18h18V3H3zm8 16H5v-6h6v6zm0-8H5V5h6v6zm8 8h-6v-6h6v6zm0-8h-6V5h6v6z"/>',check_circle:'<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/>',cancel:'<path d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"/>',pause:'<path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/>',play:'<path d="M8 5v14l11-7z"/>',stop:'<path d="M6 6h12v12H6z"/>',save:'<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>',folder:'<path d="M10 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"/>',file:'<path d="M14 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z"/>',email:'<path d="M20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"/>',person:'<path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/>',lock:'<path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/>',filter:'<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>',sort:'<path d="M3 18h6v-2H3v2zM3 6v2h18V6H3zm0 7h12v-2H3v2z"/>',calendar:'<path d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11z"/>',map:'<path d="M20.5 3l-.16.03L15 5.1 9 3 3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1 5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM15 19l-6-2.11V5l6 2.11V19z"/>',camera:'<path d="M12 12m-3.2 0a3.2 3.2 0 1 0 6.4 0a3.2 3.2 0 1 0-6.4 0M9 2L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2H9zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z"/>',bookmark:'<path d="M17 3H7c-1.1 0-2 .9-2 2v16l7-3 7 3V5c0-1.1-.9-2-2-2z"/>',clock:'<path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zm.5-13H11v6l5.25 3.15.75-1.23-4.5-2.67z"/>',chat:'<path d="M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2z"/>',phone:'<path d="M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02l-2.2 2.2z"/>',notification:'<path d="M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"/>',cloud:'<path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z"/>',download_done:'<path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"/>',github:'<path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/>',npm:'<path d="M1.763 0C.786 0 0 .786 0 1.763v20.474C0 23.214.786 24 1.763 24h20.474c.977 0 1.763-.786 1.763-1.763V1.763C24 .786 23.214 0 22.237 0zM5.13 5.323l13.837.019-.009 13.836h-3.464l.01-10.382h-3.456L12.04 19.17H5.113z"/>'},f=s`
|
|
2
|
+
:host {
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
width: 1em;
|
|
7
|
+
height: 1em;
|
|
8
|
+
vertical-align: middle;
|
|
9
|
+
fill: currentColor;
|
|
10
|
+
flex-shrink: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
:host([size]) {
|
|
14
|
+
width: var(--icon-size);
|
|
15
|
+
height: var(--icon-size);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
svg {
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
}
|
|
22
|
+
`;m("lux-icon",class extends u{static styles=f;static properties={name:{type:String,reflect:!0},size:{type:String,reflect:!0},color:{type:String,reflect:!0}};constructor(){super()}updated(){this.size&&this.style.setProperty("--icon-size",this._parseSize(this.size)),this.color&&(this.style.color=this.color);const e=this.renderRoot.querySelector(".icon-svg");e&&this.name&&v[this.name]&&(e.innerHTML=v[this.name])}_parseSize(e){return null==e?"":"number"==typeof e||/^\d+(\.\d+)?$/.test(e)?e+"px":e}render(){return this.childNodes.length>0?t`<slot></slot>`:this.name&&v[this.name]?t`<svg class="icon-svg" viewBox="0 0 24 24"></svg>`:t`<span style="font-size:0.75em;font-weight:600">${this.name||"?"}</span>`}});const z=s`
|
|
23
|
+
:host {
|
|
24
|
+
display: block;
|
|
25
|
+
width: 100%;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.menu {
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
gap: 2px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.item {
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
gap: 10px;
|
|
38
|
+
padding: 6px 12px;
|
|
39
|
+
border-radius: 6px;
|
|
40
|
+
cursor: pointer;
|
|
41
|
+
color: rgb(var(--lux-text-secondary));
|
|
42
|
+
font-size: 14px;
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
user-select: none;
|
|
45
|
+
min-height: 36px;
|
|
46
|
+
transition: all 150ms ease;
|
|
47
|
+
text-decoration: none;
|
|
48
|
+
}
|
|
49
|
+
.item:hover {
|
|
50
|
+
background: rgb(var(--lux-hover));
|
|
51
|
+
color: rgb(var(--lux-text));
|
|
52
|
+
}
|
|
53
|
+
.item.active {
|
|
54
|
+
background: rgb(var(--lux-primary-400) / 10%);
|
|
55
|
+
color: rgb(var(--lux-primary-400));
|
|
56
|
+
font-weight: 500;
|
|
57
|
+
}
|
|
58
|
+
.item.disabled {
|
|
59
|
+
opacity: 0.4;
|
|
60
|
+
pointer-events: none;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.item-icon {
|
|
64
|
+
flex-shrink: 0;
|
|
65
|
+
display: inline-flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
width: 22px;
|
|
69
|
+
height: 22px;
|
|
70
|
+
}
|
|
71
|
+
.item-label {
|
|
72
|
+
flex: 1;
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
text-overflow: ellipsis;
|
|
75
|
+
}
|
|
76
|
+
.item-arrow {
|
|
77
|
+
flex-shrink: 0;
|
|
78
|
+
display: inline-flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
width: 24px;
|
|
82
|
+
height: 24px;
|
|
83
|
+
transition: transform 150ms ease;
|
|
84
|
+
font-size: 22px;
|
|
85
|
+
}
|
|
86
|
+
.item-arrow.open {
|
|
87
|
+
transform: rotate(90deg);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.divider {
|
|
91
|
+
height: 1px;
|
|
92
|
+
background: rgb(var(--lux-border));
|
|
93
|
+
margin: 4px 12px;
|
|
94
|
+
}
|
|
95
|
+
.children {
|
|
96
|
+
padding-left: 16px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
:host([collapsed]) .menu {
|
|
100
|
+
width: 48px;
|
|
101
|
+
align-items: center;
|
|
102
|
+
}
|
|
103
|
+
:host([collapsed]) .item {
|
|
104
|
+
justify-content: center;
|
|
105
|
+
padding: 8px;
|
|
106
|
+
width: 36px;
|
|
107
|
+
height: 36px;
|
|
108
|
+
min-height: auto;
|
|
109
|
+
position: relative;
|
|
110
|
+
}
|
|
111
|
+
:host([collapsed]) .item-label,
|
|
112
|
+
:host([collapsed]) .item-arrow {
|
|
113
|
+
display: none;
|
|
114
|
+
}
|
|
115
|
+
:host([collapsed]) .children {
|
|
116
|
+
display: none;
|
|
117
|
+
}
|
|
118
|
+
:host([collapsed]) .divider {
|
|
119
|
+
width: 24px;
|
|
120
|
+
margin: 4px auto;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
:host([collapsed]) .item::after {
|
|
124
|
+
content: attr(data-label);
|
|
125
|
+
display: none;
|
|
126
|
+
position: absolute;
|
|
127
|
+
left: 100%;
|
|
128
|
+
top: 50%;
|
|
129
|
+
transform: translateY(-50%);
|
|
130
|
+
margin-left: 8px;
|
|
131
|
+
padding: 4px 8px;
|
|
132
|
+
background: rgb(var(--lux-card));
|
|
133
|
+
border: 1px solid rgb(var(--lux-border));
|
|
134
|
+
border-radius: 6px;
|
|
135
|
+
box-shadow: 0 2px 8px rgb(0 0 0 / 15%);
|
|
136
|
+
font-size: 12px;
|
|
137
|
+
color: rgb(var(--lux-text));
|
|
138
|
+
white-space: nowrap;
|
|
139
|
+
z-index: 1001;
|
|
140
|
+
pointer-events: none;
|
|
141
|
+
}
|
|
142
|
+
:host([collapsed]) .item:hover::after {
|
|
143
|
+
display: block;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
:host([collapsed]) .popup-wrap {
|
|
147
|
+
position: relative;
|
|
148
|
+
display: inline-flex;
|
|
149
|
+
}
|
|
150
|
+
:host([collapsed]) .children-popup {
|
|
151
|
+
display: none;
|
|
152
|
+
position: absolute;
|
|
153
|
+
left: 100%;
|
|
154
|
+
top: 0;
|
|
155
|
+
min-width: 180px;
|
|
156
|
+
background: rgb(var(--lux-card));
|
|
157
|
+
border: 1px solid rgb(var(--lux-border));
|
|
158
|
+
border-radius: 6px;
|
|
159
|
+
box-shadow: 0 4px 12px rgb(0 0 0 / 20%);
|
|
160
|
+
padding: 4px;
|
|
161
|
+
z-index: 1000;
|
|
162
|
+
}
|
|
163
|
+
:host([collapsed]) .popup-wrap:hover > .children-popup {
|
|
164
|
+
display: block;
|
|
165
|
+
}
|
|
166
|
+
:host([collapsed]) .children-popup .item {
|
|
167
|
+
width: auto;
|
|
168
|
+
min-height: auto;
|
|
169
|
+
justify-content: flex-start;
|
|
170
|
+
padding: 6px 12px;
|
|
171
|
+
}
|
|
172
|
+
:host([collapsed]) .children-popup .item-label {
|
|
173
|
+
display: block;
|
|
174
|
+
}
|
|
175
|
+
:host([collapsed]) .children-popup .children {
|
|
176
|
+
display: block;
|
|
177
|
+
padding-left: 12px;
|
|
178
|
+
}
|
|
179
|
+
:host([collapsed]) .children-popup .divider {
|
|
180
|
+
margin: 4px 8px;
|
|
181
|
+
}
|
|
182
|
+
`;class y extends u{static styles=z;static properties={items:{type:Array,attribute:!1},collapseWidth:{type:Number,attribute:"collapse-width",reflect:!0},collapsed:{type:Boolean,reflect:!0},activeKey:{type:String,attribute:"active-key",reflect:!0}};constructor(){super(),this._expandedKeys=new Set,this._resizeObserver=null}connectedCallback(){super.connectedCallback(),this._syncItems(),this._resizeObserver=new ResizeObserver(()=>{const e=parseInt(this.getAttribute("collapse-width"));e&&(this.collapsed=this.offsetWidth<e)}),this._resizeObserver.observe(this)}disconnectedCallback(){this._resizeObserver?.disconnect()}_syncItems(){const e=this.items;if(Array.isArray(e)&&e.length>0)return void this.requestUpdate();const t=this.getAttribute("data-items");if(t)try{this.items=JSON.parse(t)}catch{}}attributeChangedCallback(e,t,s){if("data-items"===e&&s!==t)try{this.items=JSON.parse(s)}catch{}}_toggleExpand(e){this._expandedKeys.has(e)?this._expandedKeys.delete(e):this._expandedKeys.add(e),this.requestUpdate()}_onItemClick(e){e.disabled||(e.children&&e.children.length&&this._toggleExpand(e.key),this.activeKey=e.key,this.setAttribute("active-key",e.key),this.requestUpdate(),this.emit("select",{key:e.key,item:e}))}_renderItems(e){if(!e||!e.length)return"";const s=this.activeKey||this.getAttribute("active-key")||"";return e.map(e=>{if(e.divider)return t`<div class="divider"></div>`;const r=e.children&&e.children.length>0,i=e.key===s,n=this._expandedKeys.has(e.key);return t`
|
|
183
|
+
<div
|
|
184
|
+
class=${{item:!0,active:i,disabled:e.disabled}}
|
|
185
|
+
data-label="${e.label||""}"
|
|
186
|
+
@click=${()=>this._onItemClick(e)}
|
|
187
|
+
>
|
|
188
|
+
${e.icon?t`<span class="item-icon"><lux-icon .name=${e.icon} size="20px"></lux-icon></span>`:""}
|
|
189
|
+
<span class="item-label">${e.label||""}</span>
|
|
190
|
+
${r?t`<span class=${{"item-arrow":!0,open:n}}>›</span>`:""}
|
|
191
|
+
</div>
|
|
192
|
+
${r&&n?t`<div class="children">${this._renderItems(e.children)}</div>`:""}
|
|
193
|
+
`})}render(){return t`<div class="menu">${this._renderItems(this.items||[])}</div>`}}m("lux-menu",y);export{y as default};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
var LuxScroll=function(){"use strict";const t=Symbol.for("lux-nothing");function e(t,...e){return{_$luxType$:1,strings:t,values:e}}function s(t){return t&&void 0!==t._$luxType$}const r=/(?:([@.?][\w-]+)|(ref)|(class))=\s*$/;function o(e,r,o){if(r!==t&&null!=r)if(function(t){return t&&"repeat"===t._type}(r))!function(t,e){const{items:r,keyFn:o,renderFn:i}=e,n=t._repeatState;if(n)for(const t of n.entries)t.span&&t.span.parentNode&&t.span.parentNode.removeChild(t.span);const c=document.createDocumentFragment(),a=[];for(const t of r){const e=o(t),r=i(t),n=document.createElement("span");n.style.display="contents",s(r)?l(r,n):null!=r&&!1!==r&&n.appendChild(document.createTextNode(String(r))),c.appendChild(n),a.push({key:e,result:r,span:n})}t.appendChild(c),t._repeatState={entries:a}}(e,r);else if(s(r))l(r,e);else if(Array.isArray(r)){i(e);for(const t of r)if(s(t)){const s=document.createElement("span");s.style.display="contents",l(t,s),e.appendChild(s)}else t instanceof Node?e.appendChild(t):null!=t&&!1!==t&&e.appendChild(document.createTextNode(String(t)))}else{if(r instanceof Node)return i(e),void e.appendChild(r);1===e.childNodes.length&&e.firstChild.nodeType===Node.TEXT_NODE?e.firstChild.textContent=String(r):(i(e),e.appendChild(document.createTextNode(String(r))))}else i(e)}function i(t){for(;t.firstChild;)t.removeChild(t.firstChild)}function n(e,s){const{element:r,name:o,prefix:i}=e;switch(i){case"@":{const i=e.committedValue,n=null==s||s===t,l=n&&null!=i||s?.capture!==i?.capture||s?.once!==i?.once||s?.passive!==i?.passive,c=!n&&(null==i||l);if(l&&r.removeEventListener(o,e._handler||i,i),c)if("function"==typeof s){const t=e._host||(e._host={handleEvent(t){const s=e.committedValue;if("function"==typeof s){const e=r.getRootNode().host||r;s.call(e,t)}}});e._handler=t,r.addEventListener(o,t)}else if("object"==typeof s&&s?.handleEvent){const t={handleEvent:t=>s.handleEvent.call(s,t)};e._handler=t,r.addEventListener(o,t,{capture:s.capture,once:s.once,passive:s.passive})}e.committedValue=s;break}case".":r[o]=s===t?void 0:s;break;case"?":r.toggleAttribute(o,!!s);break;case"ref":"function"==typeof s&&s(r);break;case"class":if("string"==typeof s)r.className=s;else if("object"==typeof s&&null!=s){const t=r.className||"",e=t?t.split(/\s+/):[];for(const[t,r]of Object.entries(s))if(r)e.includes(t)||e.push(t);else{const s=e.indexOf(t);-1!==s&&e.splice(s,1)}r.className=e.filter(Boolean).join(" ")}break;default:null==s||!1===s?r.removeAttribute(o):r.setAttribute(o,!0===s?"":String(s))}}function l(t,e,i){if(!s(t))return void(e.textContent=t??"");const{strings:l,values:c}=t;if(e._luxActiveParts&&e._luxStrings===l){for(const t of e._luxActiveParts)t.index<c.length&&("child"===t.type?o(t.span,c[t.index]):n(t,c[t.index]));return}const a=document.createElement("template"),h=function(t){const e=[];let s="";for(let o=0;o<t.length;o++)if(s+=t[o],o<t.length-1){const t=s.match(r);if(t){const r=t[1],i=!!t[2],n=!!t[3];let l="",c="";r?(l=r[0],c=r.slice(1)):i?(l="ref",c="ref"):n&&(l="class",c="class");const a=`lux-attr-${o}`;s=s.slice(0,-t[0].length)+`${a}="${c}" `,e.push({type:"attr",name:c,prefix:l,marker:a,index:o})}else{const t=`lux-${o}`;s+=`\x3c!--${t}--\x3e`,e.push({type:"child",marker:t,index:o})}}return{html:s,parts:e}}(l);a.innerHTML=h.html;const d=a.content.cloneNode(!0),u=[];for(const t of h.parts)if("child"===t.type){const e=document.createTreeWalker(d,NodeFilter.SHOW_COMMENT);let s;for(;s=e.nextNode();)if(s.data===t.marker){const e=document.createElement("span");e.style.display="contents",s.parentNode.replaceChild(e,s),o(e,c[t.index]),u.push({type:"child",span:e,index:t.index});break}}else{const e=d.querySelector(`[${t.marker}]`);if(e){e.removeAttribute(t.marker);const s={type:"attr",element:e,name:t.name,prefix:t.prefix,index:t.index,committedValue:void 0};n(s,c[t.index]),u.push(s)}}e.textContent="",e.appendChild(d),e._luxActiveParts=u,e._luxStrings=l}const c=new Set;let a=!1;function h(t){var e;c.add(t),a||(a=!0,e=()=>{a=!1;const t=[...c];c.clear();for(const e of t)e._$performUpdate()},Promise.resolve().then(e))}const d={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return null==t?null:JSON.stringify(t);default:return t}},fromAttribute(t,e){switch(e){case Boolean:return null!==t;case Number:return Number(t);case Object:case Array:try{return JSON.parse(t)}catch{return null}default:return t}}};class u extends HTMLElement{static properties={};static styles=void 0;static finalized=!1;static elementProperties=new Map;static __prepare(){if(this.hasOwnProperty("elementProperties"))return;const t=Object.getPrototypeOf(this);t.finalize&&t.finalize(),this.elementProperties=new Map(t.elementProperties)}static get observedAttributes(){return this.finalize(),this.__attributeToPropertyMap?[...this.__attributeToPropertyMap.keys()]:[]}static finalize(){if(!this.hasOwnProperty("finalized")){if(this.finalized=!0,this.__prepare(),this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const s of e)this.createProperty(s,t[s])}this.__attributeToPropertyMap=new Map;for(const[t,e]of this.elementProperties){const s=this.__attributeNameForProperty(t,e);void 0!==s&&this.__attributeToPropertyMap.set(s,t)}this.elementStyles=this.styles}}static __attributeNameForProperty(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"string"==typeof t?t.replace(/([A-Z])/g,"-$1").toLowerCase():void 0}static createProperty(t,e={}){if(this.__prepare(),!this.elementProperties.has(t)&&(e.state&&(e={...e,attribute:!1}),this.elementProperties.set(t,e),!e.noAccessor)){const s=Symbol(),r=this.getPropertyDescriptor(t,s,e);void 0!==r&&Object.defineProperty(this.prototype,t,r)}}static getPropertyDescriptor(t,e,s){const{type:r,reflect:o,converter:i}=s;return{get(){return this[e]},set(r){const o=this[e];this[e]=r,this.requestUpdate(t,o,s)},configurable:!0,enumerable:!0}}static _initializers=[];static addInitializer(t){this._initializers=[...this._initializers||[],t]}static shadowRootOptions={mode:"open"};constructor(){super(),this.__updatePending=!1,this.__hasUpdated=!1,this.__controllers=new Set,this.__reflectingProperty=null,this.constructor.hasOwnProperty("finalized")||this.constructor.finalize(),this.__saveInstanceProperties(),this.requestUpdate();for(const t of this.constructor._initializers||[])t(this)}__saveInstanceProperties(){const t=this.constructor.elementProperties;if(t)for(const[e,s]of t)if(!s.noAccessor&&this.hasOwnProperty(e)){const t=this[e];delete this[e],this.__instancePropertyValues=this.__instancePropertyValues||new Map,this.__instancePropertyValues.set(e,t)}}connectedCallback(){this.__controllers.forEach(t=>t.hostConnected?.()),this.constructor.hasOwnProperty("finalized")||this.constructor.finalize();const t=this.constructor.__attributeToPropertyMap;if(t)for(const[e,s]of t){const t=this.getAttribute(e);if(null!==t){const e=this.constructor.elementProperties.get(s);if(e){const r=e.converter?.fromAttribute??d.fromAttribute;this[s]=r(t,e.type)}}}if(this.__instancePropertyValues){for(const[t,e]of this.__instancePropertyValues)this[t]=e;this.__instancePropertyValues=void 0}this.renderRoot,this.__hasUpdated||this.requestUpdate()}disconnectedCallback(){this.__controllers.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,s){const r=this.constructor.__attributeToPropertyMap?.get(t);if(void 0!==r&&this.__reflectingProperty!==r){const t=this.constructor.elementProperties.get(r);if(t){const e="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:d;this.__reflectingProperty=r;const o=e.fromAttribute(s,t.type);this[r]=o,this.__reflectingProperty=null}}}get renderRoot(){return this._renderRoot||(this._renderRoot=this.createRenderRoot(),this.__adoptStyles()),this._renderRoot}createRenderRoot(){return this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions)}__adoptStyles(){const t=this.constructor.elementStyles;if(!t)return;const e=Array.isArray(t)?t:[t],r=[];for(const t of e)"string"==typeof t?r.push(t):s(t)&&r.push(t.strings.join(""));if(0!==r.length)if(void 0!==this._renderRoot.adoptedStyleSheets){const t=new CSSStyleSheet;t.replaceSync(r.join("\n")),this._renderRoot.adoptedStyleSheets=[...this._renderRoot.adoptedStyleSheets,t]}else{const t=document.createElement("style");t.textContent=r.join("\n"),this._renderRoot.appendChild(t)}}enableUpdating(t){}get updateComplete(){return this.__updateCompletePromise??Promise.resolve()}get hasUpdated(){return this.__hasUpdated}get isUpdatePending(){return this.__updatePending}requestUpdate(t,e,s){if(void 0!==t){if(!(s?.hasChanged??((t,e)=>!Object.is(t,e)))(this[t],e))return}this.__updatePending||(this.__updatePending=!0,h(this))}async performUpdate(){if(this.isUpdatePending){this.__updatePending=!1,this.willUpdate(new Map),this.__controllers.forEach(t=>t.hostUpdate?.()),this.update(new Map),this.__hasUpdated=!0;for(const[t,e]of this.constructor.elementProperties)if(e.reflect){const s=this[t],r=e.converter?.toAttribute??d.toAttribute,o=this.constructor.__attributeNameForProperty(t,e);if(void 0!==o){this.__reflectingProperty=t;const i=r(s,e.type);null==i?this.removeAttribute(o):this.setAttribute(o,String(i)),this.__reflectingProperty=null}}this.__controllers.forEach(t=>t.hostUpdated?.()),this.firstUpdated(new Map),this.updated(new Map)}}_$performUpdate(){this.performUpdate()}shouldUpdate(t){return!0}willUpdate(t){}update(t){const e=this.render();e&&l(e,this.renderRoot)}render(){return e``}firstUpdated(t){}updated(t){}propertyChangedCallback(t,e,s){}addController(t){this.__controllers.add(t),this.isConnected&&t.hostConnected?.()}removeController(t){this.__controllers.delete(t)}emit(t,e,s={}){return this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0,...s}))}$(t){return this.renderRoot.querySelector(t)}$$(t){return this.renderRoot.querySelectorAll(t)}}const p=(function(t,...e){return{_$luxType$:3,strings:t,values:e}})`
|
|
2
|
+
:host {
|
|
3
|
+
display: block;
|
|
4
|
+
position: relative;
|
|
5
|
+
width: var(--scroll-w, 100%);
|
|
6
|
+
height: var(--scroll-h, 100%);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.scroll-container {
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
overflow-y: auto;
|
|
13
|
+
overflow-x: hidden;
|
|
14
|
+
position: relative;
|
|
15
|
+
scrollbar-width: none;
|
|
16
|
+
-ms-overflow-style: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.scroll-container::-webkit-scrollbar {
|
|
20
|
+
display: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/* ── Custom Track ── */
|
|
24
|
+
.scroll-track {
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: 4px;
|
|
27
|
+
right: 4px;
|
|
28
|
+
width: 6px;
|
|
29
|
+
height: calc(100% - 8px);
|
|
30
|
+
background: rgb(var(--lux-border, 226 232 240) / 0.2);
|
|
31
|
+
border-radius: 3px;
|
|
32
|
+
z-index: 10;
|
|
33
|
+
opacity: 0;
|
|
34
|
+
transition: opacity 0.2s ease;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:host(:hover) .scroll-track,
|
|
38
|
+
.scroll-container:hover + .scroll-track,
|
|
39
|
+
.scroll-track.visible {
|
|
40
|
+
opacity: 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/* ── Custom Thumb ── */
|
|
44
|
+
.scroll-thumb {
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: 0;
|
|
47
|
+
left: 0;
|
|
48
|
+
width: 100%;
|
|
49
|
+
border-radius: 3px;
|
|
50
|
+
background: rgb(var(--lux-scrollbar, 180 196 214));
|
|
51
|
+
cursor: grab;
|
|
52
|
+
transition:
|
|
53
|
+
background 0.15s ease,
|
|
54
|
+
height 0.15s ease;
|
|
55
|
+
min-height: 20px;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.scroll-thumb:hover,
|
|
59
|
+
.scroll-thumb.dragging {
|
|
60
|
+
background: rgb(var(--lux-primary-400, 129 120 247));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.scroll-thumb.dragging {
|
|
64
|
+
cursor: grabbing;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/* ── Scroll Buttons ─── */
|
|
68
|
+
.scroll-buttons {
|
|
69
|
+
position: absolute;
|
|
70
|
+
top: 8px;
|
|
71
|
+
right: 8px;
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
gap: 4px;
|
|
75
|
+
z-index: 11;
|
|
76
|
+
opacity: 0;
|
|
77
|
+
transition: opacity 0.2s ease;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
:host(:hover) .scroll-buttons,
|
|
81
|
+
.scroll-buttons.visible {
|
|
82
|
+
opacity: 1;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.scroll-btn {
|
|
86
|
+
width: 28px;
|
|
87
|
+
height: 28px;
|
|
88
|
+
border-radius: 50%;
|
|
89
|
+
border: 1px solid rgb(var(--lux-border, 51 65 85));
|
|
90
|
+
background: rgb(var(--lux-card, 30 41 59));
|
|
91
|
+
color: rgb(var(--lux-text-secondary, 148 163 184));
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
display: flex;
|
|
94
|
+
align-items: center;
|
|
95
|
+
justify-content: center;
|
|
96
|
+
font-size: 12px;
|
|
97
|
+
transition: all 0.15s ease;
|
|
98
|
+
padding: 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.scroll-btn:hover {
|
|
102
|
+
background: rgb(var(--lux-primary-400, 129 120 247));
|
|
103
|
+
color: #fff;
|
|
104
|
+
border-color: rgb(var(--lux-primary-400, 129 120 247));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.scroll-btn:disabled {
|
|
108
|
+
opacity: 0.3;
|
|
109
|
+
pointer-events: none;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/* ── Disabled (show native) ── */
|
|
113
|
+
:host([disabled]) .scroll-track,
|
|
114
|
+
:host([disabled]) .scroll-buttons {
|
|
115
|
+
display: none;
|
|
116
|
+
}
|
|
117
|
+
:host([disabled]) .scroll-container {
|
|
118
|
+
scrollbar-width: auto;
|
|
119
|
+
-ms-overflow-style: auto;
|
|
120
|
+
}
|
|
121
|
+
:host([disabled]) .scroll-container::-webkit-scrollbar {
|
|
122
|
+
display: block;
|
|
123
|
+
}
|
|
124
|
+
`;class f extends u{static styles=p;static properties={height:{type:String,attribute:"height",reflect:!0},width:{type:String,attribute:"width",reflect:!0},showButtons:{type:Boolean,attribute:"show-buttons",reflect:!0},disabled:{type:Boolean,attribute:"disabled",reflect:!0}};constructor(){super(),this.height="100%",this.width="100%",this.showButtons=!1,this.disabled=!1}connectedCallback(){super.connectedCallback(),this.style.height=this.height,this.style.width=this.width}firstUpdated(){this._setupScroll()}updated(){this.style.height=this.height,this.style.width=this.width,requestAnimationFrame(()=>this._syncThumb())}disconnectedCallback(){super.disconnectedCallback(),this._teardownScroll()}_setupScroll(){const t=this.renderRoot.querySelector(".scroll-container"),e=this.renderRoot.querySelector(".scroll-thumb"),s=this.renderRoot.querySelector(".scroll-track");t&&e&&s&&(this._container=t,this._thumb=e,this._track=s,this._onScroll=()=>this._syncThumb(),t.addEventListener("scroll",this._onScroll,{passive:!0}),this._onThumbDown=t=>this._startDrag(t),e.addEventListener("mousedown",this._onThumbDown),this._onTrackClickBound=t=>this._onTrackClick(t),s.addEventListener("click",this._onTrackClickBound),this._onMouseEnter=()=>{s.classList.add("visible"),this._showButtons(!0)},this._onMouseLeave=()=>{s.classList.remove("visible"),this._showButtons(!1)},this.addEventListener("mouseenter",this._onMouseEnter),this.addEventListener("mouseleave",this._onMouseLeave),requestAnimationFrame(()=>this._syncThumb()))}_teardownScroll(){this._container&&this._container.removeEventListener("scroll",this._onScroll),this._thumb&&this._thumb.removeEventListener("mousedown",this._onThumbDown),this._track&&this._track.removeEventListener("click",this._onTrackClickBound),this.removeEventListener("mouseenter",this._onMouseEnter),this.removeEventListener("mouseleave",this._onMouseLeave)}_syncThumb(){const t=this._container,e=this._thumb,s=this._track;if(!t||!e||!s)return;const r=t.scrollHeight,o=t.clientHeight,i=s.offsetHeight||o-8;if(r<=o)return e.style.height="0px",void(e.style.opacity="0");const n=o/r,l=Math.max(20,i*n),c=i-l,a=t.scrollTop,h=r-o,d=h>0?a/h*c:0;e.style.height=l+"px",e.style.top=d+"px",e.style.opacity="1"}_startDrag(t){t.preventDefault();const e=this._container,s=this._thumb;if(!e||!s)return;const r=t.clientY,o=e.scrollTop,i=e.scrollHeight,n=e.clientHeight,l=s.offsetHeight,c=i-n,a=n-l,h=c>a?c/a:1;s.classList.add("dragging");const d=t=>{const s=t.clientY-r,i=o+s*h;e.scrollTop=Math.max(0,Math.min(c,i))},u=()=>{s.classList.remove("dragging"),document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",u)};document.addEventListener("mousemove",d),document.addEventListener("mouseup",u)}_onTrackClick(t){const e=this._container;if(!e)return;const s=this._track.getBoundingClientRect(),r=(t.clientY-s.top)/s.height,o=e.scrollHeight-e.clientHeight;e.scrollTop=r*o}_showButtons(t){if(!this.showButtons)return;const e=this.renderRoot.querySelector(".scroll-buttons");e&&e.classList.toggle("visible",t)}scrollToTop(){this._container?.scrollTo({top:0,behavior:"smooth"})}scrollToBottom(){const t=this._container;t&&t.scrollTo({top:t.scrollHeight,behavior:"smooth"})}render(){return e`
|
|
125
|
+
<div class="scroll-container">
|
|
126
|
+
<slot></slot>
|
|
127
|
+
</div>
|
|
128
|
+
<div class="scroll-track">
|
|
129
|
+
<div class="scroll-thumb"></div>
|
|
130
|
+
</div>
|
|
131
|
+
${this.showButtons?e`
|
|
132
|
+
<div class="scroll-buttons">
|
|
133
|
+
<button class="scroll-btn" @click=${()=>this.scrollToTop()}>▲</button>
|
|
134
|
+
<button class="scroll-btn" @click=${()=>this.scrollToBottom()}>▼</button>
|
|
135
|
+
</div>
|
|
136
|
+
`:""}
|
|
137
|
+
`}}return function(t,e){if(!t.includes("-"))throw new Error(`Component name must contain a hyphen: ${t}`);customElements.get(t)||customElements.define(t,e)}("lux-scroll",f),f}();
|