mv-iconfront 1.0.8 → 1.1.0

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/README.md CHANGED
@@ -99,17 +99,4 @@ import 'mv-iconfront/dist/style.css'
99
99
  | `color` | String | `''` | 自定义颜色覆盖 (hex, rgb 等) |
100
100
  | `size` | String/Number | `''` | 字体大小。纯数字会被视为 `px` 单位。 |
101
101
  | `isRed` | Boolean | `false` | 设置图标为红色 (`#f56c6c`)。 |
102
- | `disabled` | Boolean | `false` | 设置图标为灰色 (`#C0C4CC`) 并将鼠标样式设为禁止。 |
103
-
104
- ## 构建与发布
105
-
106
- 1. 构建库 (生成 JS 和 类型定义文件):
107
-
108
- ```bash
109
- npm run build
110
- ```
111
- 2. 发布到 npm:
112
-
113
- ```bash
114
- npm publish
115
- ```
102
+ | `disabled` | Boolean | `false` | 设置图标透明度为0.4 并将鼠标样式设为禁止。 |
@@ -1,5 +1,15 @@
1
- import { defineComponent as s, getCurrentInstance as f, inject as i, computed as d, createElementBlock as u, openBlock as m, mergeProps as C } from "vue";
2
- const g = s({
1
+ import { defineComponent as a, computed as c, createElementBlock as f, openBlock as i, mergeProps as s } from "vue";
2
+ const r = {
3
+ defaultColor: "#FFFFFF"
4
+ // Default fallback
5
+ };
6
+ function d(e) {
7
+ e.defaultColor && (r.defaultColor = e.defaultColor);
8
+ }
9
+ function u() {
10
+ return r;
11
+ }
12
+ const m = a({
3
13
  name: "MvIconfront",
4
14
  props: {
5
15
  // The specific icon class, e.g. "icon-home"
@@ -29,36 +39,36 @@ const g = s({
29
39
  }
30
40
  },
31
41
  setup(e) {
32
- const o = f(), n = i("mvIconfrontDefaultColor"), l = o == null ? void 0 : o.appContext.config.globalProperties.$mvIconfrontDefaultColor, r = n || l || "#FFFFFF";
42
+ const t = u().defaultColor || "#FFFFFF";
33
43
  return {
34
- iconStyle: d(() => {
35
- const t = {};
36
- if (e.disabled ? t.color = "#C0C4CC !important" : e.isRed ? t.color = "#f56c6c !important" : e.color ? t.color = `${e.color} !important` : t.color = `${r} !important`, e.size) {
37
- const c = e.size.toString();
38
- t.fontSize = c.endsWith("px") || c.endsWith("rem") ? c : `${c}px`;
44
+ iconStyle: c(() => {
45
+ const o = {};
46
+ if (e.disabled ? o.opacity = "0.4 !important" : e.isRed ? o.color = "#f56c6c !important" : e.color ? o.color = `${e.color} !important` : o.color = `${t} !important`, e.size) {
47
+ const n = e.size.toString();
48
+ o.fontSize = n.endsWith("px") || n.endsWith("rem") ? n : `${n}px`;
39
49
  }
40
- return t;
50
+ return o;
41
51
  })
42
52
  };
43
53
  }
44
- }), p = (e, o) => {
45
- const n = e.__vccOpts || e;
46
- for (const [l, r] of o)
47
- n[l] = r;
48
- return n;
54
+ }), p = (e, t) => {
55
+ const l = e.__vccOpts || e;
56
+ for (const [o, n] of t)
57
+ l[o] = n;
58
+ return l;
49
59
  };
50
- function y(e, o, n, l, r, a) {
51
- return m(), u("i", C({
60
+ function y(e, t, l, o, n, g) {
61
+ return i(), f("i", s({
52
62
  class: ["icon2", e.name, { "is-disabled": e.disabled }],
53
63
  style: e.iconStyle
54
64
  }, e.$attrs), null, 16);
55
65
  }
56
- const v = /* @__PURE__ */ p(g, [["render", y]]), $ = (e, o) => {
57
- o != null && o.defaultColor && (e.config.globalProperties.$mvIconfrontDefaultColor = o.defaultColor, e.provide("mvIconfrontDefaultColor", o.defaultColor)), e.component("MvIconfront", v);
58
- }, I = {
59
- install: $
66
+ const C = /* @__PURE__ */ p(m, [["render", y]]), F = (e, t) => {
67
+ t != null && t.defaultColor && d({ defaultColor: t.defaultColor }), e.component("MvIconfront", C);
68
+ }, $ = {
69
+ install: F
60
70
  };
61
71
  export {
62
- v as MvIconfront,
63
- I as default
72
+ C as MvIconfront,
73
+ $ as default
64
74
  };
@@ -1 +1 @@
1
- (function(n,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(n=typeof globalThis<"u"?globalThis:n||self,t(n.MvIconfront={},n.Vue))})(this,function(n,t){"use strict";const a=t.defineComponent({name:"MvIconfront",props:{name:{type:String,default:""},color:{type:String,default:""},size:{type:[String,Number],default:""},isRed:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},setup(e){const o=t.getCurrentInstance(),r=t.inject("mvIconfrontDefaultColor"),c=o==null?void 0:o.appContext.config.globalProperties.$mvIconfrontDefaultColor,i=r||c||"#FFFFFF";return{iconStyle:t.computed(()=>{const l={};if(e.disabled?l.color="#C0C4CC !important":e.isRed?l.color="#f56c6c !important":e.color?l.color=`${e.color} !important`:l.color=`${i} !important`,e.size){const f=e.size.toString();l.fontSize=f.endsWith("px")||f.endsWith("rem")?f:`${f}px`}return l})}}}),d=(e,o)=>{const r=e.__vccOpts||e;for(const[c,i]of o)r[c]=i;return r};function u(e,o,r,c,i,p){return t.openBlock(),t.createElementBlock("i",t.mergeProps({class:["icon2",e.name,{"is-disabled":e.disabled}],style:e.iconStyle},e.$attrs),null,16)}const s=d(a,[["render",u]]),m={install:(e,o)=>{o!=null&&o.defaultColor&&(e.config.globalProperties.$mvIconfrontDefaultColor=o.defaultColor,e.provide("mvIconfrontDefaultColor",o.defaultColor)),e.component("MvIconfront",s)}};n.MvIconfront=s,n.default=m,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(l,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(l=typeof globalThis<"u"?globalThis:l||self,t(l.MvIconfront={},l.Vue))})(this,function(l,t){"use strict";const f={defaultColor:"#FFFFFF"};function s(e){e.defaultColor&&(f.defaultColor=e.defaultColor)}function a(){return f}const d=t.defineComponent({name:"MvIconfront",props:{name:{type:String,default:""},color:{type:String,default:""},size:{type:[String,Number],default:""},isRed:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},setup(e){const o=a().defaultColor||"#FFFFFF";return{iconStyle:t.computed(()=>{const n={};if(e.disabled?n.opacity="0.4 !important":e.isRed?n.color="#f56c6c !important":e.color?n.color=`${e.color} !important`:n.color=`${o} !important`,e.size){const i=e.size.toString();n.fontSize=i.endsWith("px")||i.endsWith("rem")?i:`${i}px`}return n})}}}),u=(e,o)=>{const r=e.__vccOpts||e;for(const[n,i]of o)r[n]=i;return r};function m(e,o,r,n,i,g){return t.openBlock(),t.createElementBlock("i",t.mergeProps({class:["icon2",e.name,{"is-disabled":e.disabled}],style:e.iconStyle},e.$attrs),null,16)}const c=u(d,[["render",m]]),p={install:(e,o)=>{o!=null&&o.defaultColor&&s({defaultColor:o.defaultColor}),e.component("MvIconfront",c)}};l.MvIconfront=c,l.default=p,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mv-iconfront",
3
- "version": "1.0.8",
3
+ "version": "1.1.0",
4
4
  "description": "A customized icon component for Vue 3",
5
5
  "main": "dist/mv-iconfront.umd.js",
6
6
  "module": "dist/mv-iconfront.es.js",