@vuux/icons 1.0.0-beta.3 → 1.0.0-beta.4

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.
@@ -1,6 +1,6 @@
1
- import { defineComponent as a, shallowRef as r, watch as c, openBlock as m, createBlock as l, resolveDynamicComponent as p, normalizeProps as s, mergeProps as i, createCommentVNode as u } from "vue";
2
- import { loadIcon as f } from "./icon-runtime.mjs";
3
- const y = /* @__PURE__ */ a({
1
+ import { defineComponent as c, shallowRef as n, watch as l, openBlock as i, createBlock as r, resolveDynamicComponent as m, mergeProps as s, createCommentVNode as u } from "vue";
2
+ import { loadIcon as h } from "./icon-runtime.mjs";
3
+ const y = /* @__PURE__ */ c({
4
4
  __name: "Icon",
5
5
  props: {
6
6
  name: {},
@@ -8,15 +8,21 @@ const y = /* @__PURE__ */ a({
8
8
  size: {},
9
9
  opacity: {}
10
10
  },
11
- setup(n) {
12
- const t = n, e = r(null);
13
- return c(
14
- () => t.name,
15
- async (o) => {
16
- e.value = await f(o);
11
+ setup(e) {
12
+ const a = e, o = n(null);
13
+ return l(
14
+ () => a.name,
15
+ async (t) => {
16
+ o.value = await h(t);
17
17
  },
18
18
  { immediate: !0 }
19
- ), (o, d) => e.value ? (m(), l(p(e.value), s(i({ key: 0 }, o.$attrs)), null, 16)) : u("", !0);
19
+ ), (t, f) => o.value ? (i(), r(m(o.value), s({ key: 0 }, t.$attrs, {
20
+ color: e.color,
21
+ fill: e.color,
22
+ width: e.size,
23
+ height: e.size,
24
+ opacity: e.opacity
25
+ }), null, 16, ["color", "fill", "width", "height", "opacity"])) : u("", !0);
20
26
  }
21
27
  });
22
28
  export {
@@ -1,18 +1,2 @@
1
- export declare const iconGroups: {
2
- Arrows: () => Promise<typeof import("./Arrows/icon-map")>;
3
- Buildings: () => Promise<typeof import("./Buildings/icon-map")>;
4
- Business: () => Promise<typeof import("./Business/icon-map")>;
5
- Cloud: () => Promise<typeof import("./Cloud/icon-map")>;
6
- Communication: () => Promise<typeof import("./Communication/icon-map")>;
7
- Design: () => Promise<typeof import("./Design/icon-map")>;
8
- Editor: () => Promise<typeof import("./Editor/icon-map")>;
9
- Folder: () => Promise<typeof import("./Folder/icon-map")>;
10
- Food: () => Promise<typeof import("./Food/icon-map")>;
11
- Map: () => Promise<typeof import("./Map/icon-map")>;
12
- Math: () => Promise<typeof import("./Math/icon-map")>;
13
- Media: () => Promise<typeof import("./Media/icon-map")>;
14
- Result: () => Promise<typeof import("./Result/icon-map")>;
15
- Spinners: () => Promise<typeof import("./Spinners/icon-map")>;
16
- System: () => Promise<typeof import("./System/icon-map")>;
17
- User: () => Promise<typeof import("./User/icon-map")>;
18
- };
1
+ import { Component } from 'vue';
2
+ export declare const iconGroups: Record<string, () => Promise<Component>>;
@@ -1,20 +1,20 @@
1
1
  const o = {
2
- Arrows: () => import("./Arrows/icon-map.mjs"),
3
- Buildings: () => import("./Buildings/icon-map.mjs"),
4
- Business: () => import("./Business/icon-map.mjs"),
5
- Cloud: () => import("./Cloud/icon-map.mjs"),
6
- Communication: () => import("./Communication/icon-map.mjs"),
7
- Design: () => import("./Design/icon-map.mjs"),
8
- Editor: () => import("./Editor/icon-map.mjs"),
9
- Folder: () => import("./Folder/icon-map.mjs"),
10
- Food: () => import("./Food/icon-map.mjs"),
11
- Map: () => import("./Map/icon-map.mjs"),
12
- Math: () => import("./Math/icon-map.mjs"),
13
- Media: () => import("./Media/icon-map.mjs"),
14
- Result: () => import("./Result/icon-map.mjs"),
15
- Spinners: () => import("./Spinners/icon-map.mjs"),
16
- System: () => import("./System/icon-map.mjs"),
17
- User: () => import("./User/icon-map.mjs")
2
+ Cloud: () => import("./Cloud/icon-map.mjs").then((t) => t),
3
+ Folder: () => import("./Folder/icon-map.mjs").then((t) => t),
4
+ Food: () => import("./Food/icon-map.mjs").then((t) => t),
5
+ Communication: () => import("./Communication/icon-map.mjs").then((t) => t),
6
+ Media: () => import("./Media/icon-map.mjs").then((t) => t),
7
+ Business: () => import("./Business/icon-map.mjs").then((t) => t),
8
+ Result: () => import("./Result/icon-map.mjs").then((t) => t),
9
+ User: () => import("./User/icon-map.mjs").then((t) => t),
10
+ Math: () => import("./Math/icon-map.mjs").then((t) => t),
11
+ System: () => import("./System/icon-map.mjs").then((t) => t),
12
+ Editor: () => import("./Editor/icon-map.mjs").then((t) => t),
13
+ Map: () => import("./Map/icon-map.mjs").then((t) => t),
14
+ Buildings: () => import("./Buildings/icon-map.mjs").then((t) => t),
15
+ Design: () => import("./Design/icon-map.mjs").then((t) => t),
16
+ Spinners: () => import("./Spinners/icon-map.mjs").then((t) => t),
17
+ Arrows: () => import("./Arrows/icon-map.mjs").then((t) => t)
18
18
  };
19
19
  export {
20
20
  o as iconGroups
@@ -1,8 +1,3 @@
1
- import { Component } from 'vue';
2
1
  import { IconName } from './name-map';
3
- /**
4
- * 加载 Icon
5
- *
6
- * @param name 图标名称
7
- */
2
+ import { Component } from 'vue';
8
3
  export declare function loadIcon(name: IconName): Promise<Component | null>;
@@ -1,37 +1,26 @@
1
- import { defineAsyncComponent as u } from "vue";
2
- import { nameToGroupMap as m } from "./name-map.mjs";
3
- import { iconGroups as f } from "./icon-groups.mjs";
4
- const e = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
5
- async function I(o) {
6
- if (e.has(o))
7
- return e.get(o);
8
- const n = m[o];
9
- if (!n)
10
- return console.warn(`[Icon]群组未找到: ${o}`), null;
11
- const t = f[n];
1
+ import { iconGroups as p } from "./icon-groups.mjs";
2
+ import { nameToGroupMap as l } from "./name-map.mjs";
3
+ import { defineAsyncComponent as s } from "vue";
4
+ const c = /* @__PURE__ */ new Map();
5
+ async function M(o) {
6
+ if (c.has(o))
7
+ return c.get(o);
8
+ const r = l[o];
9
+ if (!r)
10
+ return console.warn(`[Icon] 未找到分组: ${o}`), null;
11
+ const t = p[r];
12
12
  if (!t)
13
- return console.warn(`[Icon]加载器未找到: ${n}`), null;
14
- let r = a.get(n);
15
- r || (r = t(), a.set(n, r));
16
- const p = (await r)[`${n}Map`]?.[o];
17
- if (!p)
18
- return console.warn(`[Icon]加载器未找到: ${o}`), null;
19
- const s = u({
20
- loader: p,
21
- delay: 0,
22
- timeout: 1e4,
23
- loadingComponent: {
24
- template: '<span style="opacity:.5">`···`</span>'
25
- },
26
- errorComponent: {
27
- template: '<span style="color:red">×</span>'
28
- },
29
- onError(y, c, l, i) {
30
- i <= 2 ? c() : l();
31
- }
32
- });
33
- return e.set(o, s), s;
13
+ return console.warn(`[Icon] 分组加载失败: ${r}`), null;
14
+ try {
15
+ const n = (await t())[`${r}Map`];
16
+ if (!n || !n[o])
17
+ return console.warn(`[Icon] 图标未找到: ${o}`), null;
18
+ const e = s(n[o]);
19
+ return c.set(o, e), e;
20
+ } catch (u) {
21
+ return console.error(`[Icon] 加载失败: ${o}`, u), null;
22
+ }
34
23
  }
35
24
  export {
36
- I as loadIcon
25
+ M as loadIcon
37
26
  };