@hhorg/icon
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -1,7 +0,4 @@ | ||
import Icon from "./icon"; | ||
const version = "0.0.5"; | ||
const version = "0.0.6"; | ||
function install(app) { | ||
const components = [ | ||
Icon | ||
]; | ||
const components = []; | ||
components.forEach((item) => { | ||
@@ -20,3 +17,2 @@ if (item.install) { | ||
export { | ||
Icon, | ||
stdin_default as default, | ||
@@ -23,0 +19,0 @@ install, |
"use strict"; | ||
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } }); | ||
const vue = require("vue"); | ||
const IconSymbolSfc = ""; | ||
const __vue_sfc__$2 = { | ||
name: "IconSymbol", | ||
props: { | ||
name: { type: String, required: true }, | ||
size: { type: String || Number }, | ||
dot: { type: Boolean, default: false }, | ||
badge: { type: String || Number }, | ||
badgeMax: { type: Number } | ||
}, | ||
computed: { | ||
// 图标类名 | ||
iconName() { | ||
return `${this.name}`; | ||
}, | ||
// 图标大小 | ||
iconSize() { | ||
if (this.size) { | ||
return typeof this.size === "number" ? this.size + "px" : this.size; | ||
} else { | ||
return "16px"; | ||
} | ||
}, | ||
// 图标样式 | ||
styles() { | ||
const obj = { | ||
width: this.iconSize, | ||
height: this.iconSize, | ||
fill: "currentColor", | ||
overflow: "hidden" | ||
}; | ||
if (this.size) { | ||
const currSize = typeof this.size === "number" ? this.size + "px" : this.size; | ||
obj.width = currSize; | ||
obj.height = currSize; | ||
} | ||
return obj; | ||
}, | ||
// 徽标样式 | ||
dotStyles() { | ||
const dotPosition = `${this.iconSize.replace("px", "") - 4}px`; | ||
return { | ||
bottom: `${dotPosition}`, | ||
left: `${dotPosition}`, | ||
padding: this.badge ? "2px 4px" : "4px" | ||
}; | ||
}, | ||
// 徽标显示文名称 | ||
badgeText() { | ||
if (this.badge) { | ||
return this.badge > this.badgeMax ? `${this.badgeMax}+` : this.badge; | ||
} else { | ||
return ""; | ||
} | ||
} | ||
} | ||
}; | ||
const _hoisted_1 = { | ||
key: 0, | ||
class: "hh-icon--symbol" | ||
}; | ||
const _hoisted_2 = ["xlink:href"]; | ||
const _hoisted_3 = ["xlink:href"]; | ||
function __vue_render__$2(_ctx, _cache) { | ||
return vue.openBlock(), vue.createElementBlock( | ||
vue.Fragment, | ||
null, | ||
[ | ||
vue.createCommentVNode(" 有徽标 "), | ||
_ctx.dot ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [ | ||
(vue.openBlock(), vue.createElementBlock( | ||
"svg", | ||
vue.mergeProps({ style: _ctx.styles }, vue.toHandlers(_ctx.$listeners, true)), | ||
[ | ||
vue.createElementVNode("use", { | ||
"xlink:href": `#${_ctx.iconName}` | ||
}, null, 8, _hoisted_2) | ||
], | ||
16 | ||
/* FULL_PROPS */ | ||
)), | ||
vue.createElementVNode( | ||
"span", | ||
{ | ||
class: "icon-dot", | ||
style: vue.normalizeStyle(_ctx.dotStyles) | ||
}, | ||
vue.toDisplayString(_ctx.badgeText), | ||
5 | ||
/* TEXT, STYLE */ | ||
) | ||
])) : (vue.openBlock(), vue.createElementBlock( | ||
vue.Fragment, | ||
{ key: 1 }, | ||
[ | ||
vue.createCommentVNode(" 无徽标 "), | ||
(vue.openBlock(), vue.createElementBlock( | ||
"svg", | ||
vue.mergeProps({ style: _ctx.styles }, vue.toHandlers(_ctx.$listeners, true)), | ||
[ | ||
vue.createElementVNode("use", { | ||
"xlink:href": `#${_ctx.iconName}` | ||
}, null, 8, _hoisted_3) | ||
], | ||
16 | ||
/* FULL_PROPS */ | ||
)) | ||
], | ||
2112 | ||
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */ | ||
)) | ||
], | ||
2112 | ||
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */ | ||
); | ||
} | ||
__vue_sfc__$2.render = __vue_render__$2; | ||
var stdin_default$4 = __vue_sfc__$2; | ||
const IconFontSfc = ""; | ||
const __vue_sfc__$1 = { | ||
name: "IconFont", | ||
props: { | ||
name: { type: String, required: true }, | ||
dot: { type: Boolean, default: false }, | ||
badge: { type: String || Number }, | ||
badgeMax: { type: Number }, | ||
size: { type: String || Number }, | ||
color: { type: String, default: "" } | ||
}, | ||
computed: { | ||
// 图标类名 | ||
iconName() { | ||
return `ds-iconfont iconfont ${this.name}`; | ||
}, | ||
// 图标大小 | ||
iconFontSize() { | ||
if (this.size) { | ||
return typeof this.size === "number" ? this.size + "px" : this.size; | ||
} else { | ||
return "16px"; | ||
} | ||
}, | ||
// 图标样式 | ||
styles() { | ||
const obj = { | ||
fontSize: this.iconFontSize | ||
}; | ||
if (this.color) { | ||
obj.color = this.color; | ||
} | ||
return obj; | ||
}, | ||
// 徽标样式 | ||
dotStyles() { | ||
const dotPosition = `${this.iconFontSize.replace("px", "") - 4}px`; | ||
return { | ||
bottom: `${dotPosition}`, | ||
left: `${dotPosition}`, | ||
padding: this.badge ? "2px 4px" : "4px" | ||
}; | ||
}, | ||
// 徽标显示文名称 | ||
badgeText() { | ||
if (this.badge) { | ||
return this.badge > this.badgeMax ? `${this.badgeMax}+` : this.badge; | ||
} else { | ||
return ""; | ||
} | ||
} | ||
} | ||
}; | ||
function __vue_render__$1(_ctx, _cache) { | ||
return vue.openBlock(), vue.createElementBlock( | ||
"i", | ||
vue.mergeProps({ | ||
class: _ctx.iconName, | ||
style: _ctx.styles | ||
}, _ctx.$attrs, vue.toHandlers(_ctx.$listeners, true)), | ||
[ | ||
_ctx.dot ? (vue.openBlock(), vue.createElementBlock( | ||
"span", | ||
{ | ||
key: 0, | ||
class: "icon-dot", | ||
style: vue.normalizeStyle(_ctx.dotStyles) | ||
}, | ||
vue.toDisplayString(_ctx.badgeText), | ||
5 | ||
/* TEXT, STYLE */ | ||
)) : vue.createCommentVNode("v-if", true) | ||
], | ||
16 | ||
/* FULL_PROPS */ | ||
); | ||
} | ||
__vue_sfc__$1.render = __vue_render__$1; | ||
var stdin_default$3 = __vue_sfc__$1; | ||
const __vue_sfc__ = { | ||
name: "HhIcon", | ||
components: { | ||
IconSymbol: stdin_default$4, | ||
IconFont: stdin_default$3 | ||
}, | ||
props: { | ||
symbol: { type: String, required: true }, | ||
name: { type: String, required: true }, | ||
dot: { type: Boolean, default: false }, | ||
badge: { type: String || Number }, | ||
badgeMax: { type: Number }, | ||
size: { type: String || Number }, | ||
color: { type: String, default: "" } | ||
} | ||
}; | ||
function __vue_render__(_ctx, _cache) { | ||
const _component_IconSymbol = vue.resolveComponent("IconSymbol"); | ||
const _component_IconFont = vue.resolveComponent("IconFont"); | ||
return vue.openBlock(), vue.createElementBlock( | ||
vue.Fragment, | ||
null, | ||
[ | ||
vue.createCommentVNode(" 多色图标 "), | ||
_ctx.symbol ? (vue.openBlock(), vue.createBlock( | ||
_component_IconSymbol, | ||
vue.normalizeProps(vue.mergeProps({ key: 0 }, _ctx.$props)), | ||
null, | ||
16 | ||
/* FULL_PROPS */ | ||
)) : (vue.openBlock(), vue.createElementBlock( | ||
vue.Fragment, | ||
{ key: 1 }, | ||
[ | ||
vue.createCommentVNode(" 单色图标 "), | ||
vue.createVNode( | ||
_component_IconFont, | ||
vue.normalizeProps(vue.guardReactiveProps(_ctx.$props)), | ||
null, | ||
16 | ||
/* FULL_PROPS */ | ||
) | ||
], | ||
2112 | ||
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */ | ||
)) | ||
], | ||
2112 | ||
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */ | ||
); | ||
} | ||
__vue_sfc__.render = __vue_render__; | ||
var stdin_default$2 = __vue_sfc__; | ||
const installHhIcon = { | ||
options: {}, | ||
install(app) { | ||
const { url = "", css = "", js = "" } = this.options; | ||
let linkUrl = ""; | ||
let scriptUrl = ""; | ||
if (url) { | ||
if (url.endsWith(".css")) { | ||
linkUrl = url; | ||
scriptUrl = url.replace(".css", ".js"); | ||
} else { | ||
linkUrl = url.replace(".js", ".css"); | ||
scriptUrl = url; | ||
} | ||
} else { | ||
if (css) | ||
linkUrl = css; | ||
if (js) | ||
scriptUrl = js; | ||
} | ||
if (linkUrl) { | ||
const link = document.createElement("link"); | ||
link.setAttribute("rel", "stylesheet"); | ||
link.setAttribute("type", "text/css"); | ||
link.setAttribute("href", linkUrl); | ||
document.head.appendChild(link); | ||
} | ||
if (scriptUrl) { | ||
const script = document.createElement("script"); | ||
script.setAttribute("type", "text/javascript"); | ||
script.setAttribute("src", scriptUrl); | ||
document.head.appendChild(script); | ||
} | ||
app.component("HhIcon", stdin_default$2); | ||
} | ||
}; | ||
var stdin_default$1 = installHhIcon; | ||
const version = "0.0.5"; | ||
const version = "0.0.6"; | ||
function install(app) { | ||
const components = [ | ||
stdin_default$1 | ||
]; | ||
const components = []; | ||
components.forEach((item) => { | ||
@@ -308,5 +18,4 @@ if (item.install) { | ||
}; | ||
exports.Icon = stdin_default$1; | ||
exports.default = stdin_default; | ||
exports.install = install; | ||
exports.version = version; |
@@ -1,294 +0,4 @@ | ||
import { openBlock, createElementBlock, Fragment, createCommentVNode, mergeProps, toHandlers, createElementVNode, normalizeStyle, toDisplayString, resolveComponent, createBlock, normalizeProps, createVNode, guardReactiveProps } from "vue"; | ||
const IconSymbolSfc = ""; | ||
const __vue_sfc__$2 = { | ||
name: "IconSymbol", | ||
props: { | ||
name: { type: String, required: true }, | ||
size: { type: String || Number }, | ||
dot: { type: Boolean, default: false }, | ||
badge: { type: String || Number }, | ||
badgeMax: { type: Number } | ||
}, | ||
computed: { | ||
// 图标类名 | ||
iconName() { | ||
return `${this.name}`; | ||
}, | ||
// 图标大小 | ||
iconSize() { | ||
if (this.size) { | ||
return typeof this.size === "number" ? this.size + "px" : this.size; | ||
} else { | ||
return "16px"; | ||
} | ||
}, | ||
// 图标样式 | ||
styles() { | ||
const obj = { | ||
width: this.iconSize, | ||
height: this.iconSize, | ||
fill: "currentColor", | ||
overflow: "hidden" | ||
}; | ||
if (this.size) { | ||
const currSize = typeof this.size === "number" ? this.size + "px" : this.size; | ||
obj.width = currSize; | ||
obj.height = currSize; | ||
} | ||
return obj; | ||
}, | ||
// 徽标样式 | ||
dotStyles() { | ||
const dotPosition = `${this.iconSize.replace("px", "") - 4}px`; | ||
return { | ||
bottom: `${dotPosition}`, | ||
left: `${dotPosition}`, | ||
padding: this.badge ? "2px 4px" : "4px" | ||
}; | ||
}, | ||
// 徽标显示文名称 | ||
badgeText() { | ||
if (this.badge) { | ||
return this.badge > this.badgeMax ? `${this.badgeMax}+` : this.badge; | ||
} else { | ||
return ""; | ||
} | ||
} | ||
} | ||
}; | ||
const _hoisted_1 = { | ||
key: 0, | ||
class: "hh-icon--symbol" | ||
}; | ||
const _hoisted_2 = ["xlink:href"]; | ||
const _hoisted_3 = ["xlink:href"]; | ||
function __vue_render__$2(_ctx, _cache) { | ||
return openBlock(), createElementBlock( | ||
Fragment, | ||
null, | ||
[ | ||
createCommentVNode(" 有徽标 "), | ||
_ctx.dot ? (openBlock(), createElementBlock("div", _hoisted_1, [ | ||
(openBlock(), createElementBlock( | ||
"svg", | ||
mergeProps({ style: _ctx.styles }, toHandlers(_ctx.$listeners, true)), | ||
[ | ||
createElementVNode("use", { | ||
"xlink:href": `#${_ctx.iconName}` | ||
}, null, 8, _hoisted_2) | ||
], | ||
16 | ||
/* FULL_PROPS */ | ||
)), | ||
createElementVNode( | ||
"span", | ||
{ | ||
class: "icon-dot", | ||
style: normalizeStyle(_ctx.dotStyles) | ||
}, | ||
toDisplayString(_ctx.badgeText), | ||
5 | ||
/* TEXT, STYLE */ | ||
) | ||
])) : (openBlock(), createElementBlock( | ||
Fragment, | ||
{ key: 1 }, | ||
[ | ||
createCommentVNode(" 无徽标 "), | ||
(openBlock(), createElementBlock( | ||
"svg", | ||
mergeProps({ style: _ctx.styles }, toHandlers(_ctx.$listeners, true)), | ||
[ | ||
createElementVNode("use", { | ||
"xlink:href": `#${_ctx.iconName}` | ||
}, null, 8, _hoisted_3) | ||
], | ||
16 | ||
/* FULL_PROPS */ | ||
)) | ||
], | ||
2112 | ||
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */ | ||
)) | ||
], | ||
2112 | ||
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */ | ||
); | ||
} | ||
__vue_sfc__$2.render = __vue_render__$2; | ||
var stdin_default$4 = __vue_sfc__$2; | ||
const IconFontSfc = ""; | ||
const __vue_sfc__$1 = { | ||
name: "IconFont", | ||
props: { | ||
name: { type: String, required: true }, | ||
dot: { type: Boolean, default: false }, | ||
badge: { type: String || Number }, | ||
badgeMax: { type: Number }, | ||
size: { type: String || Number }, | ||
color: { type: String, default: "" } | ||
}, | ||
computed: { | ||
// 图标类名 | ||
iconName() { | ||
return `ds-iconfont iconfont ${this.name}`; | ||
}, | ||
// 图标大小 | ||
iconFontSize() { | ||
if (this.size) { | ||
return typeof this.size === "number" ? this.size + "px" : this.size; | ||
} else { | ||
return "16px"; | ||
} | ||
}, | ||
// 图标样式 | ||
styles() { | ||
const obj = { | ||
fontSize: this.iconFontSize | ||
}; | ||
if (this.color) { | ||
obj.color = this.color; | ||
} | ||
return obj; | ||
}, | ||
// 徽标样式 | ||
dotStyles() { | ||
const dotPosition = `${this.iconFontSize.replace("px", "") - 4}px`; | ||
return { | ||
bottom: `${dotPosition}`, | ||
left: `${dotPosition}`, | ||
padding: this.badge ? "2px 4px" : "4px" | ||
}; | ||
}, | ||
// 徽标显示文名称 | ||
badgeText() { | ||
if (this.badge) { | ||
return this.badge > this.badgeMax ? `${this.badgeMax}+` : this.badge; | ||
} else { | ||
return ""; | ||
} | ||
} | ||
} | ||
}; | ||
function __vue_render__$1(_ctx, _cache) { | ||
return openBlock(), createElementBlock( | ||
"i", | ||
mergeProps({ | ||
class: _ctx.iconName, | ||
style: _ctx.styles | ||
}, _ctx.$attrs, toHandlers(_ctx.$listeners, true)), | ||
[ | ||
_ctx.dot ? (openBlock(), createElementBlock( | ||
"span", | ||
{ | ||
key: 0, | ||
class: "icon-dot", | ||
style: normalizeStyle(_ctx.dotStyles) | ||
}, | ||
toDisplayString(_ctx.badgeText), | ||
5 | ||
/* TEXT, STYLE */ | ||
)) : createCommentVNode("v-if", true) | ||
], | ||
16 | ||
/* FULL_PROPS */ | ||
); | ||
} | ||
__vue_sfc__$1.render = __vue_render__$1; | ||
var stdin_default$3 = __vue_sfc__$1; | ||
const __vue_sfc__ = { | ||
name: "HhIcon", | ||
components: { | ||
IconSymbol: stdin_default$4, | ||
IconFont: stdin_default$3 | ||
}, | ||
props: { | ||
symbol: { type: String, required: true }, | ||
name: { type: String, required: true }, | ||
dot: { type: Boolean, default: false }, | ||
badge: { type: String || Number }, | ||
badgeMax: { type: Number }, | ||
size: { type: String || Number }, | ||
color: { type: String, default: "" } | ||
} | ||
}; | ||
function __vue_render__(_ctx, _cache) { | ||
const _component_IconSymbol = resolveComponent("IconSymbol"); | ||
const _component_IconFont = resolveComponent("IconFont"); | ||
return openBlock(), createElementBlock( | ||
Fragment, | ||
null, | ||
[ | ||
createCommentVNode(" 多色图标 "), | ||
_ctx.symbol ? (openBlock(), createBlock( | ||
_component_IconSymbol, | ||
normalizeProps(mergeProps({ key: 0 }, _ctx.$props)), | ||
null, | ||
16 | ||
/* FULL_PROPS */ | ||
)) : (openBlock(), createElementBlock( | ||
Fragment, | ||
{ key: 1 }, | ||
[ | ||
createCommentVNode(" 单色图标 "), | ||
createVNode( | ||
_component_IconFont, | ||
normalizeProps(guardReactiveProps(_ctx.$props)), | ||
null, | ||
16 | ||
/* FULL_PROPS */ | ||
) | ||
], | ||
2112 | ||
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */ | ||
)) | ||
], | ||
2112 | ||
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */ | ||
); | ||
} | ||
__vue_sfc__.render = __vue_render__; | ||
var stdin_default$2 = __vue_sfc__; | ||
const installHhIcon = { | ||
options: {}, | ||
install(app) { | ||
const { url = "", css = "", js = "" } = this.options; | ||
let linkUrl = ""; | ||
let scriptUrl = ""; | ||
if (url) { | ||
if (url.endsWith(".css")) { | ||
linkUrl = url; | ||
scriptUrl = url.replace(".css", ".js"); | ||
} else { | ||
linkUrl = url.replace(".js", ".css"); | ||
scriptUrl = url; | ||
} | ||
} else { | ||
if (css) | ||
linkUrl = css; | ||
if (js) | ||
scriptUrl = js; | ||
} | ||
if (linkUrl) { | ||
const link = document.createElement("link"); | ||
link.setAttribute("rel", "stylesheet"); | ||
link.setAttribute("type", "text/css"); | ||
link.setAttribute("href", linkUrl); | ||
document.head.appendChild(link); | ||
} | ||
if (scriptUrl) { | ||
const script = document.createElement("script"); | ||
script.setAttribute("type", "text/javascript"); | ||
script.setAttribute("src", scriptUrl); | ||
document.head.appendChild(script); | ||
} | ||
app.component("HhIcon", stdin_default$2); | ||
} | ||
}; | ||
var stdin_default$1 = installHhIcon; | ||
const version = "0.0.5"; | ||
const version = "0.0.6"; | ||
function install(app) { | ||
const components = [ | ||
stdin_default$1 | ||
]; | ||
const components = []; | ||
components.forEach((item) => { | ||
@@ -307,3 +17,2 @@ if (item.install) { | ||
export { | ||
stdin_default$1 as Icon, | ||
stdin_default as default, | ||
@@ -310,0 +19,0 @@ install, |
298
lib/icon.js
(function(global, factory) { | ||
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("vue")) : typeof define === "function" && define.amd ? define(["exports", "vue"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.icon = {}, global.Vue)); | ||
})(this, function(exports2, vue) { | ||
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.icon = {})); | ||
})(this, function(exports2) { | ||
"use strict"; | ||
const IconSymbolSfc = ""; | ||
const __vue_sfc__$2 = { | ||
name: "IconSymbol", | ||
props: { | ||
name: { type: String, required: true }, | ||
size: { type: String || Number }, | ||
dot: { type: Boolean, default: false }, | ||
badge: { type: String || Number }, | ||
badgeMax: { type: Number } | ||
}, | ||
computed: { | ||
// 图标类名 | ||
iconName() { | ||
return `${this.name}`; | ||
}, | ||
// 图标大小 | ||
iconSize() { | ||
if (this.size) { | ||
return typeof this.size === "number" ? this.size + "px" : this.size; | ||
} else { | ||
return "16px"; | ||
} | ||
}, | ||
// 图标样式 | ||
styles() { | ||
const obj = { | ||
width: this.iconSize, | ||
height: this.iconSize, | ||
fill: "currentColor", | ||
overflow: "hidden" | ||
}; | ||
if (this.size) { | ||
const currSize = typeof this.size === "number" ? this.size + "px" : this.size; | ||
obj.width = currSize; | ||
obj.height = currSize; | ||
} | ||
return obj; | ||
}, | ||
// 徽标样式 | ||
dotStyles() { | ||
const dotPosition = `${this.iconSize.replace("px", "") - 4}px`; | ||
return { | ||
bottom: `${dotPosition}`, | ||
left: `${dotPosition}`, | ||
padding: this.badge ? "2px 4px" : "4px" | ||
}; | ||
}, | ||
// 徽标显示文名称 | ||
badgeText() { | ||
if (this.badge) { | ||
return this.badge > this.badgeMax ? `${this.badgeMax}+` : this.badge; | ||
} else { | ||
return ""; | ||
} | ||
} | ||
} | ||
}; | ||
const _hoisted_1 = { | ||
key: 0, | ||
class: "hh-icon--symbol" | ||
}; | ||
const _hoisted_2 = ["xlink:href"]; | ||
const _hoisted_3 = ["xlink:href"]; | ||
function __vue_render__$2(_ctx, _cache) { | ||
return vue.openBlock(), vue.createElementBlock( | ||
vue.Fragment, | ||
null, | ||
[ | ||
vue.createCommentVNode(" 有徽标 "), | ||
_ctx.dot ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [ | ||
(vue.openBlock(), vue.createElementBlock( | ||
"svg", | ||
vue.mergeProps({ style: _ctx.styles }, vue.toHandlers(_ctx.$listeners, true)), | ||
[ | ||
vue.createElementVNode("use", { | ||
"xlink:href": `#${_ctx.iconName}` | ||
}, null, 8, _hoisted_2) | ||
], | ||
16 | ||
/* FULL_PROPS */ | ||
)), | ||
vue.createElementVNode( | ||
"span", | ||
{ | ||
class: "icon-dot", | ||
style: vue.normalizeStyle(_ctx.dotStyles) | ||
}, | ||
vue.toDisplayString(_ctx.badgeText), | ||
5 | ||
/* TEXT, STYLE */ | ||
) | ||
])) : (vue.openBlock(), vue.createElementBlock( | ||
vue.Fragment, | ||
{ key: 1 }, | ||
[ | ||
vue.createCommentVNode(" 无徽标 "), | ||
(vue.openBlock(), vue.createElementBlock( | ||
"svg", | ||
vue.mergeProps({ style: _ctx.styles }, vue.toHandlers(_ctx.$listeners, true)), | ||
[ | ||
vue.createElementVNode("use", { | ||
"xlink:href": `#${_ctx.iconName}` | ||
}, null, 8, _hoisted_3) | ||
], | ||
16 | ||
/* FULL_PROPS */ | ||
)) | ||
], | ||
2112 | ||
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */ | ||
)) | ||
], | ||
2112 | ||
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */ | ||
); | ||
} | ||
__vue_sfc__$2.render = __vue_render__$2; | ||
var stdin_default$4 = __vue_sfc__$2; | ||
const IconFontSfc = ""; | ||
const __vue_sfc__$1 = { | ||
name: "IconFont", | ||
props: { | ||
name: { type: String, required: true }, | ||
dot: { type: Boolean, default: false }, | ||
badge: { type: String || Number }, | ||
badgeMax: { type: Number }, | ||
size: { type: String || Number }, | ||
color: { type: String, default: "" } | ||
}, | ||
computed: { | ||
// 图标类名 | ||
iconName() { | ||
return `ds-iconfont iconfont ${this.name}`; | ||
}, | ||
// 图标大小 | ||
iconFontSize() { | ||
if (this.size) { | ||
return typeof this.size === "number" ? this.size + "px" : this.size; | ||
} else { | ||
return "16px"; | ||
} | ||
}, | ||
// 图标样式 | ||
styles() { | ||
const obj = { | ||
fontSize: this.iconFontSize | ||
}; | ||
if (this.color) { | ||
obj.color = this.color; | ||
} | ||
return obj; | ||
}, | ||
// 徽标样式 | ||
dotStyles() { | ||
const dotPosition = `${this.iconFontSize.replace("px", "") - 4}px`; | ||
return { | ||
bottom: `${dotPosition}`, | ||
left: `${dotPosition}`, | ||
padding: this.badge ? "2px 4px" : "4px" | ||
}; | ||
}, | ||
// 徽标显示文名称 | ||
badgeText() { | ||
if (this.badge) { | ||
return this.badge > this.badgeMax ? `${this.badgeMax}+` : this.badge; | ||
} else { | ||
return ""; | ||
} | ||
} | ||
} | ||
}; | ||
function __vue_render__$1(_ctx, _cache) { | ||
return vue.openBlock(), vue.createElementBlock( | ||
"i", | ||
vue.mergeProps({ | ||
class: _ctx.iconName, | ||
style: _ctx.styles | ||
}, _ctx.$attrs, vue.toHandlers(_ctx.$listeners, true)), | ||
[ | ||
_ctx.dot ? (vue.openBlock(), vue.createElementBlock( | ||
"span", | ||
{ | ||
key: 0, | ||
class: "icon-dot", | ||
style: vue.normalizeStyle(_ctx.dotStyles) | ||
}, | ||
vue.toDisplayString(_ctx.badgeText), | ||
5 | ||
/* TEXT, STYLE */ | ||
)) : vue.createCommentVNode("v-if", true) | ||
], | ||
16 | ||
/* FULL_PROPS */ | ||
); | ||
} | ||
__vue_sfc__$1.render = __vue_render__$1; | ||
var stdin_default$3 = __vue_sfc__$1; | ||
const __vue_sfc__ = { | ||
name: "HhIcon", | ||
components: { | ||
IconSymbol: stdin_default$4, | ||
IconFont: stdin_default$3 | ||
}, | ||
props: { | ||
symbol: { type: String, required: true }, | ||
name: { type: String, required: true }, | ||
dot: { type: Boolean, default: false }, | ||
badge: { type: String || Number }, | ||
badgeMax: { type: Number }, | ||
size: { type: String || Number }, | ||
color: { type: String, default: "" } | ||
} | ||
}; | ||
function __vue_render__(_ctx, _cache) { | ||
const _component_IconSymbol = vue.resolveComponent("IconSymbol"); | ||
const _component_IconFont = vue.resolveComponent("IconFont"); | ||
return vue.openBlock(), vue.createElementBlock( | ||
vue.Fragment, | ||
null, | ||
[ | ||
vue.createCommentVNode(" 多色图标 "), | ||
_ctx.symbol ? (vue.openBlock(), vue.createBlock( | ||
_component_IconSymbol, | ||
vue.normalizeProps(vue.mergeProps({ key: 0 }, _ctx.$props)), | ||
null, | ||
16 | ||
/* FULL_PROPS */ | ||
)) : (vue.openBlock(), vue.createElementBlock( | ||
vue.Fragment, | ||
{ key: 1 }, | ||
[ | ||
vue.createCommentVNode(" 单色图标 "), | ||
vue.createVNode( | ||
_component_IconFont, | ||
vue.normalizeProps(vue.guardReactiveProps(_ctx.$props)), | ||
null, | ||
16 | ||
/* FULL_PROPS */ | ||
) | ||
], | ||
2112 | ||
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */ | ||
)) | ||
], | ||
2112 | ||
/* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */ | ||
); | ||
} | ||
__vue_sfc__.render = __vue_render__; | ||
var stdin_default$2 = __vue_sfc__; | ||
const installHhIcon = { | ||
options: {}, | ||
install(app) { | ||
const { url = "", css = "", js = "" } = this.options; | ||
let linkUrl = ""; | ||
let scriptUrl = ""; | ||
if (url) { | ||
if (url.endsWith(".css")) { | ||
linkUrl = url; | ||
scriptUrl = url.replace(".css", ".js"); | ||
} else { | ||
linkUrl = url.replace(".js", ".css"); | ||
scriptUrl = url; | ||
} | ||
} else { | ||
if (css) | ||
linkUrl = css; | ||
if (js) | ||
scriptUrl = js; | ||
} | ||
if (linkUrl) { | ||
const link = document.createElement("link"); | ||
link.setAttribute("rel", "stylesheet"); | ||
link.setAttribute("type", "text/css"); | ||
link.setAttribute("href", linkUrl); | ||
document.head.appendChild(link); | ||
} | ||
if (scriptUrl) { | ||
const script = document.createElement("script"); | ||
script.setAttribute("type", "text/javascript"); | ||
script.setAttribute("src", scriptUrl); | ||
document.head.appendChild(script); | ||
} | ||
app.component("HhIcon", stdin_default$2); | ||
} | ||
}; | ||
var stdin_default$1 = installHhIcon; | ||
const version = "0.0.5"; | ||
const version = "0.0.6"; | ||
function install(app) { | ||
const components = [ | ||
stdin_default$1 | ||
]; | ||
const components = []; | ||
components.forEach((item) => { | ||
@@ -309,3 +20,2 @@ if (item.install) { | ||
}; | ||
exports2.Icon = stdin_default$1; | ||
exports2.default = stdin_default; | ||
@@ -312,0 +22,0 @@ exports2.install = install; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).icon={},e.Vue)}(this,(function(e,t){"use strict";const o={name:"IconSymbol",props:{name:{type:String,required:!0},size:{type:String||Number},dot:{type:Boolean,default:!1},badge:{type:String||Number},badgeMax:{type:Number}},computed:{iconName(){return`${this.name}`},iconSize(){return this.size?"number"==typeof this.size?this.size+"px":this.size:"16px"},styles(){const e={width:this.iconSize,height:this.iconSize,fill:"currentColor",overflow:"hidden"};if(this.size){const t="number"==typeof this.size?this.size+"px":this.size;e.width=t,e.height=t}return e},dotStyles(){const e=this.iconSize.replace("px","")-4+"px";return{bottom:`${e}`,left:`${e}`,padding:this.badge?"2px 4px":"4px"}},badgeText(){return this.badge?this.badge>this.badgeMax?`${this.badgeMax}+`:this.badge:""}}},n={key:0,class:"hh-icon--symbol"},s=["xlink:href"],r=["xlink:href"];o.render=function(e,o){return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createCommentVNode(" 有徽标 "),e.dot?(t.openBlock(),t.createElementBlock("div",n,[(t.openBlock(),t.createElementBlock("svg",t.mergeProps({style:e.styles},t.toHandlers(e.$listeners,!0)),[t.createElementVNode("use",{"xlink:href":`#${e.iconName}`},null,8,s)],16)),t.createElementVNode("span",{class:"icon-dot",style:t.normalizeStyle(e.dotStyles)},t.toDisplayString(e.badgeText),5)])):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createCommentVNode(" 无徽标 "),(t.openBlock(),t.createElementBlock("svg",t.mergeProps({style:e.styles},t.toHandlers(e.$listeners,!0)),[t.createElementVNode("use",{"xlink:href":`#${e.iconName}`},null,8,r)],16))],2112))],2112)};var i=o;const l={name:"IconFont",props:{name:{type:String,required:!0},dot:{type:Boolean,default:!1},badge:{type:String||Number},badgeMax:{type:Number},size:{type:String||Number},color:{type:String,default:""}},computed:{iconName(){return`ds-iconfont iconfont ${this.name}`},iconFontSize(){return this.size?"number"==typeof this.size?this.size+"px":this.size:"16px"},styles(){const e={fontSize:this.iconFontSize};return this.color&&(e.color=this.color),e},dotStyles(){const e=this.iconFontSize.replace("px","")-4+"px";return{bottom:`${e}`,left:`${e}`,padding:this.badge?"2px 4px":"4px"}},badgeText(){return this.badge?this.badge>this.badgeMax?`${this.badgeMax}+`:this.badge:""}}};l.render=function(e,o){return t.openBlock(),t.createElementBlock("i",t.mergeProps({class:e.iconName,style:e.styles},e.$attrs,t.toHandlers(e.$listeners,!0)),[e.dot?(t.openBlock(),t.createElementBlock("span",{key:0,class:"icon-dot",style:t.normalizeStyle(e.dotStyles)},t.toDisplayString(e.badgeText),5)):t.createCommentVNode("v-if",!0)],16)};const c={name:"HhIcon",components:{IconSymbol:i,IconFont:l},props:{symbol:{type:String,required:!0},name:{type:String,required:!0},dot:{type:Boolean,default:!1},badge:{type:String||Number},badgeMax:{type:Number},size:{type:String||Number},color:{type:String,default:""}}};c.render=function(e,o){const n=t.resolveComponent("IconSymbol"),s=t.resolveComponent("IconFont");return t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createCommentVNode(" 多色图标 "),e.symbol?(t.openBlock(),t.createBlock(n,t.normalizeProps(t.mergeProps({key:0},e.$props)),null,16)):(t.openBlock(),t.createElementBlock(t.Fragment,{key:1},[t.createCommentVNode(" 单色图标 "),t.createVNode(s,t.normalizeProps(t.guardReactiveProps(e.$props)),null,16)],2112))],2112)};var a=c;var p={options:{},install(e){const{url:t="",css:o="",js:n=""}=this.options;let s="",r="";if(t?t.endsWith(".css")?(s=t,r=t.replace(".css",".js")):(s=t.replace(".js",".css"),r=t):(o&&(s=o),n&&(r=n)),s){const e=document.createElement("link");e.setAttribute("rel","stylesheet"),e.setAttribute("type","text/css"),e.setAttribute("href",s),document.head.appendChild(e)}if(r){const e=document.createElement("script");e.setAttribute("type","text/javascript"),e.setAttribute("src",r),document.head.appendChild(e)}e.component("HhIcon",a)}};const d="0.0.5";function m(e){[p].forEach((t=>{t.install?e.use(t):t.name&&e.component(t.name,t)}))}var u={install:m,version:d};e.Icon=p,e.default=u,e.install=m,e.version=d,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).icon={})}(this,(function(e){"use strict";const n="0.0.6";function o(e){[].forEach((n=>{n.install?e.use(n):n.name&&e.component(n.name,n)}))}var t={install:o,version:n};e.default=t,e.install=o,e.version=n,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})})); |
@@ -1,6 +0,4 @@ | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
@@ -19,14 +17,5 @@ var __export = (target, all) => { | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
// If the importer is in node compatibility mode or this is not an ESM | ||
// file that has been converted to a CommonJS file using a Babel- | ||
// compatible transform (i.e. "__esModule" has not been set), then set | ||
// "default" to the CommonJS "module.exports" for node compatibility. | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
var stdin_exports = {}; | ||
__export(stdin_exports, { | ||
Icon: () => import_icon.default, | ||
default: () => stdin_default, | ||
@@ -37,8 +26,5 @@ install: () => install, | ||
module.exports = __toCommonJS(stdin_exports); | ||
var import_icon = __toESM(require("./icon")); | ||
const version = "0.0.5"; | ||
const version = "0.0.6"; | ||
function install(app) { | ||
const components = [ | ||
import_icon.default | ||
]; | ||
const components = []; | ||
components.forEach((item) => { | ||
@@ -45,0 +31,0 @@ if (item.install) { |
@@ -1,1 +0,1 @@ | ||
{"$schema":"https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json","framework":"vue","name":"icon","version":"0.0.5","contributions":{"html":{"tags":[{"name":"demo-button","attributes":[{"name":"type","default":"`primary`","description":"按钮类型","value":{"type":"string","kind":"expression"}},{"name":"color","default":"-","description":"按钮颜色","value":{"type":"string","kind":"expression"}}],"events":[{"name":"click","description":"点击时触发","arguments":[{"name":"event","type":"MouseEvent"}]}],"slots":[{"name":"default","description":"默认插槽"}]}],"attributes":[]}},"js-types-syntax":"typescript"} | ||
{"$schema":"https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json","framework":"vue","name":"icon","version":"0.0.6","contributions":{"html":{"tags":[{"name":"demo-button","attributes":[{"name":"type","default":"`primary`","description":"按钮类型","value":{"type":"string","kind":"expression"}},{"name":"color","default":"-","description":"按钮颜色","value":{"type":"string","kind":"expression"}}],"events":[{"name":"click","description":"点击时触发","arguments":[{"name":"event","type":"MouseEvent"}]}],"slots":[{"name":"default","description":"默认插槽"}]}],"attributes":[]}},"js-types-syntax":"typescript"} |
{ | ||
"name": "@hhorg/icon", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "图标库", | ||
@@ -5,0 +5,0 @@ "main": "lib/hh-icon.js", |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
2
29893
26
835