vue-quest-ui 0.0.0
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(k,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],h):(k=typeof globalThis<"u"?globalThis:k||self,h(k.QuestUI={},k.Vue))})(this,function(k,h){"use strict";const W=/^[a-z0-9]+(-[a-z0-9]+)*$/,L=(e,t,o,i="")=>{const n=e.split(":");if(e.slice(0,1)==="@"){if(n.length<2||n.length>3)return null;i=n.shift().slice(1)}if(n.length>3||!n.length)return null;if(n.length>1){const c=n.pop(),l=n.pop(),f={provider:n.length>0?n[0]:i,prefix:l,name:c};return t&&!O(f)?null:f}const s=n[0],r=s.split("-");if(r.length>1){const c={provider:i,prefix:r.shift(),name:r.join("-")};return t&&!O(c)?null:c}if(o&&i===""){const c={provider:i,prefix:"",name:s};return t&&!O(c,o)?null:c}return null},O=(e,t)=>e?!!((t&&e.prefix===""||e.prefix)&&e.name):!1,K=Object.freeze({left:0,top:0,width:16,height:16}),_=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),A=Object.freeze({...K,..._}),q=Object.freeze({...A,body:"",hidden:!1});function xe(e,t){const o={};!e.hFlip!=!t.hFlip&&(o.hFlip=!0),!e.vFlip!=!t.vFlip&&(o.vFlip=!0);const i=((e.rotate||0)+(t.rotate||0))%4;return i&&(o.rotate=i),o}function J(e,t){const o=xe(e,t);for(const i in q)i in _?i in e&&!(i in o)&&(o[i]=_[i]):i in t?o[i]=t[i]:i in e&&(o[i]=e[i]);return o}function Ie(e,t){const o=e.icons,i=e.aliases||Object.create(null),n=Object.create(null);function s(r){if(o[r])return n[r]=[];if(!(r in n)){n[r]=null;const c=i[r]&&i[r].parent,l=c&&s(c);l&&(n[r]=[c].concat(l))}return n[r]}return Object.keys(o).concat(Object.keys(i)).forEach(s),n}function we(e,t,o){const i=e.icons,n=e.aliases||Object.create(null);let s={};function r(c){s=J(i[c]||n[c],s)}return r(t),o.forEach(r),J(e,s)}function X(e,t){const o=[];if(typeof e!="object"||typeof e.icons!="object")return o;e.not_found instanceof Array&&e.not_found.forEach(n=>{t(n,null),o.push(n)});const i=Ie(e);for(const n in i){const s=i[n];s&&(t(n,we(e,n,s)),o.push(n))}return o}const ke={provider:"",aliases:{},not_found:{},...K};function N(e,t){for(const o in t)if(o in e&&typeof e[o]!=typeof t[o])return!1;return!0}function Y(e){if(typeof e!="object"||e===null)return null;const t=e;if(typeof t.prefix!="string"||!e.icons||typeof e.icons!="object"||!N(e,ke))return null;const o=t.icons;for(const n in o){const s=o[n];if(!n||typeof s.body!="string"||!N(s,q))return null}const i=t.aliases||Object.create(null);for(const n in i){const s=i[n],r=s.parent;if(!n||typeof r!="string"||!o[r]&&!i[r]||!N(s,q))return null}return t}const Z=Object.create(null);function Se(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function C(e,t){const o=Z[e]||(Z[e]=Object.create(null));return o[t]||(o[t]=Se(e,t))}function ee(e,t){return Y(t)?X(t,(o,i)=>{i?e.icons[o]=i:e.missing.add(o)}):[]}function ve(e,t,o){try{if(typeof o.body=="string")return e.icons[t]={...o},!0}catch{}return!1}let P=!1;function te(e){return typeof e=="boolean"&&(P=e),P}function Ce(e){const t=typeof e=="string"?L(e,!0,P):e;if(t){const o=C(t.provider,t.prefix),i=t.name;return o.icons[i]||(o.missing.has(i)?null:void 0)}}function Te(e,t){const o=L(e,!0,P);if(!o)return!1;const i=C(o.provider,o.prefix);return t?ve(i,o.name,t):(i.missing.add(o.name),!0)}function Pe(e,t){if(typeof e!="object")return!1;if(typeof t!="string"&&(t=e.provider||""),P&&!t&&!e.prefix){let n=!1;return Y(e)&&(e.prefix="",X(e,(s,r)=>{Te(s,r)&&(n=!0)})),n}const o=e.prefix;if(!O({prefix:o,name:"a"}))return!1;const i=C(t,o);return!!ee(i,e)}const ne=Object.freeze({width:null,height:null}),oe=Object.freeze({...ne,..._}),je=/(-?[0-9.]*[0-9]+[0-9.]*)/g,Ee=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function ie(e,t,o){if(t===1)return e;if(o=o||100,typeof e=="number")return Math.ceil(e*t*o)/o;if(typeof e!="string")return e;const i=e.split(je);if(i===null||!i.length)return e;const n=[];let s=i.shift(),r=Ee.test(s);for(;;){if(r){const c=parseFloat(s);isNaN(c)?n.push(s):n.push(Math.ceil(c*t*o)/o)}else n.push(s);if(s=i.shift(),s===void 0)return n.join("");r=!r}}function Fe(e,t="defs"){let o="";const i=e.indexOf("<"+t);for(;i>=0;){const n=e.indexOf(">",i),s=e.indexOf("</"+t);if(n===-1||s===-1)break;const r=e.indexOf(">",s);if(r===-1)break;o+=e.slice(n+1,s).trim(),e=e.slice(0,i).trim()+e.slice(r+1)}return{defs:o,content:e}}function Le(e,t){return e?"<defs>"+e+"</defs>"+t:t}function Oe(e,t,o){const i=Fe(e);return Le(i.defs,t+i.content+o)}const _e=e=>e==="unset"||e==="undefined"||e==="none";function Ae(e,t){const o={...A,...e},i={...oe,...t},n={left:o.left,top:o.top,width:o.width,height:o.height};let s=o.body;[o,i].forEach(m=>{const a=[],T=m.hFlip,S=m.vFlip;let I=m.rotate;T?S?I+=2:(a.push("translate("+(n.width+n.left).toString()+" "+(0-n.top).toString()+")"),a.push("scale(-1 1)"),n.top=n.left=0):S&&(a.push("translate("+(0-n.left).toString()+" "+(n.height+n.top).toString()+")"),a.push("scale(1 -1)"),n.top=n.left=0);let b;switch(I<0&&(I-=Math.floor(I/4)*4),I=I%4,I){case 1:b=n.height/2+n.top,a.unshift("rotate(90 "+b.toString()+" "+b.toString()+")");break;case 2:a.unshift("rotate(180 "+(n.width/2+n.left).toString()+" "+(n.height/2+n.top).toString()+")");break;case 3:b=n.width/2+n.left,a.unshift("rotate(-90 "+b.toString()+" "+b.toString()+")");break}I%2===1&&(n.left!==n.top&&(b=n.left,n.left=n.top,n.top=b),n.width!==n.height&&(b=n.width,n.width=n.height,n.height=b)),a.length&&(s=Oe(s,'<g transform="'+a.join(" ")+'">',"</g>"))});const r=i.width,c=i.height,l=n.width,f=n.height;let u,d;r===null?(d=c===null?"1em":c==="auto"?f:c,u=ie(d,l/f)):(u=r==="auto"?l:r,d=c===null?ie(u,f/l):c==="auto"?f:c);const g={},y=(m,a)=>{_e(a)||(g[m]=a.toString())};y("width",u),y("height",d);const w=[n.left,n.top,l,f];return g.viewBox=w.join(" "),{attributes:g,viewBox:w,body:s}}const Me=/\sid="(\S+)"/g,ze="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let Be=0;function qe(e,t=ze){const o=[];let i;for(;i=Me.exec(e);)o.push(i[1]);if(!o.length)return e;const n="suffix"+(Math.random()*16777216|Date.now()).toString(16);return o.forEach(s=>{const r=typeof t=="function"?t(s):t+(Be++).toString(),c=s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+c+')([")]|\\.[a-z])',"g"),"$1"+r+n+"$3")}),e=e.replace(new RegExp(n,"g"),""),e}const R=Object.create(null);function Ne(e,t){R[e]=t}function D(e){return R[e]||R[""]}function U(e){let t;if(typeof e.resources=="string")t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||"/",maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}const $=Object.create(null),j=["https://api.simplesvg.com","https://api.unisvg.com"],M=[];for(;j.length>0;)j.length===1||Math.random()>.5?M.push(j.shift()):M.push(j.pop());$[""]=U({resources:["https://api.iconify.design"].concat(M)});function Re(e,t){const o=U(t);return o===null?!1:($[e]=o,!0)}function Q(e){return $[e]}let se=(()=>{let e;try{if(e=fetch,typeof e=="function")return e}catch{}})();function De(e,t){const o=Q(e);if(!o)return 0;let i;if(!o.maxURL)i=0;else{let n=0;o.resources.forEach(r=>{n=Math.max(n,r.length)});const s=t+".json?icons=";i=o.maxURL-n-o.path.length-s.length}return i}function Ue(e){return e===404}const $e=(e,t,o)=>{const i=[],n=De(e,t),s="icons";let r={type:s,provider:e,prefix:t,icons:[]},c=0;return o.forEach((l,f)=>{c+=l.length+1,c>=n&&f>0&&(i.push(r),r={type:s,provider:e,prefix:t,icons:[]},c=l.length),r.icons.push(l)}),i.push(r),i};function Qe(e){if(typeof e=="string"){const t=Q(e);if(t)return t.path}return"/"}const Ve={prepare:$e,send:(e,t,o)=>{if(!se){o("abort",424);return}let i=Qe(t.provider);switch(t.type){case"icons":{const s=t.prefix,c=t.icons.join(","),l=new URLSearchParams({icons:c});i+=s+".json?"+l.toString();break}case"custom":{const s=t.uri;i+=s.slice(0,1)==="/"?s.slice(1):s;break}default:o("abort",400);return}let n=503;se(e+i).then(s=>{const r=s.status;if(r!==200){setTimeout(()=>{o(Ue(r)?"abort":"next",r)});return}return n=501,s.json()}).then(s=>{if(typeof s!="object"||s===null){setTimeout(()=>{s===404?o("abort",s):o("next",n)});return}setTimeout(()=>{o("success",s)})}).catch(()=>{o("next",n)})}};function He(e){const t={loaded:[],missing:[],pending:[]},o=Object.create(null);e.sort((n,s)=>n.provider!==s.provider?n.provider.localeCompare(s.provider):n.prefix!==s.prefix?n.prefix.localeCompare(s.prefix):n.name.localeCompare(s.name));let i={provider:"",prefix:"",name:""};return e.forEach(n=>{if(i.name===n.name&&i.prefix===n.prefix&&i.provider===n.provider)return;i=n;const s=n.provider,r=n.prefix,c=n.name,l=o[s]||(o[s]=Object.create(null)),f=l[r]||(l[r]=C(s,r));let u;c in f.icons?u=t.loaded:r===""||f.missing.has(c)?u=t.missing:u=t.pending;const d={provider:s,prefix:r,name:c};u.push(d)}),t}function re(e,t){e.forEach(o=>{const i=o.loaderCallbacks;i&&(o.loaderCallbacks=i.filter(n=>n.id!==t))})}function Ge(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;const t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let o=!1;const i=e.provider,n=e.prefix;t.forEach(s=>{const r=s.icons,c=r.pending.length;r.pending=r.pending.filter(l=>{if(l.prefix!==n)return!0;const f=l.name;if(e.icons[f])r.loaded.push({provider:i,prefix:n,name:f});else if(e.missing.has(f))r.missing.push({provider:i,prefix:n,name:f});else return o=!0,!0;return!1}),r.pending.length!==c&&(o||re([e],s.id),s.callback(r.loaded.slice(0),r.missing.slice(0),r.pending.slice(0),s.abort))})}))}let We=0;function Ke(e,t,o){const i=We++,n=re.bind(null,o,i);if(!t.pending.length)return n;const s={id:i,icons:t,callback:e,abort:n};return o.forEach(r=>{(r.loaderCallbacks||(r.loaderCallbacks=[])).push(s)}),n}function Je(e,t=!0,o=!1){const i=[];return e.forEach(n=>{const s=typeof n=="string"?L(n,t,o):n;s&&i.push(s)}),i}var Xe={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function Ye(e,t,o,i){const n=e.resources.length,s=e.random?Math.floor(Math.random()*n):e.index;let r;if(e.random){let p=e.resources.slice(0);for(r=[];p.length>1;){const x=Math.floor(Math.random()*p.length);r.push(p[x]),p=p.slice(0,x).concat(p.slice(x+1))}r=r.concat(p)}else r=e.resources.slice(s).concat(e.resources.slice(0,s));const c=Date.now();let l="pending",f=0,u,d=null,g=[],y=[];typeof i=="function"&&y.push(i);function w(){d&&(clearTimeout(d),d=null)}function m(){l==="pending"&&(l="aborted"),w(),g.forEach(p=>{p.status==="pending"&&(p.status="aborted")}),g=[]}function a(p,x){x&&(y=[]),typeof p=="function"&&y.push(p)}function T(){return{startTime:c,payload:t,status:l,queriesSent:f,queriesPending:g.length,subscribe:a,abort:m}}function S(){l="failed",y.forEach(p=>{p(void 0,u)})}function I(){g.forEach(p=>{p.status==="pending"&&(p.status="aborted")}),g=[]}function b(p,x,F){const B=x!=="success";switch(g=g.filter(v=>v!==p),l){case"pending":break;case"failed":if(B||!e.dataAfterTimeout)return;break;default:return}if(x==="abort"){u=F,S();return}if(B){u=F,g.length||(r.length?G():S());return}if(w(),I(),!e.random){const v=e.resources.indexOf(p.resource);v!==-1&&v!==e.index&&(e.index=v)}l="completed",y.forEach(v=>{v(F)})}function G(){if(l!=="pending")return;w();const p=r.shift();if(p===void 0){if(g.length){d=setTimeout(()=>{w(),l==="pending"&&(I(),S())},e.timeout);return}S();return}const x={status:"pending",resource:p,callback:(F,B)=>{b(x,F,B)}};g.push(x),f++,d=setTimeout(G,e.rotate),o(p,t,x.callback)}return setTimeout(G),T}function ce(e){const t={...Xe,...e};let o=[];function i(){o=o.filter(c=>c().status==="pending")}function n(c,l,f){const u=Ye(t,c,l,(d,g)=>{i(),f&&f(d,g)});return o.push(u),u}function s(c){return o.find(l=>c(l))||null}return{query:n,find:s,setIndex:c=>{t.index=c},getIndex:()=>t.index,cleanup:i}}function le(){}const V=Object.create(null);function Ze(e){if(!V[e]){const t=Q(e);if(!t)return;const o=ce(t),i={config:t,redundancy:o};V[e]=i}return V[e]}function et(e,t,o){let i,n;if(typeof e=="string"){const s=D(e);if(!s)return o(void 0,424),le;n=s.send;const r=Ze(e);r&&(i=r.redundancy)}else{const s=U(e);if(s){i=ce(s);const r=e.resources?e.resources[0]:"",c=D(r);c&&(n=c.send)}}return!i||!n?(o(void 0,424),le):i.query(t,n,o)().abort}function fe(){}function tt(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,Ge(e)}))}function nt(e){const t=[],o=[];return e.forEach(i=>{(i.match(W)?t:o).push(i)}),{valid:t,invalid:o}}function E(e,t,o){function i(){const n=e.pendingIcons;t.forEach(s=>{n&&n.delete(s),e.icons[s]||e.missing.add(s)})}if(o&&typeof o=="object")try{if(!ee(e,o).length){i();return}}catch(n){console.error(n)}i(),tt(e)}function ae(e,t){e instanceof Promise?e.then(o=>{t(o)}).catch(()=>{t(null)}):t(e)}function ot(e,t){e.iconsToLoad?e.iconsToLoad=e.iconsToLoad.concat(t).sort():e.iconsToLoad=t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;const{provider:o,prefix:i}=e,n=e.iconsToLoad;if(delete e.iconsToLoad,!n||!n.length)return;const s=e.loadIcon;if(e.loadIcons&&(n.length>1||!s)){ae(e.loadIcons(n,i,o),u=>{E(e,n,u)});return}if(s){n.forEach(u=>{const d=s(u,i,o);ae(d,g=>{const y=g?{prefix:i,icons:{[u]:g}}:null;E(e,[u],y)})});return}const{valid:r,invalid:c}=nt(n);if(c.length&&E(e,c,null),!r.length)return;const l=i.match(W)?D(o):null;if(!l){E(e,r,null);return}l.prepare(o,i,r).forEach(u=>{et(o,u,d=>{E(e,u.icons,d)})})}))}const it=(e,t)=>{const o=Je(e,!0,te()),i=He(o);if(!i.pending.length){let l=!0;return t&&setTimeout(()=>{l&&t(i.loaded,i.missing,i.pending,fe)}),()=>{l=!1}}const n=Object.create(null),s=[];let r,c;return i.pending.forEach(l=>{const{provider:f,prefix:u}=l;if(u===c&&f===r)return;r=f,c=u,s.push(C(f,u));const d=n[f]||(n[f]=Object.create(null));d[u]||(d[u]=[])}),i.pending.forEach(l=>{const{provider:f,prefix:u,name:d}=l,g=C(f,u),y=g.pendingIcons||(g.pendingIcons=new Set);y.has(d)||(y.add(d),n[f][u].push(d))}),s.forEach(l=>{const f=n[l.provider][l.prefix];f.length&&ot(l,f)}),t?Ke(t,i,s):fe};function st(e,t){const o={...e};for(const i in t){const n=t[i],s=typeof n;i in ne?(n===null||n&&(s==="string"||s==="number"))&&(o[i]=n):s===typeof o[i]&&(o[i]=i==="rotate"?n%4:n)}return o}const rt=/[\s,]+/;function ct(e,t){t.split(rt).forEach(o=>{switch(o.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function lt(e,t=0){const o=e.replace(/^-?[0-9.]*/,"");function i(n){for(;n<0;)n+=4;return n%4}if(o===""){const n=parseInt(e);return isNaN(n)?0:i(n)}else if(o!==e){let n=0;switch(o){case"%":n=25;break;case"deg":n=90}if(n){let s=parseFloat(e.slice(0,e.length-o.length));return isNaN(s)?0:(s=s/n,s%1===0?i(s):0)}}return t}function ft(e,t){let o=e.indexOf("xlink:")===-1?"":' xmlns:xlink="http://www.w3.org/1999/xlink"';for(const i in t)o+=" "+i+'="'+t[i]+'"';return'<svg xmlns="http://www.w3.org/2000/svg"'+o+">"+e+"</svg>"}function at(e){return e.replace(/"/g,"'").replace(/%/g,"%25").replace(/#/g,"%23").replace(/</g,"%3C").replace(/>/g,"%3E").replace(/\s+/g," ")}function ut(e){return"data:image/svg+xml,"+at(e)}function dt(e){return'url("'+ut(e)+'")'}const ue={...oe,inline:!1},ht={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"},pt={display:"inline-block"},H={backgroundColor:"currentColor"},de={backgroundColor:"transparent"},he={Image:"var(--svg)",Repeat:"no-repeat",Size:"100% 100%"},pe={webkitMask:H,mask:H,background:de};for(const e in pe){const t=pe[e];for(const o in he)t[e+o]=he[o]}const z={};["horizontal","vertical"].forEach(e=>{const t=e.slice(0,1)+"Flip";z[e+"-flip"]=t,z[e.slice(0,1)+"-flip"]=t,z[e+"Flip"]=t});function ge(e){return e+(e.match(/^[-0-9.]+$/)?"px":"")}const me=(e,t)=>{const o=st(ue,t),i={...ht},n=t.mode||"svg",s={},r=t.style,c=typeof r=="object"&&!(r instanceof Array)?r:{};for(let m in t){const a=t[m];if(a!==void 0)switch(m){case"icon":case"style":case"onLoad":case"mode":case"ssr":break;case"inline":case"hFlip":case"vFlip":o[m]=a===!0||a==="true"||a===1;break;case"flip":typeof a=="string"&&ct(o,a);break;case"color":s.color=a;break;case"rotate":typeof a=="string"?o[m]=lt(a):typeof a=="number"&&(o[m]=a);break;case"ariaHidden":case"aria-hidden":a!==!0&&a!=="true"&&delete i["aria-hidden"];break;default:{const T=z[m];T?(a===!0||a==="true"||a===1)&&(o[T]=!0):ue[m]===void 0&&(i[m]=a)}}}const l=Ae(e,o),f=l.attributes;if(o.inline&&(s.verticalAlign="-0.125em"),n==="svg"){i.style={...s,...c},Object.assign(i,f);let m=0,a=t.id;return typeof a=="string"&&(a=a.replace(/-/g,"_")),i.innerHTML=qe(l.body,a?()=>a+"ID"+m++:"iconifyVue"),h.h("svg",i)}const{body:u,width:d,height:g}=e,y=n==="mask"||(n==="bg"?!1:u.indexOf("currentColor")!==-1),w=ft(u,{...f,width:d+"",height:g+""});return i.style={...s,"--svg":dt(w),width:ge(f.width),height:ge(f.height),...pt,...y?H:de,...c},h.h("span",i)};if(te(!0),Ne("",Ve),typeof document<"u"&&typeof window<"u"){const e=window;if(e.IconifyPreload!==void 0){const t=e.IconifyPreload,o="Invalid IconifyPreload syntax.";typeof t=="object"&&t!==null&&(t instanceof Array?t:[t]).forEach(i=>{try{(typeof i!="object"||i===null||i instanceof Array||typeof i.icons!="object"||typeof i.prefix!="string"||!Pe(i))&&console.error(o)}catch{console.error(o)}})}if(e.IconifyProviders!==void 0){const t=e.IconifyProviders;if(typeof t=="object"&&t!==null)for(let o in t){const i="IconifyProviders["+o+"] is invalid.";try{const n=t[o];if(typeof n!="object"||!n||n.resources===void 0)continue;Re(o,n)||console.error(i)}catch{console.error(i)}}}}const gt={...A,body:""},mt=h.defineComponent({inheritAttrs:!1,data(){return{_name:"",_loadingIcon:null,iconMounted:!1,counter:0}},mounted(){this.iconMounted=!0},unmounted(){this.abortLoading()},methods:{abortLoading(){this._loadingIcon&&(this._loadingIcon.abort(),this._loadingIcon=null)},getIcon(e,t,o){if(typeof e=="object"&&e!==null&&typeof e.body=="string")return this._name="",this.abortLoading(),{data:e};let i;if(typeof e!="string"||(i=L(e,!1,!0))===null)return this.abortLoading(),null;let n=Ce(i);if(!n)return(!this._loadingIcon||this._loadingIcon.name!==e)&&(this.abortLoading(),this._name="",n!==null&&(this._loadingIcon={name:e,abort:it([i],()=>{this.counter++})})),null;if(this.abortLoading(),this._name!==e&&(this._name=e,t&&t(e)),o){n=Object.assign({},n);const r=o(n.body,i.name,i.prefix,i.provider);typeof r=="string"&&(n.body=r)}const s=["iconify"];return i.prefix!==""&&s.push("iconify--"+i.prefix),i.provider!==""&&s.push("iconify--"+i.provider),{data:n,classes:s}}},render(){this.counter;const e=this.$attrs,t=this.iconMounted||e.ssr?this.getIcon(e.icon,e.onLoad,e.customise):null;if(!t)return me(gt,e);let o=e;return t.classes&&(o={...e,class:(typeof e.class=="string"?e.class+" ":"")+t.classes.join(" ")}),me({...A,...t.data},o)}}),ye=(e,t)=>{const o=e.__vccOpts||e;for(const[i,n]of t)o[i]=n;return o},yt=["src"],be=ye({__name:"BaseIcon",props:{icon:{type:String,required:!0,description:"Predefined icon string or any iconify value."},color:{type:String,required:!1,default:"",description:"Color of the icon."},circle:{type:Boolean,required:!1,default:!1,description:"Shows the icon in a circle."},size:{type:String,required:!1,default:"14px",description:"Size of the icon."},alignText:{type:Boolean,required:!1,default:!1,description:"Vertically aligns the icon and text."}},setup(e){const t=e,o=h.computed(()=>t.circle?{backgroundColor:t.color,color:"white",borderRadius:"50%",padding:"3px"}:t.color?{color:t.color}:null);return(i,n)=>{var s;return h.openBlock(),h.createElementBlock("div",{style:h.normalizeStyle({fontSize:e.size}),class:h.normalizeClass([{"align-sub":e.alignText},"base-icon__wrapper"])},[(s=e.icon)!=null&&s.startsWith("https")?(h.openBlock(),h.createElementBlock("img",{key:0,src:e.icon,class:"image-icon"},null,8,yt)):(h.openBlock(),h.createBlock(h.unref(mt),{key:1,icon:e.icon,style:h.normalizeStyle(o.value)},null,8,["icon","style"]))],6)}}},[["__scopeId","data-v-af0f176c"]]),bt={class:"user-image__wrapper"},xt=["src"],It=ye({__name:"UserImage",props:{image:{type:String,required:!1,default:"",description:"The image for the user, if not provided defaults to a user icon."},size:{type:String,required:!1,default:"14px",description:"Size of the image."},bgColor:{type:String,required:!1,default:"#616161",description:"Background color when showing the user icon."},iconColor:{type:String,required:!1,default:"#fff",description:"Color when showing the user icon."}},setup(e){return h.useCssVars(t=>({"37a07012":e.iconColor})),(t,o)=>(h.openBlock(),h.createElementBlock("div",bt,[e.image?(h.openBlock(),h.createElementBlock("img",{key:0,src:e.image,style:h.normalizeStyle({fontSize:e.size}),class:"user-image"},null,12,xt)):(h.openBlock(),h.createBlock(be,{key:1,icon:"ph:user-fill",size:e.size,circle:"",color:e.bgColor,class:"user-icon"},null,8,["size","color"]))]))}},[["__scopeId","data-v-5fa938c7"]]);k.BaseIcon=be,k.UserImage=It,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "vue-quest-ui",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist",
|
|
8
|
+
"src/components/"
|
|
9
|
+
],
|
|
10
|
+
"main": "./dist/vue-quest-ui.umd.js",
|
|
11
|
+
"module": "./dist/vue-quest-ui.js",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/vue-quest-ui.esm.js",
|
|
15
|
+
"require": "./dist/vue-quest-ui.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"description": "A reusable component library",
|
|
19
|
+
"keywords": [
|
|
20
|
+
"vue",
|
|
21
|
+
"vue3",
|
|
22
|
+
"component",
|
|
23
|
+
"library"
|
|
24
|
+
],
|
|
25
|
+
"author": "Melissa Lee",
|
|
26
|
+
"scripts": {
|
|
27
|
+
"start": "npm run dev",
|
|
28
|
+
"dev": "vite",
|
|
29
|
+
"build": "vite build",
|
|
30
|
+
"preview": "vite preview"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"vue": "^3.5.13"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@vitejs/plugin-vue": "^5.2.1",
|
|
37
|
+
"vite": "^6.2.0",
|
|
38
|
+
"vue": "^3.5.13"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@iconify/vue": "^4.3.0"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { Icon } from '@iconify/vue';
|
|
3
|
+
import { computed } from 'vue';
|
|
4
|
+
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
icon: {
|
|
7
|
+
type: String,
|
|
8
|
+
required: true,
|
|
9
|
+
description: 'Predefined icon string or any iconify value.',
|
|
10
|
+
},
|
|
11
|
+
color: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: false,
|
|
14
|
+
default: '',
|
|
15
|
+
description: 'Color of the icon.',
|
|
16
|
+
},
|
|
17
|
+
circle: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
required: false,
|
|
20
|
+
default: false,
|
|
21
|
+
description: 'Shows the icon in a circle.',
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
type: String,
|
|
25
|
+
required: false,
|
|
26
|
+
default: '14px',
|
|
27
|
+
description: 'Size of the icon.'
|
|
28
|
+
},
|
|
29
|
+
alignText: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
required: false,
|
|
32
|
+
default: false,
|
|
33
|
+
description: 'Vertically aligns the icon and text.',
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const iconStyle = computed(() => {
|
|
38
|
+
if(props.circle){
|
|
39
|
+
return {
|
|
40
|
+
backgroundColor: props.color,
|
|
41
|
+
color: 'white',
|
|
42
|
+
borderRadius: '50%',
|
|
43
|
+
padding: '3px',
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return !!props.color ? { color: props.color } : null;
|
|
47
|
+
});
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<div :style="{fontSize: size}" :class="{'align-sub': alignText}" class="base-icon__wrapper">
|
|
52
|
+
<img v-if="icon?.startsWith('https')" :src="icon" class="image-icon">
|
|
53
|
+
<icon v-else :icon="icon" :style="iconStyle" />
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<style scoped>
|
|
58
|
+
.base-icon__wrapper{
|
|
59
|
+
display: inline-flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
}
|
|
63
|
+
.image-icon{
|
|
64
|
+
width: 1.1em;
|
|
65
|
+
}
|
|
66
|
+
</style>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import BaseIcon from '../ui/BaseIcon.vue';
|
|
3
|
+
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
image: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: false,
|
|
8
|
+
default: '',
|
|
9
|
+
description: 'The image for the user, if not provided defaults to a user icon.'
|
|
10
|
+
},
|
|
11
|
+
size: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: false,
|
|
14
|
+
default: '14px',
|
|
15
|
+
description: 'Size of the image.'
|
|
16
|
+
},
|
|
17
|
+
bgColor: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: false,
|
|
20
|
+
default: '#616161',
|
|
21
|
+
description: 'Background color when showing the user icon.'
|
|
22
|
+
},
|
|
23
|
+
iconColor: {
|
|
24
|
+
type: String,
|
|
25
|
+
required: false,
|
|
26
|
+
default: '#fff',
|
|
27
|
+
description: 'Color when showing the user icon.'
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<div class="user-image__wrapper">
|
|
35
|
+
<img v-if="!!image" :src="image" :style="{fontSize: size}" class="user-image" />
|
|
36
|
+
<base-icon v-else icon="ph:user-fill" :size="size" circle :color="bgColor" class="user-icon" />
|
|
37
|
+
</div>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<style scoped>
|
|
41
|
+
.user-image__wrapper{
|
|
42
|
+
display: inline-block;
|
|
43
|
+
}
|
|
44
|
+
.user-image{
|
|
45
|
+
border-radius: 50%;
|
|
46
|
+
width: 2.35em;
|
|
47
|
+
}
|
|
48
|
+
.user-icon{
|
|
49
|
+
color: v-bind(iconColor);
|
|
50
|
+
:deep(svg){
|
|
51
|
+
width: 2.3em;
|
|
52
|
+
height: 2.3em;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
</style>
|