@yh-ui/icons 1.0.1 → 1.0.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.
package/dist/index.mjs CHANGED
@@ -1,23 +1,24 @@
1
- import { AVAILABLE_COLLECTIONS as E, RECOMMENDED_COLLECTIONS as t } from "./types.mjs";
1
+ import { AVAILABLE_COLLECTIONS as t, RECOMMENDED_COLLECTIONS as E } from "./types.mjs";
2
2
  import { createIconifyComponent as I, getIconData as C, iconExists as L, parseIconName as O } from "./iconify.mjs";
3
- import { COMMON_ICONS as N, DEFAULT_ENABLED_PRESETS as S, PREFIX_ALIAS as c, PRESETS as A, getPreset as f } from "./presets.mjs";
4
- import { ICON_COLLECTIONS as p, getAllPrefixes as x, getCollection as _ } from "./collections.mjs";
5
- import { Icon as a, YhIcon as i } from "./vue/icon.mjs";
3
+ import { COMMON_ICONS as n, DEFAULT_ENABLED_PRESETS as N, PREFIX_ALIAS as S, PRESETS as c, getPreset as A } from "./presets.mjs";
4
+ import { ICON_COLLECTIONS as m, getAllPrefixes as p, getCollection as x } from "./collections.mjs";
5
+ import { Icon as T, YhIcon as a, __test__ as i } from "./vue/icon.mjs";
6
6
  export {
7
- E as AVAILABLE_COLLECTIONS,
8
- N as COMMON_ICONS,
9
- S as DEFAULT_ENABLED_PRESETS,
10
- p as ICON_COLLECTIONS,
11
- a as Icon,
12
- c as PREFIX_ALIAS,
13
- A as PRESETS,
14
- t as RECOMMENDED_COLLECTIONS,
15
- i as YhIcon,
7
+ t as AVAILABLE_COLLECTIONS,
8
+ n as COMMON_ICONS,
9
+ N as DEFAULT_ENABLED_PRESETS,
10
+ m as ICON_COLLECTIONS,
11
+ T as Icon,
12
+ S as PREFIX_ALIAS,
13
+ c as PRESETS,
14
+ E as RECOMMENDED_COLLECTIONS,
15
+ a as YhIcon,
16
+ i as __test__,
16
17
  I as createIconifyComponent,
17
- x as getAllPrefixes,
18
- _ as getCollection,
18
+ p as getAllPrefixes,
19
+ x as getCollection,
19
20
  C as getIconData,
20
- f as getPreset,
21
+ A as getPreset,
21
22
  L as iconExists,
22
23
  O as parseIconName
23
24
  };
@@ -1,5 +1,22 @@
1
1
  import { PropType } from 'vue';
2
2
  import { IconName, IconSize, IconColor, IconRotate } from '../types';
3
+ /**
4
+ * 注入 spin 动画样式到 head(仅注入一次)
5
+ */
6
+ declare function ensureSpinStyle(): void;
7
+ /**
8
+ * 解析图标名称为 Iconify 格式
9
+ */
10
+ declare function resolveIconName(name: string): string;
11
+ /**
12
+ * 创建图标样式
13
+ */
14
+ declare function createIconStyle(props: {
15
+ size?: IconSize;
16
+ color?: IconColor;
17
+ rotate?: IconRotate;
18
+ spin?: boolean;
19
+ }): Record<string, string> | undefined;
3
20
  /**
4
21
  * YhIcon Vue 组件
5
22
  * 保持与 @yh-ui/components 的 YhIcon 组件完全兼容
@@ -275,4 +292,14 @@ export declare const Icon: import('vue').DefineComponent<import('vue').ExtractPr
275
292
  * YhIcon Props 类型
276
293
  */
277
294
  export type YhIconProps = InstanceType<typeof YhIcon>['$props'];
295
+ /**
296
+ * Internal helpers for unit tests only.
297
+ * Keep runtime behavior unchanged while allowing precise branch tests.
298
+ */
299
+ export declare const __test__: {
300
+ ensureSpinStyle: typeof ensureSpinStyle;
301
+ resolveIconName: typeof resolveIconName;
302
+ createIconStyle: typeof createIconStyle;
303
+ };
304
+ export {};
278
305
  //# sourceMappingURL=icon.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/vue/icon.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAGnC,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AA8EzE;;;GAGG;AACH,eAAO,MAAM,MAAM;IAIf;;;;;OAKG;;cAEe,QAAQ,CAAC,QAAQ,CAAC;;;IAGpC;;OAE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G;;cAEe,QAAQ,CAAC,SAAS,CAAC;;;IAGrC;;OAEG;;;;;IAKH;;OAEG;;cAEe,QAAQ,CAAC,UAAU,CAAC;;;;;;IAxDtC;;;;;OAKG;;cAEe,QAAQ,CAAC,QAAQ,CAAC;;;IAGpC;;OAEG;;cAEe,QAAQ,CAAC,QAAQ,CAAC;;;IAGpC;;OAEG;;;;;IAKH;;OAEG;;cAE2B,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,CAAC;;;IAGlF;;OAEG;;cAEyB,QAAQ,CAAC,QAAQ,CAAC;;;IAG9C;;OAEG;;cAEe,QAAQ,CAAC,SAAS,CAAC;;;IAGrC;;OAEG;;;;;IAKH;;OAEG;;cAEe,QAAQ,CAAC,UAAU,CAAC;;;;;;;;;;;mCA5BqB,OAAO,EAAE,KAAK,OAAO;4EAiH1D,CAAA;AAE1B;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAA;AAE/D;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;CAIpB,CAAA"}
