UNPKG

vite-awesome-svg-loader

Version:

A universal Vite SVG loader. Imports SVGs as source code, base64 and data URI. Preserves stroke width. Replaces colors with currentColor or custom colors. Creates SVG sprites. Optimizes SVGs.

48 lines (47 loc) 1.4 kB
import { defineComponent as m, computed as f, createElementBlock as p, onMounted as v, openBlock as d, normalizeStyle as g, createVNode as z, ref as c, watch as h, onBeforeUnmount as B, normalizeProps as u, guardReactiveProps as i, createElementVNode as E } from "vue"; import { B as _, N as k, T as A, z as N } from "../integration-utils/index-Bs_mjsj3.js"; const S = /* @__PURE__ */ m({ inheritAttrs: !1, __name: "SvgImage", props: { src: {}, useElAttrs: {} }, setup(n) { const t = n, r = c(""), o = c({}), l = (e, s) => { const a = N(e, s); a.id && (r.value = a.id), a.attrs && (o.value = a.attrs); }; return h( () => t.src, (e, s) => l(s, e) ), v(() => l(void 0, t.src)), B(() => A(r.value)), (e, s) => (d(), p("svg", u(i({ ...e.$attrs, ...o.value })), [ E("use", u(i({ ...e.useElAttrs || {}, href: "#" + r.value })), null, 16) ], 16)); } }), I = /* @__PURE__ */ m({ __name: "SvgIcon", props: { src: {}, size: {}, color: {}, colorTransition: {} }, setup(n) { const t = n, r = f(() => _(t)); return v(k), (o, l) => (d(), p("span", { class: "vite-awesome-svg-loader-icon", style: g(r.value) }, [ z(S, { src: o.src, "aria-hidden": "true" }, null, 8, ["src"]) ], 4)); } }); export { I as k, S as z }; //# sourceMappingURL=index-CiJbbvQv.js.map