New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@gits-id/icon

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gits-id/icon - npm Package Compare versions

Comparing version 0.11.1 to 0.11.2-alpha.5

2

dist/icon.cjs.js

@@ -1,1 +0,1 @@

"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var s=require("vue"),y=require("@iconify/vue");const d=Object.freeze({left:0,top:0,width:16,height:16,rotate:0,vFlip:!1,hFlip:!1});function k(t){return{...d,...t}}for(const t in d)d[t];const w=Object.freeze({inline:!1,width:null,height:null,hAlign:"center",vAlign:"middle",slice:!1,hFlip:!1,vFlip:!1,rotate:0});function m(t,i){const e={};for(const r in t){const n=r;if(e[n]=t[n],i[n]===void 0)continue;const l=i[n];switch(n){case"inline":case"slice":typeof l=="boolean"&&(e[n]=l);break;case"hFlip":case"vFlip":l===!0&&(e[n]=!e[n]);break;case"hAlign":case"vAlign":typeof l=="string"&&l!==""&&(e[n]=l);break;case"width":case"height":(typeof l=="string"&&l!==""||typeof l=="number"&&l||l===null)&&(e[n]=l);break;case"rotate":typeof l=="number"&&(e[n]+=l);break}}return e}const v=/[\s,]+/;function S(t,i){i.split(v).forEach(e=>{switch(e.trim()){case"horizontal":t.hFlip=!0;break;case"vertical":t.vFlip=!0;break}})}function F(t,i){i.split(v).forEach(e=>{const r=e.trim();switch(r){case"left":case"center":case"right":t.hAlign=r;break;case"top":case"middle":case"bottom":t.vAlign=r;break;case"slice":case"crop":t.slice=!0;break;case"meet":t.slice=!1}})}function A(t,i=0){const e=t.replace(/^-?[0-9.]*/,"");function r(n){for(;n<0;)n+=4;return n%4}if(e===""){const n=parseInt(t);return isNaN(n)?0:r(n)}else if(e!==t){let n=0;switch(e){case"%":n=25;break;case"deg":n=90}if(n){let l=parseFloat(t.slice(0,t.length-e.length));return isNaN(l)?0:(l=l/n,l%1===0?r(l):0)}}return i}const I=/(-?[0-9.]*[0-9]+[0-9.]*)/g,M=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function p(t,i,e){if(i===1)return t;if(e=e===void 0?100:e,typeof t=="number")return Math.ceil(t*i*e)/e;if(typeof t!="string")return t;const r=t.split(I);if(r===null||!r.length)return t;const n=[];let l=r.shift(),h=M.test(l);for(;;){if(h){const c=parseFloat(l);isNaN(c)?n.push(l):n.push(Math.ceil(c*i*e)/e)}else n.push(l);if(l=r.shift(),l===void 0)return n.join("");h=!h}}function _(t){let i="";switch(t.hAlign){case"left":i+="xMin";break;case"right":i+="xMax";break;default:i+="xMid"}switch(t.vAlign){case"top":i+="YMin";break;case"bottom":i+="YMax";break;default:i+="YMid"}return i+=t.slice?" slice":" meet",i}function j(t,i){const e={left:t.left,top:t.top,width:t.width,height:t.height};let r=t.body;[t,i].forEach(c=>{const o=[],a=c.hFlip,b=c.vFlip;let u=c.rotate;a?b?u+=2:(o.push("translate("+(e.width+e.left).toString()+" "+(0-e.top).toString()+")"),o.push("scale(-1 1)"),e.top=e.left=0):b&&(o.push("translate("+(0-e.left).toString()+" "+(e.height+e.top).toString()+")"),o.push("scale(1 -1)"),e.top=e.left=0);let f;switch(u<0&&(u-=Math.floor(u/4)*4),u=u%4,u){case 1:f=e.height/2+e.top,o.unshift("rotate(90 "+f.toString()+" "+f.toString()+")");break;case 2:o.unshift("rotate(180 "+(e.width/2+e.left).toString()+" "+(e.height/2+e.top).toString()+")");break;case 3:f=e.width/2+e.left,o.unshift("rotate(-90 "+f.toString()+" "+f.toString()+")");break}u%2===1&&((e.left!==0||e.top!==0)&&(f=e.left,e.left=e.top,e.top=f),e.width!==e.height&&(f=e.width,e.width=e.height,e.height=f)),o.length&&(r='<g transform="'+o.join(" ")+'">'+r+"</g>")});let n,l;i.width===null&&i.height===null?(l="1em",n=p(l,e.width/e.height)):i.width!==null&&i.height!==null?(n=i.width,l=i.height):i.height!==null?(l=i.height,n=p(l,e.width/e.height)):(n=i.width,l=p(n,e.height/e.width)),n==="auto"&&(n=e.width),l==="auto"&&(l=e.height),n=typeof n=="string"?n:n.toString()+"",l=typeof l=="string"?l:l.toString()+"";const h={attributes:{width:n,height:l,preserveAspectRatio:_(i),viewBox:e.left.toString()+" "+e.top.toString()+" "+e.width.toString()+" "+e.height.toString()},body:r};return i.inline&&(h.inline=!0),h}const E=/\sid="(\S+)"/g,$="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let D=0;function x(t,i=$){const e=[];let r;for(;r=E.exec(t);)e.push(r[1]);return e.length&&e.forEach(n=>{const l=typeof i=="function"?i(n):i+(D++).toString(),h=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(new RegExp('([#;"])('+h+')([")]|\\.[a-z])',"g"),"$1"+l+"$3")}),t}const B={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"};let g={};["horizontal","vertical"].forEach(t=>{["Align","Flip"].forEach(i=>{const r={attr:t.slice(0,1)+i,boolean:i==="Flip"};g[t+"-"+i.toLowerCase()]=r,g[t.slice(0,1)+"-"+i.toLowerCase()]=r,g[t+i]=r})});const C=(t,i)=>{const e=m(w,i),r={...B};let n=typeof i.style=="object"&&!(i.style instanceof Array)?{...i.style}:{};for(let o in i){const a=i[o];if(a!==void 0)switch(o){case"icon":case"style":case"onLoad":break;case"inline":case"hFlip":case"vFlip":e[o]=a===!0||a==="true"||a===1;break;case"flip":typeof a=="string"&&S(e,a);break;case"align":typeof a=="string"&&F(e,a);break;case"color":n.color=a;break;case"rotate":typeof a=="string"?e[o]=A(a):typeof a=="number"&&(e[o]=a);break;case"ariaHidden":case"aria-hidden":a!==!0&&a!=="true"&&delete r["aria-hidden"];break;default:g[o]!==void 0?g[o].boolean&&(a===!0||a==="true"||a===1)?e[g[o].attr]=!0:!g[o].boolean&&typeof a=="string"&&a!==""&&(e[g[o].attr]=a):w[o]===void 0&&(r[o]=a)}}const l=j(t,e);for(let o in l.attributes)r[o]=l.attributes[o];l.inline&&n.verticalAlign===void 0&&n["vertical-align"]===void 0&&(n.verticalAlign="-0.125em");let h=0,c=i.id;return typeof c=="string"&&(c=c.replace(/-/g,"_")),r.innerHTML=x(l.body,c?()=>c+"ID"+h++:"iconifyVue"),Object.keys(n).length>0&&(r.style=n),s.h("svg",r)},N=Object.create(null),O=s.defineComponent({inheritAttrs:!1,render(){const t=this.$attrs,i=typeof t.icon=="string"?N[t.icon]:typeof t.icon=="object"?k(t.icon):null;return i===null||typeof i!="object"||typeof i.body!="string"?this.$slots.default?this.$slots.default():null:C(i,t)}}),P={key:0,class:"inline-block w-5 h-5"},L={key:2},T=s.defineComponent({__name:"Icon",props:{name:{type:String,required:!0}},setup(t){const i=t,e=s.ref(!1),r=s.ref();async function n(){e.value=!0,r.value=await y.loadIcon(i.name).catch(()=>{}),e.value=!1}return s.watch(()=>i.name,n),n(),(l,h)=>e.value?(s.openBlock(),s.createElementBlock("span",P)):r.value?(s.openBlock(),s.createBlock(s.unref(O),{key:1,icon:r.value,class:"inline-block w-5 h-5"},null,8,["icon"])):(s.openBlock(),s.createElementBlock("span",L,s.toDisplayString(t.name),1))}});exports.Icon=T;
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var e=require("vue"),i=require("@iconify/vue/dist/offline"),r=require("@iconify/vue");const u={key:0,class:"inline-block w-5 h-5"},s={key:2},l=e.defineComponent({__name:"Icon",props:{name:{type:String,required:!0}},setup(c){const t=c,n=e.ref(!1),o=e.ref();async function a(){n.value=!0,o.value=await r.loadIcon(t.name).catch(()=>{}),n.value=!1}return e.watch(()=>t.name,a),a(),(f,v)=>n.value?(e.openBlock(),e.createElementBlock("span",u)):o.value?(e.openBlock(),e.createBlock(e.unref(i.Icon),{key:1,icon:o.value,class:"inline-block w-5 h-5"},null,8,["icon"])):(e.openBlock(),e.createElementBlock("span",s,e.toDisplayString(c.name),1))}});exports.Icon=l;exports.default=l;

@@ -1,501 +0,5 @@

import { defineComponent, h, ref, watch, openBlock, createElementBlock, createBlock, unref, toDisplayString } from 'vue';
import { defineComponent, ref, watch, openBlock, createElementBlock, createBlock, unref, toDisplayString } from 'vue';
import { Icon } from '@iconify/vue/dist/offline';
import { loadIcon } from '@iconify/vue';
const iconDefaults = Object.freeze({
left: 0,
top: 0,
width: 16,
height: 16,
rotate: 0,
vFlip: false,
hFlip: false
});
function fullIcon(data) {
return { ...iconDefaults, ...data };
}
for (const prop in iconDefaults) {
typeof iconDefaults[prop];
}
const defaults = Object.freeze({
inline: false,
width: null,
height: null,
hAlign: "center",
vAlign: "middle",
slice: false,
hFlip: false,
vFlip: false,
rotate: 0
});
function mergeCustomisations(defaults2, item) {
const result = {};
for (const key in defaults2) {
const attr = key;
result[attr] = defaults2[attr];
if (item[attr] === void 0) {
continue;
}
const value = item[attr];
switch (attr) {
case "inline":
case "slice":
if (typeof value === "boolean") {
result[attr] = value;
}
break;
case "hFlip":
case "vFlip":
if (value === true) {
result[attr] = !result[attr];
}
break;
case "hAlign":
case "vAlign":
if (typeof value === "string" && value !== "") {
result[attr] = value;
}
break;
case "width":
case "height":
if (typeof value === "string" && value !== "" || typeof value === "number" && value || value === null) {
result[attr] = value;
}
break;
case "rotate":
if (typeof value === "number") {
result[attr] += value;
}
break;
}
}
return result;
}
const separator = /[\s,]+/;
function flipFromString(custom, flip) {
flip.split(separator).forEach((str) => {
const value = str.trim();
switch (value) {
case "horizontal":
custom.hFlip = true;
break;
case "vertical":
custom.vFlip = true;
break;
}
});
}
function alignmentFromString(custom, align) {
align.split(separator).forEach((str) => {
const value = str.trim();
switch (value) {
case "left":
case "center":
case "right":
custom.hAlign = value;
break;
case "top":
case "middle":
case "bottom":
custom.vAlign = value;
break;
case "slice":
case "crop":
custom.slice = true;
break;
case "meet":
custom.slice = false;
}
});
}
function rotateFromString(value, defaultValue = 0) {
const units = value.replace(/^-?[0-9.]*/, "");
function cleanup(value2) {
while (value2 < 0) {
value2 += 4;
}
return value2 % 4;
}
if (units === "") {
const num = parseInt(value);
return isNaN(num) ? 0 : cleanup(num);
} else if (units !== value) {
let split = 0;
switch (units) {
case "%":
split = 25;
break;
case "deg":
split = 90;
}
if (split) {
let num = parseFloat(value.slice(0, value.length - units.length));
if (isNaN(num)) {
return 0;
}
num = num / split;
return num % 1 === 0 ? cleanup(num) : 0;
}
}
return defaultValue;
}
const unitsSplit = /(-?[0-9.]*[0-9]+[0-9.]*)/g;
const unitsTest = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
function calculateSize(size, ratio, precision) {
if (ratio === 1) {
return size;
}
precision = precision === void 0 ? 100 : precision;
if (typeof size === "number") {
return Math.ceil(size * ratio * precision) / precision;
}
if (typeof size !== "string") {
return size;
}
const oldParts = size.split(unitsSplit);
if (oldParts === null || !oldParts.length) {
return size;
}
const newParts = [];
let code = oldParts.shift();
let isNumber = unitsTest.test(code);
while (true) {
if (isNumber) {
const num = parseFloat(code);
if (isNaN(num)) {
newParts.push(code);
} else {
newParts.push(Math.ceil(num * ratio * precision) / precision);
}
} else {
newParts.push(code);
}
code = oldParts.shift();
if (code === void 0) {
return newParts.join("");
}
isNumber = !isNumber;
}
}
function preserveAspectRatio(props) {
let result = "";
switch (props.hAlign) {
case "left":
result += "xMin";
break;
case "right":
result += "xMax";
break;
default:
result += "xMid";
}
switch (props.vAlign) {
case "top":
result += "YMin";
break;
case "bottom":
result += "YMax";
break;
default:
result += "YMid";
}
result += props.slice ? " slice" : " meet";
return result;
}
function iconToSVG(icon, customisations) {
const box = {
left: icon.left,
top: icon.top,
width: icon.width,
height: icon.height
};
let body = icon.body;
[icon, customisations].forEach((props) => {
const transformations = [];
const hFlip = props.hFlip;
const vFlip = props.vFlip;
let rotation = props.rotate;
if (hFlip) {
if (vFlip) {
rotation += 2;
} else {
transformations.push("translate(" + (box.width + box.left).toString() + " " + (0 - box.top).toString() + ")");
transformations.push("scale(-1 1)");
box.top = box.left = 0;
}
} else if (vFlip) {
transformations.push("translate(" + (0 - box.left).toString() + " " + (box.height + box.top).toString() + ")");
transformations.push("scale(1 -1)");
box.top = box.left = 0;
}
let tempValue;
if (rotation < 0) {
rotation -= Math.floor(rotation / 4) * 4;
}
rotation = rotation % 4;
switch (rotation) {
case 1:
tempValue = box.height / 2 + box.top;
transformations.unshift("rotate(90 " + tempValue.toString() + " " + tempValue.toString() + ")");
break;
case 2:
transformations.unshift("rotate(180 " + (box.width / 2 + box.left).toString() + " " + (box.height / 2 + box.top).toString() + ")");
break;
case 3:
tempValue = box.width / 2 + box.left;
transformations.unshift("rotate(-90 " + tempValue.toString() + " " + tempValue.toString() + ")");
break;
}
if (rotation % 2 === 1) {
if (box.left !== 0 || box.top !== 0) {
tempValue = box.left;
box.left = box.top;
box.top = tempValue;
}
if (box.width !== box.height) {
tempValue = box.width;
box.width = box.height;
box.height = tempValue;
}
}
if (transformations.length) {
body = '<g transform="' + transformations.join(" ") + '">' + body + "</g>";
}
});
let width, height;
if (customisations.width === null && customisations.height === null) {
height = "1em";
width = calculateSize(height, box.width / box.height);
} else if (customisations.width !== null && customisations.height !== null) {
width = customisations.width;
height = customisations.height;
} else if (customisations.height !== null) {
height = customisations.height;
width = calculateSize(height, box.width / box.height);
} else {
width = customisations.width;
height = calculateSize(width, box.height / box.width);
}
if (width === "auto") {
width = box.width;
}
if (height === "auto") {
height = box.height;
}
width = typeof width === "string" ? width : width.toString() + "";
height = typeof height === "string" ? height : height.toString() + "";
const result = {
attributes: {
width,
height,
preserveAspectRatio: preserveAspectRatio(customisations),
viewBox: box.left.toString() + " " + box.top.toString() + " " + box.width.toString() + " " + box.height.toString()
},
body
};
if (customisations.inline) {
result.inline = true;
}
return result;
}
const regex = /\sid="(\S+)"/g;
const randomPrefix = "IconifyId" + Date.now().toString(16) + (Math.random() * 16777216 | 0).toString(16);
let counter = 0;
function replaceIDs(body, prefix = randomPrefix) {
const ids = [];
let match;
while (match = regex.exec(body)) {
ids.push(match[1]);
}
if (!ids.length) {
return body;
}
ids.forEach((id) => {
const newID = typeof prefix === "function" ? prefix(id) : prefix + (counter++).toString();
const escapedID = id.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
body = body.replace(new RegExp('([#;"])(' + escapedID + ')([")]|\\.[a-z])', "g"), "$1" + newID + "$3");
});
return body;
}
/**
* Default SVG attributes
*/
const svgDefaults = {
'xmlns': 'http://www.w3.org/2000/svg',
'xmlns:xlink': 'http://www.w3.org/1999/xlink',
'aria-hidden': true,
'role': 'img',
};
/**
* Aliases for customisations.
* In Vue 'v-' properties are reserved, so v-align and v-flip must be renamed
*/
let customisationAliases = {};
['horizontal', 'vertical'].forEach((prefix) => {
['Align', 'Flip'].forEach((suffix) => {
const attr = prefix.slice(0, 1) + suffix;
const value = {
attr,
boolean: suffix === 'Flip',
};
// vertical-align
customisationAliases[prefix + '-' + suffix.toLowerCase()] = value;
// v-align
customisationAliases[prefix.slice(0, 1) + '-' + suffix.toLowerCase()] =
value;
// verticalAlign
customisationAliases[prefix + suffix] = value;
});
});
/**
* Render icon
*/
const render = (
// Icon must be validated before calling this function
icon,
// Partial properties
props) => {
// Split properties
const customisations = mergeCustomisations(defaults, props);
const componentProps = { ...svgDefaults };
// Copy style
let style = typeof props.style === 'object' && !(props.style instanceof Array)
? { ...props.style }
: {};
// Get element properties
for (let key in props) {
const value = props[key];
if (value === void 0) {
continue;
}
switch (key) {
// Properties to ignore
case 'icon':
case 'style':
case 'onLoad':
break;
// Boolean attributes
case 'inline':
case 'hFlip':
case 'vFlip':
customisations[key] =
value === true || value === 'true' || value === 1;
break;
// Flip as string: 'horizontal,vertical'
case 'flip':
if (typeof value === 'string') {
flipFromString(customisations, value);
}
break;
// Alignment as string
case 'align':
if (typeof value === 'string') {
alignmentFromString(customisations, value);
}
break;
// Color: override style
case 'color':
style.color = value;
break;
// Rotation as string
case 'rotate':
if (typeof value === 'string') {
customisations[key] = rotateFromString(value);
}
else if (typeof value === 'number') {
customisations[key] = value;
}
break;
// Remove aria-hidden
case 'ariaHidden':
case 'aria-hidden':
// Vue transforms 'aria-hidden' property to 'ariaHidden'
if (value !== true && value !== 'true') {
delete componentProps['aria-hidden'];
}
break;
default:
if (customisationAliases[key] !== void 0) {
// Aliases for customisations
if (customisationAliases[key].boolean &&
(value === true || value === 'true' || value === 1)) {
// Check for boolean
customisations[customisationAliases[key].attr] = true;
}
else if (!customisationAliases[key].boolean &&
typeof value === 'string' &&
value !== '') {
// String
customisations[customisationAliases[key].attr] = value;
}
}
else if (defaults[key] === void 0) {
// Copy missing property if it does not exist in customisations
componentProps[key] = value;
}
}
}
// Generate icon
const item = iconToSVG(icon, customisations);
// Add icon stuff
for (let key in item.attributes) {
componentProps[key] = item.attributes[key];
}
if (item.inline &&
style.verticalAlign === void 0 &&
style['vertical-align'] === void 0) {
style.verticalAlign = '-0.125em';
}
// Counter for ids based on "id" property to render icons consistently on server and client
let localCounter = 0;
let id = props.id;
if (typeof id === 'string') {
// Convert '-' to '_' to avoid errors in animations
id = id.replace(/-/g, '_');
}
// Add innerHTML and style to props
componentProps['innerHTML'] = replaceIDs(item.body, id ? () => id + 'ID' + localCounter++ : 'iconifyVue');
if (Object.keys(style).length > 0) {
componentProps['style'] = style;
}
// Render icon
return h('svg', componentProps);
};
/**
* Storage for icons referred by name
*/
const storage = Object.create(null);
/**
* Component
*/
const Icon = defineComponent({
// Do not inherit other attributes: it is handled by render()
inheritAttrs: false,
// Render icon
render() {
const props = this.$attrs;
// Check icon
const icon = typeof props.icon === 'string'
? storage[props.icon]
: typeof props.icon === 'object'
? fullIcon(props.icon)
: null;
// Validate icon object
if (icon === null ||
typeof icon !== 'object' ||
typeof icon.body !== 'string') {
return this.$slots.default ? this.$slots.default() : null;
}
// Valid icon: render it
return render(icon, props);
},
});
const _hoisted_1 = {

@@ -536,2 +40,2 @@ key: 0,

export { _sfc_main as Icon };
export { _sfc_main as Icon, _sfc_main as default };

@@ -1,1 +0,1 @@

var VIcon=function(p,c,m){"use strict";const d=Object.freeze({left:0,top:0,width:16,height:16,rotate:0,vFlip:!1,hFlip:!1});function S(e){return{...d,...e}}for(const e in d)d[e];const w=Object.freeze({inline:!1,width:null,height:null,hAlign:"center",vAlign:"middle",slice:!1,hFlip:!1,vFlip:!1,rotate:0});function v(e,n){const t={};for(const r in e){const i=r;if(t[i]=e[i],n[i]===void 0)continue;const l=n[i];switch(i){case"inline":case"slice":typeof l=="boolean"&&(t[i]=l);break;case"hFlip":case"vFlip":l===!0&&(t[i]=!t[i]);break;case"hAlign":case"vAlign":typeof l=="string"&&l!==""&&(t[i]=l);break;case"width":case"height":(typeof l=="string"&&l!==""||typeof l=="number"&&l||l===null)&&(t[i]=l);break;case"rotate":typeof l=="number"&&(t[i]+=l);break}}return t}const k=/[\s,]+/;function F(e,n){n.split(k).forEach(t=>{switch(t.trim()){case"horizontal":e.hFlip=!0;break;case"vertical":e.vFlip=!0;break}})}function A(e,n){n.split(k).forEach(t=>{const r=t.trim();switch(r){case"left":case"center":case"right":e.hAlign=r;break;case"top":case"middle":case"bottom":e.vAlign=r;break;case"slice":case"crop":e.slice=!0;break;case"meet":e.slice=!1}})}function I(e,n=0){const t=e.replace(/^-?[0-9.]*/,"");function r(i){for(;i<0;)i+=4;return i%4}if(t===""){const i=parseInt(e);return isNaN(i)?0:r(i)}else if(t!==e){let i=0;switch(t){case"%":i=25;break;case"deg":i=90}if(i){let l=parseFloat(e.slice(0,e.length-t.length));return isNaN(l)?0:(l=l/i,l%1===0?r(l):0)}}return n}const M=/(-?[0-9.]*[0-9]+[0-9.]*)/g,_=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function b(e,n,t){if(n===1)return e;if(t=t===void 0?100:t,typeof e=="number")return Math.ceil(e*n*t)/t;if(typeof e!="string")return e;const r=e.split(M);if(r===null||!r.length)return e;const i=[];let l=r.shift(),h=_.test(l);for(;;){if(h){const s=parseFloat(l);isNaN(s)?i.push(l):i.push(Math.ceil(s*n*t)/t)}else i.push(l);if(l=r.shift(),l===void 0)return i.join("");h=!h}}function j(e){let n="";switch(e.hAlign){case"left":n+="xMin";break;case"right":n+="xMax";break;default:n+="xMid"}switch(e.vAlign){case"top":n+="YMin";break;case"bottom":n+="YMax";break;default:n+="YMid"}return n+=e.slice?" slice":" meet",n}function E(e,n){const t={left:e.left,top:e.top,width:e.width,height:e.height};let r=e.body;[e,n].forEach(s=>{const o=[],a=s.hFlip,y=s.vFlip;let u=s.rotate;a?y?u+=2:(o.push("translate("+(t.width+t.left).toString()+" "+(0-t.top).toString()+")"),o.push("scale(-1 1)"),t.top=t.left=0):y&&(o.push("translate("+(0-t.left).toString()+" "+(t.height+t.top).toString()+")"),o.push("scale(1 -1)"),t.top=t.left=0);let f;switch(u<0&&(u-=Math.floor(u/4)*4),u=u%4,u){case 1:f=t.height/2+t.top,o.unshift("rotate(90 "+f.toString()+" "+f.toString()+")");break;case 2:o.unshift("rotate(180 "+(t.width/2+t.left).toString()+" "+(t.height/2+t.top).toString()+")");break;case 3:f=t.width/2+t.left,o.unshift("rotate(-90 "+f.toString()+" "+f.toString()+")");break}u%2===1&&((t.left!==0||t.top!==0)&&(f=t.left,t.left=t.top,t.top=f),t.width!==t.height&&(f=t.width,t.width=t.height,t.height=f)),o.length&&(r='<g transform="'+o.join(" ")+'">'+r+"</g>")});let i,l;n.width===null&&n.height===null?(l="1em",i=b(l,t.width/t.height)):n.width!==null&&n.height!==null?(i=n.width,l=n.height):n.height!==null?(l=n.height,i=b(l,t.width/t.height)):(i=n.width,l=b(i,t.height/t.width)),i==="auto"&&(i=t.width),l==="auto"&&(l=t.height),i=typeof i=="string"?i:i.toString()+"",l=typeof l=="string"?l:l.toString()+"";const h={attributes:{width:i,height:l,preserveAspectRatio:j(n),viewBox:t.left.toString()+" "+t.top.toString()+" "+t.width.toString()+" "+t.height.toString()},body:r};return n.inline&&(h.inline=!0),h}const $=/\sid="(\S+)"/g,D="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let B=0;function C(e,n=D){const t=[];let r;for(;r=$.exec(e);)t.push(r[1]);return t.length&&t.forEach(i=>{const l=typeof n=="function"?n(i):n+(B++).toString(),h=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");e=e.replace(new RegExp('([#;"])('+h+')([")]|\\.[a-z])',"g"),"$1"+l+"$3")}),e}const N={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"};let g={};["horizontal","vertical"].forEach(e=>{["Align","Flip"].forEach(n=>{const r={attr:e.slice(0,1)+n,boolean:n==="Flip"};g[e+"-"+n.toLowerCase()]=r,g[e.slice(0,1)+"-"+n.toLowerCase()]=r,g[e+n]=r})});const x=(e,n)=>{const t=v(w,n),r={...N};let i=typeof n.style=="object"&&!(n.style instanceof Array)?{...n.style}:{};for(let o in n){const a=n[o];if(a!==void 0)switch(o){case"icon":case"style":case"onLoad":break;case"inline":case"hFlip":case"vFlip":t[o]=a===!0||a==="true"||a===1;break;case"flip":typeof a=="string"&&F(t,a);break;case"align":typeof a=="string"&&A(t,a);break;case"color":i.color=a;break;case"rotate":typeof a=="string"?t[o]=I(a):typeof a=="number"&&(t[o]=a);break;case"ariaHidden":case"aria-hidden":a!==!0&&a!=="true"&&delete r["aria-hidden"];break;default:g[o]!==void 0?g[o].boolean&&(a===!0||a==="true"||a===1)?t[g[o].attr]=!0:!g[o].boolean&&typeof a=="string"&&a!==""&&(t[g[o].attr]=a):w[o]===void 0&&(r[o]=a)}}const l=E(e,t);for(let o in l.attributes)r[o]=l.attributes[o];l.inline&&i.verticalAlign===void 0&&i["vertical-align"]===void 0&&(i.verticalAlign="-0.125em");let h=0,s=n.id;return typeof s=="string"&&(s=s.replace(/-/g,"_")),r.innerHTML=C(l.body,s?()=>s+"ID"+h++:"iconifyVue"),Object.keys(i).length>0&&(r.style=i),c.h("svg",r)},O=Object.create(null),P=c.defineComponent({inheritAttrs:!1,render(){const e=this.$attrs,n=typeof e.icon=="string"?O[e.icon]:typeof e.icon=="object"?S(e.icon):null;return n===null||typeof n!="object"||typeof n.body!="string"?this.$slots.default?this.$slots.default():null:x(n,e)}}),V={key:0,class:"inline-block w-5 h-5"},L={key:2},T=c.defineComponent({__name:"Icon",props:{name:{type:String,required:!0}},setup(e){const n=e,t=c.ref(!1),r=c.ref();async function i(){t.value=!0,r.value=await m.loadIcon(n.name).catch(()=>{}),t.value=!1}return c.watch(()=>n.name,i),i(),(l,h)=>t.value?(c.openBlock(),c.createElementBlock("span",V)):r.value?(c.openBlock(),c.createBlock(c.unref(P),{key:1,icon:r.value,class:"inline-block w-5 h-5"},null,8,["icon"])):(c.openBlock(),c.createElementBlock("span",L,c.toDisplayString(e.name),1))}});return p.Icon=T,Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),p}({},Vue,vue$1);
var VIcon=function(n,e,s,r){"use strict";const u={key:0,class:"inline-block w-5 h-5"},f={key:2},t=e.defineComponent({__name:"Icon",props:{name:{type:String,required:!0}},setup(a){const l=a,c=e.ref(!1),o=e.ref();async function i(){c.value=!0,o.value=await r.loadIcon(l.name).catch(()=>{}),c.value=!1}return e.watch(()=>l.name,i),i(),(k,m)=>c.value?(e.openBlock(),e.createElementBlock("span",u)):o.value?(e.openBlock(),e.createBlock(e.unref(s.Icon),{key:1,icon:o.value,class:"inline-block w-5 h-5"},null,8,["icon"])):(e.openBlock(),e.createElementBlock("span",f,e.toDisplayString(a.name),1))}});return n.Icon=t,n.default=t,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),n}({},Vue,offline,vue$1);