package/dist/vue/icon.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { defineComponent as f, onMounted as d, computed as r, h as c } from "vue";
2
- import { Icon as y } from "@iconify/vue";
3
- import { COMMON_ICONS as l } from "../presets.mjs";
4
- const u = "yh-icon-spin-style", m = `
1
+ import { defineComponent as d, onMounted as y, computed as r, h as c } from "vue";
2
+ import { Icon as m } from "@iconify/vue";
3
+ import { COMMON_ICONS as s } from "../presets.mjs";
4
+ const a = "yh-icon-spin-style", v = `
5
5
  @keyframes yh-icon-spin {
6
6
  from { transform: rotate(0deg); }
7
7
  to { transform: rotate(360deg); }
@@ -10,15 +10,15 @@ const u = "yh-icon-spin-style", m = `
10
10
  animation: yh-icon-spin 1s linear infinite;
11
11
  }
12
12
  `;
13
- function s() {
14
- if (typeof document > "u" || document.getElementById(u)) return;
13
+ function l() {
14
+ if (typeof document > "u" || document.getElementById(a)) return;
15
15
  const e = document.createElement("style");
16
- e.id = u, e.textContent = m, document.head.appendChild(e);
16
+ e.id = a, e.textContent = v, document.head.appendChild(e);
17
17
  }
18
- function a(e) {
19
- return e ? e.includes(":") || e.includes("/") ? e.replace("/", ":") : e in l ? l[e] : `mdi:${e}` : "";
18
+ function u(e) {
19
+ return e ? e.includes(":") || e.includes("/") ? e.replace("/", ":") : e in s ? s[e] : `mdi:${e}` : "";
20
20
  }
21
- function v(e) {
21
+ function f(e) {
22
22
  const t = {};
23
23
  if (e.size) {
24
24
  const n = typeof e.size == "number" ? `${e.size}px` : e.size;
@@ -26,7 +26,7 @@ function v(e) {
26
26
  }
27
27
  return e.color && (t.color = e.color), e.rotate && !e.spin && (t.transform = `rotate(${e.rotate}deg)`), Object.keys(t).length > 0 ? t : void 0;
28
28
  }
29
- const h = f({
29
+ const h = d({
30
30
  name: "YhIconIconify",
31
31
  inheritAttrs: !1,
32
32
  props: {
@@ -91,18 +91,18 @@ const h = f({
91
91
  }
92
92
  },
93
93
  setup(e, { attrs: t }) {
94
- d(() => {
95
- e.spin && s();
94
+ y(() => {
95
+ e.spin && l();
96
96
  });
97
- const n = r(() => e.icon ? a(e.icon) : e.name ? a(e.name) : ""), i = r(
98
- () => v({
97
+ const n = r(() => e.icon ? u(e.icon) : e.name ? u(e.name) : ""), i = r(
98
+ () => f({
99
99
  size: e.size,
100
100
  color: e.color,
101
101
  rotate: e.rotate,
102
102
  spin: e.spin
103
103
  })
104
104
  ), o = r(() => e.spin ? "yh-icons--spin" : "");
105
- return () => (e.spin && s(), e.component ? c(e.component, {
105
+ return () => (e.spin && l(), e.component ? c(e.component, {
106
106
  class: o.value,
107
107
  style: i.value,
108
108
  ...t
@@ -114,7 +114,7 @@ const h = f({
114
114
  "aria-hidden": "true",
115
115
  innerHTML: e.svg,
116
116
  ...t
117
- }) : n.value ? c(y, {
117
+ }) : n.value ? c(m, {
118
118
  icon: n.value,
119
119
  class: o.value,
120
120
  style: i.value,
@@ -125,8 +125,13 @@ const h = f({
125
125
  ...t
126
126
  }));
127
127
  }
128
- }), z = h;
128
+ }), z = h, C = {
129
+ ensureSpinStyle: l,
130
+ resolveIconName: u,
131
+ createIconStyle: f
132
+ };
129
133
  export {
130
134
  z as Icon,
131
- h as YhIcon
135
+ h as YhIcon,
136
+ C as __test__
132
137
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yh-ui/icons",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
4
4
  "description": "YH-UI Icons - High performance icon library with Iconify integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",