st-common-ui-vue3
Version:
小尾巴通用 Vue3 UI 组件库
75 lines (74 loc) • 2.83 kB
JavaScript
import { reqByFetch as i } from "../../node_modules/.pnpm/st-common-req@0.2.2/node_modules/st-common-req/es/index.js";
import { iconExists as a, getIcon as l, addIcon as f, addCollection as y, loadIcon as I, loadIcons as d, enableCache as g, disableCache as h } from "../../node_modules/.pnpm/@iconify_vue@4.1.2_vue@3.5.13_typescript@5.6.2_/node_modules/@iconify/vue/dist/iconify.js";
const j = async (n, o) => {
let t = `https://api.iconify.design/${n}/${o}.svg`;
return i({ url: t, jsonParse: !1 });
}, m = async (n, o) => {
let t = `https://api.iconify.design/${n}.css?icons=${o.join(",")}`;
return i({ url: t, jsonParse: !1 });
}, p = async (n, o) => {
let t = `https://api.iconify.design/${n}.json?icons=${o.join(",")}&pretty=1`;
return i({ url: t });
}, b = async (n, o) => {
const t = await p(n, o), e = [];
for (const c in t.icons)
e.push({
body: t.icons[c].body,
height: t.icons[c].height ?? t.height ?? 16,
width: t.icons[c].width ?? t.width ?? 16,
left: t.icons[c].left ?? t.left ?? 0,
top: t.icons[c].top ?? t.top ?? 0,
rotate: t.icons[c].rotate ?? 0,
hFlip: t.icons[c].hFlip ?? !1,
vFlip: t.icons[c].vFlip ?? !1
});
return e;
}, C = async (n) => {
let o = "https://api.iconify.design/collections";
return n.length > 0 ? o += `?prefixes=${n.join(",")}&pretty=1` : o += "?pretty=1", i({ url: o });
}, r = (n) => {
const o = [];
for (const t in n)
o.push(...n[t]);
return o;
}, F = async ({
prefix: n,
info: o = !1,
uncategorized: t = !0
}) => {
let e = `https://api.iconify.design/collection?prefix=${n}&info=${o}&pretty=1`;
return i({ url: e }).then((c) => (t && !c.uncategorized && (c.uncategorized = r(c.categories)), c)).catch((c) => Promise.reject(c));
}, S = async ({
query: n,
limit: o = 64,
start: t = 0,
prefixes: e = [],
category: c = ""
}) => {
let s = `https://api.iconify.design/search?query=${n}&limit=${o}&start=${t}&pretty=1`;
return e.length > 0 && (s += `&prefixes=${e.join(",")}`), c && (s += `&category=${c}`), i({ url: s });
}, w = (n) => r(n.categories), z = (n) => Reflect.ownKeys(n.icons), v = (n) => a(n), x = (n) => l(n), D = (n, o) => f(n, o), P = (n, o) => y(n, o), q = (n) => I(n), U = (n, o) => d(n, o), E = (n) => {
g(n);
}, L = (n) => {
h(n);
};
export {
P as addIconifyCollection,
D as addIconifyIcon,
L as disableIconifyCache,
E as enableIconifyCache,
r as genIconifySetIconsUncategorized,
x as getIconifyIcon,
m as getIconifyIconCSS,
p as getIconifyIconData,
b as getIconifyIconDataParse,
C as getIconifyIconSets,
j as getIconifyIconSvg,
F as getIconifySetIcons,
w as getIconifySetIconsUncategorized,
z as getSetIconsFromIconifyJSON,
v as iconifyIconExists,
q as loadIconifyIcon,
U as loadIconifyIcons,
S as searchIconifyIcons
};