@@ -1,1 +0,1 @@

(function(u,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("vue"),require("@iconify/vue")):typeof define=="function"&&define.amd?define(["exports","vue","@iconify/vue"],s):(u=typeof globalThis<"u"?globalThis:u||self,s(u.VIcon={},u.Vue,u.vue$1))})(this,function(u,s,m){"use strict";const d=Object.freeze({left:0,top:0,width:16,height:16,rotate:0,vFlip:!1,hFlip:!1});function v(t){return{...d,...t}}for(const t in d)d[t];const b=Object.freeze({inline:!1,width:null,height:null,hAlign:"center",vAlign:"middle",slice:!1,hFlip:!1,vFlip:!1,rotate:0});function S(t,n){const e={};for(const o in t){const i=o;if(e[i]=t[i],n[i]===void 0)continue;const l=n[i];switch(i){case"inline":case"slice":typeof l=="boolean"&&(e[i]=l);break;case"hFlip":case"vFlip":l===!0&&(e[i]=!e[i]);break;case"hAlign":case"vAlign":typeof l=="string"&&l!==""&&(e[i]=l);break;case"width":case"height":(typeof l=="string"&&l!==""||typeof l=="number"&&l||l===null)&&(e[i]=l);break;case"rotate":typeof l=="number"&&(e[i]+=l);break}}return e}const y=/[\s,]+/;function F(t,n){n.split(y).forEach(e=>{switch(e.trim()){case"horizontal":t.hFlip=!0;break;case"vertical":t.vFlip=!0;break}})}function A(t,n){n.split(y).forEach(e=>{const o=e.trim();switch(o){case"left":case"center":case"right":t.hAlign=o;break;case"top":case"middle":case"bottom":t.vAlign=o;break;case"slice":case"crop":t.slice=!0;break;case"meet":t.slice=!1}})}function I(t,n=0){const e=t.replace(/^-?[0-9.]*/,"");function o(i){for(;i<0;)i+=4;return i%4}if(e===""){const i=parseInt(t);return isNaN(i)?0:o(i)}else if(e!==t){let i=0;switch(e){case"%":i=25;break;case"deg":i=90}if(i){let l=parseFloat(t.slice(0,t.length-e.length));return isNaN(l)?0:(l=l/i,l%1===0?o(l):0)}}return n}const M=/(-?[0-9.]*[0-9]+[0-9.]*)/g,j=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function w(t,n,e){if(n===1)return t;if(e=e===void 0?100:e,typeof t=="number")return Math.ceil(t*n*e)/e;if(typeof t!="string")return t;const o=t.split(M);if(o===null||!o.length)return t;const i=[];let l=o.shift(),f=j.test(l);for(;;){if(f){const c=parseFloat(l);isNaN(c)?i.push(l):i.push(Math.ceil(c*n*e)/e)}else i.push(l);if(l=o.shift(),l===void 0)return i.join("");f=!f}}function _(t){let n="";switch(t.hAlign){case"left":n+="xMin";break;case"right":n+="xMax";break;default:n+="xMid"}switch(t.vAlign){case"top":n+="YMin";break;case"bottom":n+="YMax";break;default:n+="YMid"}return n+=t.slice?" slice":" meet",n}function x(t,n){const e={left:t.left,top:t.top,width:t.width,height:t.height};let o=t.body;[t,n].forEach(c=>{const r=[],a=c.hFlip,k=c.vFlip;let p=c.rotate;a?k?p+=2:(r.push("translate("+(e.width+e.left).toString()+" "+(0-e.top).toString()+")"),r.push("scale(-1 1)"),e.top=e.left=0):k&&(r.push("translate("+(0-e.left).toString()+" "+(e.height+e.top).toString()+")"),r.push("scale(1 -1)"),e.top=e.left=0);let h;switch(p<0&&(p-=Math.floor(p/4)*4),p=p%4,p){case 1:h=e.height/2+e.top,r.unshift("rotate(90 "+h.toString()+" "+h.toString()+")");break;case 2:r.unshift("rotate(180 "+(e.width/2+e.left).toString()+" "+(e.height/2+e.top).toString()+")");break;case 3:h=e.width/2+e.left,r.unshift("rotate(-90 "+h.toString()+" "+h.toString()+")");break}p%2===1&&((e.left!==0||e.top!==0)&&(h=e.left,e.left=e.top,e.top=h),e.width!==e.height&&(h=e.width,e.width=e.height,e.height=h)),r.length&&(o='<g transform="'+r.join(" ")+'">'+o+"</g>")});let i,l;n.width===null&&n.height===null?(l="1em",i=w(l,e.width/e.height)):n.width!==null&&n.height!==null?(i=n.width,l=n.height):n.height!==null?(l=n.height,i=w(l,e.width/e.height)):(i=n.width,l=w(i,e.height/e.width)),i==="auto"&&(i=e.width),l==="auto"&&(l=e.height),i=typeof i=="string"?i:i.toString()+"",l=typeof l=="string"?l:l.toString()+"";const f={attributes:{width:i,height:l,preserveAspectRatio:_(n),viewBox:e.left.toString()+" "+e.top.toString()+" "+e.width.toString()+" "+e.height.toString()},body:o};return n.inline&&(f.inline=!0),f}const E=/\sid="(\S+)"/g,$="IconifyId"+Date.now().toString(16)+(Math.random()*16777216|0).toString(16);let D=0;function B(t,n=$){const e=[];let o;for(;o=E.exec(t);)e.push(o[1]);return e.length&&e.forEach(i=>{const l=typeof n=="function"?n(i):n+(D++).toString(),f=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");t=t.replace(new RegExp('([#;"])('+f+')([")]|\\.[a-z])',"g"),"$1"+l+"$3")}),t}const C={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":!0,role:"img"};let g={};["horizontal","vertical"].forEach(t=>{["Align","Flip"].forEach(n=>{const o={attr:t.slice(0,1)+n,boolean:n==="Flip"};g[t+"-"+n.toLowerCase()]=o,g[t.slice(0,1)+"-"+n.toLowerCase()]=o,g[t+n]=o})});const N=(t,n)=>{const e=S(b,n),o={...C};let i=typeof n.style=="object"&&!(n.style instanceof Array)?{...n.style}:{};for(let r in n){const a=n[r];if(a!==void 0)switch(r){case"icon":case"style":case"onLoad":break;case"inline":case"hFlip":case"vFlip":e[r]=a===!0||a==="true"||a===1;break;case"flip":typeof a=="string"&&F(e,a);break;case"align":typeof a=="string"&&A(e,a);break;case"color":i.color=a;break;case"rotate":typeof a=="string"?e[r]=I(a):typeof a=="number"&&(e[r]=a);break;case"ariaHidden":case"aria-hidden":a!==!0&&a!=="true"&&delete o["aria-hidden"];break;default:g[r]!==void 0?g[r].boolean&&(a===!0||a==="true"||a===1)?e[g[r].attr]=!0:!g[r].boolean&&typeof a=="string"&&a!==""&&(e[g[r].attr]=a):b[r]===void 0&&(o[r]=a)}}const l=x(t,e);for(let r in l.attributes)o[r]=l.attributes[r];l.inline&&i.verticalAlign===void 0&&i["vertical-align"]===void 0&&(i.verticalAlign="-0.125em");let f=0,c=n.id;return typeof c=="string"&&(c=c.replace(/-/g,"_")),o.innerHTML=B(l.body,c?()=>c+"ID"+f++:"iconifyVue"),Object.keys(i).length>0&&(o.style=i),s.h("svg",o)},T=Object.create(null),O=s.defineComponent({inheritAttrs:!1,render(){const t=this.$attrs,n=typeof t.icon=="string"?T[t.icon]:typeof t.icon=="object"?v(t.icon):null;return n===null||typeof n!="object"||typeof n.body!="string"?this.$slots.default?this.$slots.default():null:N(n,t)}}),P={key:0,class:"inline-block w-5 h-5"},V={key:2},L=s.defineComponent({__name:"Icon",props:{name:{type:String,required:!0}},setup(t){const n=t,e=s.ref(!1),o=s.ref();async function i(){e.value=!0,o.value=await m.loadIcon(n.name).catch(()=>{}),e.value=!1}return s.watch(()=>n.name,i),i(),(l,f)=>e.value?(s.openBlock(),s.createElementBlock("span",P)):o.value?(s.openBlock(),s.createBlock(s.unref(O),{key:1,icon:o.value,class:"inline-block w-5 h-5"},null,8,["icon"])):(s.openBlock(),s.createElementBlock("span",V,s.toDisplayString(t.name),1))}});u.Icon=L,Object.defineProperties(u,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
(function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@iconify/vue/dist/offline"),require("@iconify/vue")):typeof define=="function"&&define.amd?define(["exports","vue","@iconify/vue/dist/offline","@iconify/vue"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.VIcon={},n.Vue,n.offline,n.vue$1))})(this,function(n,e,f,a){"use strict";const u={key:0,class:"inline-block w-5 h-5"},r={key:2},t=e.defineComponent({__name:"Icon",props:{name:{type:String,required:!0}},setup(c){const s=c,o=e.ref(!1),i=e.ref();async function l(){o.value=!0,i.value=await a.loadIcon(s.name).catch(()=>{}),o.value=!1}return e.watch(()=>s.name,l),l(),(d,p)=>o.value?(e.openBlock(),e.createElementBlock("span",u)):i.value?(e.openBlock(),e.createBlock(e.unref(f.Icon),{key:1,icon:i.value,class:"inline-block w-5 h-5"},null,8,["icon"])):(e.openBlock(),e.createElementBlock("span",r,e.toDisplayString(c.name),1))}});n.Icon=t,n.default=t,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});

@@ -1,1 +0,3 @@

export { default as Icon } from './Icon.vue';
import Icon from './Icon.vue';
export { Icon };
export default Icon;
{
"name": "@gits-id/icon",
"version": "0.11.1",
"version": "0.11.2-alpha.5+e35fec5",
"description": "GITS Icon Component",

@@ -25,3 +25,3 @@ "scripts": {

},
"main": "dist/icon.umd.js",
"main": "dist/icon.cjs.js",
"unpkg": "dist/icon.iife.js",

@@ -31,3 +31,12 @@ "jsdelivr": "dist/icon.iife.js",

"types": "./dist/types/index.d.ts",
"gitHead": "3f16d51e418feaa96491eaaab6c266443324a9db"
"exports": {
".": {
"import": "./dist/icon.es.js",
"require": "./dist/icon.cjs.js"
},
"./package.json": "./package.json",
"./src/*": "./src/*",
"./*": "./*"
},
"gitHead": "e35fec5b64cc78b9182134302a86ccf103a524c9"
}

@@ -1,1 +0,3 @@

export {default as Icon} from './Icon.vue';
import Icon from './Icon.vue';
export {Icon};
export default Icon;

@@ -19,8 +19,4 @@ import {defineConfig} from 'vite';

rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: ['vue', '@iconify/vue'],
external: ['vue', '@iconify/vue', '@iconify/vue/dist/offline'],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {

@@ -27,0 +23,0 @@ vue: 'Vue',

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc