@zywave/zui-bundle
Version:
ZUI, out of the box, provides ES modules with bare path modifiers (e.g. `import '@zywave/zui-foo-bar'`). This is great as that's the way browsers are _going_, but they aren't there quite yet. Tooling exists to help solve this problem like webpack or rollu
2 lines (1 loc) • 4.84 kB
JavaScript
import{f as e,i as t,D as i,n as s,Z as o,k as n,O as r,u as l,R as h}from"./_9c1b2703.js";function a(t,i){return(s,o,n)=>{const r=e=>e.renderRoot?.querySelector(t)??null;if(i){const{get:t,set:i}="object"==typeof o?s:n??(()=>{const e=Symbol();return{get(){return this[e]},set(t){this[e]=t}}})();return e(s,o,{get(){let e=t.call(this);return void 0===e&&(e=r(this),(null!==e||this.hasUpdated)&&i.call(this,e)),e}})}return e(s,o,{get(){return r(this)}})}}const c=t`:host{display:inline-block;width:var(--zui-icon-size,1.5rem);height:var(--zui-icon-size,1.5rem);line-height:1;fill:currentColor}:host .zui-icon-color{--zui-icon-color:currentColor}zui-svg{display:inherit;width:inherit;height:inherit;line-height:inherit;fill:inherit;pointer-events:none}:host(.small){width:var(--zui-icon-size,1rem);height:var(--zui-icon-size,1rem)}:host(.medium){width:var(--zui-icon-size,1.5rem);height:var(--zui-icon-size,1.5rem)}:host(.large){width:var(--zui-icon-size,2.25rem);height:var(--zui-icon-size,2.25rem)}:host(.xlarge){width:var(--zui-icon-size,3rem);height:var(--zui-icon-size,3rem)}`,d=t`:host{display:inline-block;width:var(--zui-svg-width,1rem);height:var(--zui-svg-height,1rem);margin:0;padding:0;line-height:1;fill:currentColor;pointer-events:none}:host .svg{display:inherit;width:inherit;height:inherit;line-height:inherit;fill:inherit;pointer-events:inherit}:host(.small){--zui-svg-width:1rem;--zui-svg-height:1rem}:host(.medium){--zui-svg-width:1.5rem;--zui-svg-height:1.5rem}:host(.large){--zui-svg-width:2.25rem;--zui-svg-height:2.25rem}:host(.xlarge){--zui-svg-width:3rem;--zui-svg-height:3rem}.svg-defs{display:none}`,u=e=>e??i;var g=function(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(r=(n<3?o(r):n>3?o(t,i,r):o(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};class v extends o{constructor(){super(...arguments),this.svgId="",this.file="",this.svgNodeClone=null}static get styles(){return[super.styles,d]}render(){if(!this.svgId)return n`<style>:host{display:none}</style>`;this.svgNodeClone=void 0;const e=this.file?void 0:document.getElementById(this.svgId);e&&(this.svgNodeClone=e.cloneNode(!0));let t=this.viewBox;!t&&this.svgNodeClone&&(t=this.svgNodeClone.getAttribute("viewBox"));const i=`${this.file}#${this.svgId}`;return n`${this.svgNodeClone?n`<svg focusable="false" class="svg-defs"><defs>${this.svgNodeClone}</defs></svg>`:n``} ${r`<svg viewBox="${u(t)}" focusable="false" class="svg" id="svg"><use href="${i}" xlink:href="${i}"></use></svg>`}`}}g([s({type:String,attribute:"svg-id"})],v.prototype,"svgId",void 0),g([s({type:String,attribute:"file"})],v.prototype,"file",void 0),g([s({type:String,attribute:"viewBox"})],v.prototype,"viewBox",void 0),g([a("svg")],v.prototype,"_svg",void 0),window.customElements.define("zui-svg",v);const p={nav:()=>import("./_11409008.js"),fs:()=>import("./_ac62c606.js"),shell:()=>import("./_e176571f.js"),system:()=>import("./_204909bd.js"),search:()=>import("./_2c11ac06.js")},f=new Map;async function m(e){const t=function(e){const t=e.split("-");let i="";return t.length>2&&(i=t[1]),Object.prototype.hasOwnProperty.call(p,i)||(i="system"),i}(e),i=await function(e){let t=f.get(e);return t||(t=new Promise((async t=>{t((await p[e]()).svgSprite.strings[0])})),f.set(e,t)),t}(t);!function(e,t){if(!document.querySelector(`[data-icons-container='${t}']`)){const i=document.createElement("div");i.setAttribute("data-icons-container",t),i.style.display="none",i.innerHTML=e,document.head.appendChild(i)}}(i,t)}var y=function(e,t,i,s){var o,n=arguments.length,r=n<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,s);else for(var l=e.length-1;l>=0;l--)(o=e[l])&&(r=(n<3?o(r):n>3?o(t,i,r):o(t,i))||r);return n>3&&r&&Object.defineProperty(t,i,r),r};class z extends o{static get styles(){return[super.styles,c]}#e;#t;constructor(){super(),this.icon="",this.removeIconColor=!1,this.#e=null,this.#t=!1,this.#e=this.attachInternals?.()}async updated(e){e.has("icon")&&(this.#t=!1,this.requestUpdate(),await m(this.icon),this.#t=!0,this.requestUpdate(),await this.updateComplete,this.dispatchEvent(new CustomEvent("load",{bubbles:!0,detail:{svgLoaded:!0}})),l(this.#e,"add","loaded"))}render(){if(!this.icon)return n`<style>:host{display:none}</style>`;const e={"zui-icon-color":this.removeIconColor};return n`${this.#t?n`<zui-svg class="${h(e)}" svg-id="${this.icon}"></zui-svg>`:n``}`}}y([s({type:String,attribute:"icon"})],z.prototype,"icon",void 0),y([s({type:Boolean,attribute:"no-color"})],z.prototype,"removeIconColor",void 0),window.customElements.define("zui-icon",z);export{z as Z,a as e,u as t};