UNPKG

@indielayer/ui

Version:

Indielayer UI Components with Tailwind CSS build for Vue 3

32 lines (31 loc) 940 B
import { defineComponent as i, ref as A, watch as f, openBlock as p, createElementBlock as u, normalizeClass as d, unref as r, normalizeStyle as g } from "vue"; import { useTheme as _ } from "../../composables/useTheme.js"; const w = ["src"], h = { src: String }, y = { name: "XImage" }, I = /* @__PURE__ */ i({ ...y, props: h, setup(a) { const n = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=", s = a, t = A(n); typeof window < "u" && Image && f(() => s.src, (o) => { if (!o) return; const e = new Image(); e.onload = () => { t.value = s.src; }, e.onerror = () => { }, e.src = o; }, { immediate: !0 }); const { styles: c, classes: l, className: m } = _("Image", {}, s); return (o, e) => (p(), u("img", { class: d([r(m), r(l).wrapper]), style: g(r(c)), src: t.value }, null, 14, w)); } }); export { I as default };