@hhorg/icon
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -1,28 +0,58 @@ | ||
import "./IconFont-sfc.css"; | ||
const __vue_sfc__ = { | ||
name: "IconFont", | ||
import './IconFont-sfc.css'; | ||
var __vue_render__ = function __vue_render__() { | ||
var _vm = this; | ||
var _h = _vm.$createElement; | ||
var _c = _vm._self._c || _h; | ||
return _c('i', _vm._g(_vm._b({ | ||
class: _vm.iconName, | ||
style: _vm.styles | ||
}, 'i', _vm.$attrs, false), _vm.$listeners), [_vm.dot ? [_c('span', { | ||
staticClass: "icon-dot", | ||
style: _vm.dotStyles | ||
}, [_vm._v(_vm._s(_vm.badgeText))])] : _vm._e()], 2); | ||
}; | ||
var __vue_staticRenderFns__ = []; | ||
export default { | ||
render: __vue_render__, | ||
staticRenderFns: __vue_staticRenderFns__, | ||
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: "" } | ||
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}`; | ||
iconName: function iconName() { | ||
return "ds-iconfont iconfont " + this.name; | ||
}, | ||
// 图标大小 | ||
iconFontSize() { | ||
iconFontSize: function iconFontSize() { | ||
if (this.size) { | ||
return typeof this.size === "number" ? this.size + "px" : this.size; | ||
return typeof this.size === 'number' ? this.size + 'px' : this.size; | ||
} else { | ||
return "16px"; | ||
return '16px'; | ||
} | ||
}, | ||
// 图标样式 | ||
styles() { | ||
const obj = { | ||
styles: function styles() { | ||
var obj = { | ||
fontSize: this.iconFontSize | ||
@@ -36,49 +66,19 @@ }; | ||
// 徽标样式 | ||
dotStyles() { | ||
const dotPosition = `${this.iconFontSize.replace("px", "") - 4}px`; | ||
dotStyles: function dotStyles() { | ||
var dotPosition = this.iconFontSize.replace('px', '') - 4 + "px"; | ||
return { | ||
bottom: `${dotPosition}`, | ||
left: `${dotPosition}`, | ||
padding: this.badge ? "2px 4px" : "4px" | ||
bottom: "" + dotPosition, | ||
left: "" + dotPosition, | ||
padding: this.badge ? '2px 4px' : '4px' | ||
}; | ||
}, | ||
// 徽标显示文名称 | ||
badgeText() { | ||
badgeText: function badgeText() { | ||
if (this.badge) { | ||
return this.badge > this.badgeMax ? `${this.badgeMax}+` : this.badge; | ||
return this.badge > this.badgeMax ? this.badgeMax + "+" : this.badge; | ||
} else { | ||
return ""; | ||
return ''; | ||
} | ||
} | ||
} | ||
}; | ||
import { toDisplayString as _toDisplayString, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, toHandlers as _toHandlers, mergeProps as _mergeProps } from "vue"; | ||
function __vue_render__(_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__.render = __vue_render__; | ||
var stdin_default = __vue_sfc__; | ||
export { | ||
stdin_default as default | ||
}; | ||
}; |
@@ -1,34 +0,72 @@ | ||
import "./IconSymbol-sfc.css"; | ||
const __vue_sfc__ = { | ||
name: "IconSymbol", | ||
import './IconSymbol-sfc.css'; | ||
var __vue_render__ = function __vue_render__() { | ||
var _vm = this; | ||
var _h = _vm.$createElement; | ||
var _c = _vm._self._c || _h; | ||
return _vm.dot ? _c('div', { | ||
staticClass: "hh-icon--symbol" | ||
}, [_c('svg', _vm._g({ | ||
style: _vm.styles | ||
}, _vm.$listeners), [_c('use', { | ||
attrs: { | ||
"xlink:href": "#" + _vm.iconName | ||
} | ||
})]), _vm._v(" "), _c('span', { | ||
staticClass: "icon-dot", | ||
style: _vm.dotStyles | ||
}, [_vm._v(_vm._s(_vm.badgeText))])]) : _c('svg', _vm._g({ | ||
style: _vm.styles | ||
}, _vm.$listeners), [_c('use', { | ||
attrs: { | ||
"xlink:href": "#" + _vm.iconName | ||
} | ||
})]); | ||
}; | ||
var __vue_staticRenderFns__ = []; | ||
export default { | ||
render: __vue_render__, | ||
staticRenderFns: __vue_staticRenderFns__, | ||
name: 'IconSymbol', | ||
props: { | ||
name: { type: String, required: true }, | ||
size: { type: String || Number }, | ||
dot: { type: Boolean, default: false }, | ||
badge: { type: String || Number }, | ||
badgeMax: { type: Number } | ||
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}`; | ||
iconName: function iconName() { | ||
return "" + this.name; | ||
}, | ||
// 图标大小 | ||
iconSize() { | ||
iconSize: function iconSize() { | ||
if (this.size) { | ||
return typeof this.size === "number" ? this.size + "px" : this.size; | ||
return typeof this.size === 'number' ? this.size + 'px' : this.size; | ||
} else { | ||
return "16px"; | ||
return '16px'; | ||
} | ||
}, | ||
// 图标样式 | ||
styles() { | ||
const obj = { | ||
styles: function styles() { | ||
var obj = { | ||
width: this.iconSize, | ||
height: this.iconSize, | ||
fill: "currentColor", | ||
overflow: "hidden" | ||
fill: 'currentColor', | ||
overflow: 'hidden' | ||
}; | ||
if (this.size) { | ||
const currSize = typeof this.size === "number" ? this.size + "px" : this.size; | ||
var currSize = typeof this.size === 'number' ? this.size + 'px' : this.size; | ||
obj.width = currSize; | ||
@@ -40,84 +78,19 @@ obj.height = currSize; | ||
// 徽标样式 | ||
dotStyles() { | ||
const dotPosition = `${this.iconSize.replace("px", "") - 4}px`; | ||
dotStyles: function dotStyles() { | ||
var dotPosition = this.iconSize.replace('px', '') - 4 + "px"; | ||
return { | ||
bottom: `${dotPosition}`, | ||
left: `${dotPosition}`, | ||
padding: this.badge ? "2px 4px" : "4px" | ||
bottom: "" + dotPosition, | ||
left: "" + dotPosition, | ||
padding: this.badge ? '2px 4px' : '4px' | ||
}; | ||
}, | ||
// 徽标显示文名称 | ||
badgeText() { | ||
badgeText: function badgeText() { | ||
if (this.badge) { | ||
return this.badge > this.badgeMax ? `${this.badgeMax}+` : this.badge; | ||
return this.badge > this.badgeMax ? this.badgeMax + "+" : this.badge; | ||
} else { | ||
return ""; | ||
return ''; | ||
} | ||
} | ||
} | ||
}; | ||
import { createCommentVNode as _createCommentVNode, createElementVNode as _createElementVNode, toHandlers as _toHandlers, mergeProps as _mergeProps, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, normalizeStyle as _normalizeStyle, Fragment as _Fragment } from "vue"; | ||
const _hoisted_1 = { | ||
key: 0, | ||
class: "hh-icon--symbol" | ||
}; | ||
const _hoisted_2 = ["xlink:href"]; | ||
const _hoisted_3 = ["xlink:href"]; | ||
function __vue_render__(_ctx, _cache) { | ||
return _openBlock(), _createElementBlock( | ||
_Fragment, | ||
null, | ||
[ | ||
_createCommentVNode(" \u6709\u5FBD\u6807 "), | ||
_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(" \u65E0\u5FBD\u6807 "), | ||
(_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__.render = __vue_render__; | ||
var stdin_default = __vue_sfc__; | ||
export { | ||
stdin_default as default | ||
}; | ||
}; |
@@ -1,7 +0,14 @@ | ||
import HhIcon from "./components/Icon.js"; | ||
const installHhIcon = { | ||
install(app, options) { | ||
const { url = "", css = "", js = "" } = options; | ||
let linkUrl = ""; | ||
let scriptUrl = ""; | ||
import HhIcon from './index'; | ||
var installHhIcon = { | ||
install: function install(app, options) { | ||
var _options$url = options.url, | ||
url = _options$url === void 0 ? '' : _options$url, | ||
_options$css = options.css, | ||
css = _options$css === void 0 ? '' : _options$css, | ||
_options$js = options.js, | ||
js = _options$js === void 0 ? '' : _options$js; | ||
var linkUrl = ''; | ||
var scriptUrl = ''; | ||
// 加载单色图标和多色图标字体资源 | ||
if (url) { | ||
@@ -16,26 +23,27 @@ if (url.endsWith(".css")) { | ||
} else { | ||
if (css) | ||
linkUrl = css; | ||
if (js) | ||
scriptUrl = js; | ||
if (css) linkUrl = css; | ||
if (js) scriptUrl = js; | ||
} | ||
// 添加单色图标(font)字体资源链接 | ||
if (linkUrl) { | ||
const link = document.createElement("link"); | ||
link.setAttribute("rel", "stylesheet"); | ||
link.setAttribute("type", "text/css"); | ||
link.setAttribute("href", linkUrl); | ||
var link = document.createElement('link'); | ||
link.setAttribute('rel', 'stylesheet'); | ||
link.setAttribute('type', 'text/css'); | ||
link.setAttribute('href', linkUrl); | ||
document.head.appendChild(link); | ||
} | ||
// 添加多色图标(svg)字体资源链接 | ||
if (scriptUrl) { | ||
const script = document.createElement("script"); | ||
script.setAttribute("type", "text/javascript"); | ||
script.setAttribute("src", scriptUrl); | ||
var script = document.createElement('script'); | ||
script.setAttribute('type', 'text/javascript'); | ||
script.setAttribute('src', scriptUrl); | ||
document.head.appendChild(script); | ||
} | ||
app.component("HhIcon", HhIcon); | ||
// 全局注册 HhIcon 组件 | ||
app.component('HhIcon', HhIcon); | ||
} | ||
}; | ||
var stdin_default = installHhIcon; | ||
export { | ||
stdin_default as default | ||
}; | ||
export default installHhIcon; |
@@ -1,20 +0,20 @@ | ||
const version = "0.0.8"; | ||
function install(app) { | ||
const components = []; | ||
components.forEach((item) => { | ||
import Icon from './icon'; | ||
var version = '0.0.9'; | ||
function install(Vue) { | ||
var components = [Icon]; | ||
components.forEach(function (item) { | ||
if (item.install) { | ||
app.use(item); | ||
Vue.use(item); | ||
} else if (item.name) { | ||
app.component(item.name, item); | ||
Vue.component(item.name, item); | ||
} | ||
}); | ||
} | ||
var stdin_default = { | ||
install, | ||
version | ||
}; | ||
export { | ||
stdin_default as default, | ||
install, | ||
version | ||
}; | ||
if (typeof window !== 'undefined' && window.Vue) { | ||
install(window.Vue); | ||
} | ||
export { install, version, Icon }; | ||
export default { | ||
install: install, | ||
version: version | ||
}; |
@@ -1,51 +0,62 @@ | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
require("./IconFont-sfc.css"); | ||
var __vue_render__ = function __vue_render__() { | ||
var _vm = this; | ||
var _h = _vm.$createElement; | ||
var _c = _vm._self._c || _h; | ||
return _c('i', _vm._g(_vm._b({ | ||
class: _vm.iconName, | ||
style: _vm.styles | ||
}, 'i', _vm.$attrs, false), _vm.$listeners), [_vm.dot ? [_c('span', { | ||
staticClass: "icon-dot", | ||
style: _vm.dotStyles | ||
}, [_vm._v(_vm._s(_vm.badgeText))])] : _vm._e()], 2); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
var stdin_exports = {}; | ||
__export(stdin_exports, { | ||
default: () => stdin_default | ||
}); | ||
module.exports = __toCommonJS(stdin_exports); | ||
var import_IconFont_sfc = require("./IconFont-sfc.css"); | ||
var import_vue = require("vue"); | ||
const __vue_sfc__ = { | ||
name: "IconFont", | ||
var __vue_staticRenderFns__ = []; | ||
var _default = exports.default = { | ||
render: __vue_render__, | ||
staticRenderFns: __vue_staticRenderFns__, | ||
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: "" } | ||
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}`; | ||
iconName: function iconName() { | ||
return "ds-iconfont iconfont " + this.name; | ||
}, | ||
// 图标大小 | ||
iconFontSize() { | ||
iconFontSize: function iconFontSize() { | ||
if (this.size) { | ||
return typeof this.size === "number" ? this.size + "px" : this.size; | ||
return typeof this.size === 'number' ? this.size + 'px' : this.size; | ||
} else { | ||
return "16px"; | ||
return '16px'; | ||
} | ||
}, | ||
// 图标样式 | ||
styles() { | ||
const obj = { | ||
styles: function styles() { | ||
var obj = { | ||
fontSize: this.iconFontSize | ||
@@ -59,45 +70,19 @@ }; | ||
// 徽标样式 | ||
dotStyles() { | ||
const dotPosition = `${this.iconFontSize.replace("px", "") - 4}px`; | ||
dotStyles: function dotStyles() { | ||
var dotPosition = this.iconFontSize.replace('px', '') - 4 + "px"; | ||
return { | ||
bottom: `${dotPosition}`, | ||
left: `${dotPosition}`, | ||
padding: this.badge ? "2px 4px" : "4px" | ||
bottom: "" + dotPosition, | ||
left: "" + dotPosition, | ||
padding: this.badge ? '2px 4px' : '4px' | ||
}; | ||
}, | ||
// 徽标显示文名称 | ||
badgeText() { | ||
badgeText: function badgeText() { | ||
if (this.badge) { | ||
return this.badge > this.badgeMax ? `${this.badgeMax}+` : this.badge; | ||
return this.badge > this.badgeMax ? this.badgeMax + "+" : this.badge; | ||
} else { | ||
return ""; | ||
return ''; | ||
} | ||
} | ||
} | ||
}; | ||
function __vue_render__(_ctx, _cache) { | ||
return (0, import_vue.openBlock)(), (0, import_vue.createElementBlock)( | ||
"i", | ||
(0, import_vue.mergeProps)({ | ||
class: _ctx.iconName, | ||
style: _ctx.styles | ||
}, _ctx.$attrs, (0, import_vue.toHandlers)(_ctx.$listeners, true)), | ||
[ | ||
_ctx.dot ? ((0, import_vue.openBlock)(), (0, import_vue.createElementBlock)( | ||
"span", | ||
{ | ||
key: 0, | ||
class: "icon-dot", | ||
style: (0, import_vue.normalizeStyle)(_ctx.dotStyles) | ||
}, | ||
(0, import_vue.toDisplayString)(_ctx.badgeText), | ||
5 | ||
/* TEXT, STYLE */ | ||
)) : (0, import_vue.createCommentVNode)("v-if", true) | ||
], | ||
16 | ||
/* FULL_PROPS */ | ||
); | ||
} | ||
__vue_sfc__.render = __vue_render__; | ||
var stdin_default = __vue_sfc__; | ||
}; |
@@ -1,57 +0,76 @@ | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
require("./IconSymbol-sfc.css"); | ||
var __vue_render__ = function __vue_render__() { | ||
var _vm = this; | ||
var _h = _vm.$createElement; | ||
var _c = _vm._self._c || _h; | ||
return _vm.dot ? _c('div', { | ||
staticClass: "hh-icon--symbol" | ||
}, [_c('svg', _vm._g({ | ||
style: _vm.styles | ||
}, _vm.$listeners), [_c('use', { | ||
attrs: { | ||
"xlink:href": "#" + _vm.iconName | ||
} | ||
})]), _vm._v(" "), _c('span', { | ||
staticClass: "icon-dot", | ||
style: _vm.dotStyles | ||
}, [_vm._v(_vm._s(_vm.badgeText))])]) : _c('svg', _vm._g({ | ||
style: _vm.styles | ||
}, _vm.$listeners), [_c('use', { | ||
attrs: { | ||
"xlink:href": "#" + _vm.iconName | ||
} | ||
})]); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
var stdin_exports = {}; | ||
__export(stdin_exports, { | ||
default: () => stdin_default | ||
}); | ||
module.exports = __toCommonJS(stdin_exports); | ||
var import_IconSymbol_sfc = require("./IconSymbol-sfc.css"); | ||
var import_vue = require("vue"); | ||
const __vue_sfc__ = { | ||
name: "IconSymbol", | ||
var __vue_staticRenderFns__ = []; | ||
var _default = exports.default = { | ||
render: __vue_render__, | ||
staticRenderFns: __vue_staticRenderFns__, | ||
name: 'IconSymbol', | ||
props: { | ||
name: { type: String, required: true }, | ||
size: { type: String || Number }, | ||
dot: { type: Boolean, default: false }, | ||
badge: { type: String || Number }, | ||
badgeMax: { type: Number } | ||
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}`; | ||
iconName: function iconName() { | ||
return "" + this.name; | ||
}, | ||
// 图标大小 | ||
iconSize() { | ||
iconSize: function iconSize() { | ||
if (this.size) { | ||
return typeof this.size === "number" ? this.size + "px" : this.size; | ||
return typeof this.size === 'number' ? this.size + 'px' : this.size; | ||
} else { | ||
return "16px"; | ||
return '16px'; | ||
} | ||
}, | ||
// 图标样式 | ||
styles() { | ||
const obj = { | ||
styles: function styles() { | ||
var obj = { | ||
width: this.iconSize, | ||
height: this.iconSize, | ||
fill: "currentColor", | ||
overflow: "hidden" | ||
fill: 'currentColor', | ||
overflow: 'hidden' | ||
}; | ||
if (this.size) { | ||
const currSize = typeof this.size === "number" ? this.size + "px" : this.size; | ||
var currSize = typeof this.size === 'number' ? this.size + 'px' : this.size; | ||
obj.width = currSize; | ||
@@ -63,80 +82,19 @@ obj.height = currSize; | ||
// 徽标样式 | ||
dotStyles() { | ||
const dotPosition = `${this.iconSize.replace("px", "") - 4}px`; | ||
dotStyles: function dotStyles() { | ||
var dotPosition = this.iconSize.replace('px', '') - 4 + "px"; | ||
return { | ||
bottom: `${dotPosition}`, | ||
left: `${dotPosition}`, | ||
padding: this.badge ? "2px 4px" : "4px" | ||
bottom: "" + dotPosition, | ||
left: "" + dotPosition, | ||
padding: this.badge ? '2px 4px' : '4px' | ||
}; | ||
}, | ||
// 徽标显示文名称 | ||
badgeText() { | ||
badgeText: function badgeText() { | ||
if (this.badge) { | ||
return this.badge > this.badgeMax ? `${this.badgeMax}+` : this.badge; | ||
return this.badge > this.badgeMax ? this.badgeMax + "+" : this.badge; | ||
} else { | ||
return ""; | ||
return ''; | ||
} | ||
} | ||
} | ||
}; | ||
const _hoisted_1 = { | ||
key: 0, | ||
class: "hh-icon--symbol" | ||
}; | ||
const _hoisted_2 = ["xlink:href"]; | ||
const _hoisted_3 = ["xlink:href"]; | ||
function __vue_render__(_ctx, _cache) { | ||
return (0, import_vue.openBlock)(), (0, import_vue.createElementBlock)( | ||
import_vue.Fragment, | ||
null, | ||
[ | ||
(0, import_vue.createCommentVNode)(" \u6709\u5FBD\u6807 "), | ||
_ctx.dot ? ((0, import_vue.openBlock)(), (0, import_vue.createElementBlock)("div", _hoisted_1, [ | ||
((0, import_vue.openBlock)(), (0, import_vue.createElementBlock)( | ||
"svg", | ||
(0, import_vue.mergeProps)({ style: _ctx.styles }, (0, import_vue.toHandlers)(_ctx.$listeners, true)), | ||
[ | ||
(0, import_vue.createElementVNode)("use", { | ||
"xlink:href": `#${_ctx.iconName}` | ||
}, null, 8, _hoisted_2) | ||
], | ||
16 | ||
/* FULL_PROPS */ | ||
)), | ||
(0, import_vue.createElementVNode)( | ||
"span", | ||
{ | ||
class: "icon-dot", | ||
style: (0, import_vue.normalizeStyle)(_ctx.dotStyles) | ||
}, | ||
(0, import_vue.toDisplayString)(_ctx.badgeText), | ||
5 | ||
/* TEXT, STYLE */ | ||
) | ||
])) : ((0, import_vue.openBlock)(), (0, import_vue.createElementBlock)( | ||
import_vue.Fragment, | ||
{ key: 1 }, | ||
[ | ||
(0, import_vue.createCommentVNode)(" \u65E0\u5FBD\u6807 "), | ||
((0, import_vue.openBlock)(), (0, import_vue.createElementBlock)( | ||
"svg", | ||
(0, import_vue.mergeProps)({ style: _ctx.styles }, (0, import_vue.toHandlers)(_ctx.$listeners, true)), | ||
[ | ||
(0, import_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__.render = __vue_render__; | ||
var stdin_default = __vue_sfc__; | ||
}; |
@@ -1,39 +0,19 @@ | ||
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; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
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, { | ||
default: () => stdin_default | ||
}); | ||
module.exports = __toCommonJS(stdin_exports); | ||
var import_Icon = __toESM(require("./components/Icon.js")); | ||
const installHhIcon = { | ||
install(app, options) { | ||
const { url = "", css = "", js = "" } = options; | ||
let linkUrl = ""; | ||
let scriptUrl = ""; | ||
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
var _index = _interopRequireDefault(require("./index")); | ||
var installHhIcon = { | ||
install: function install(app, options) { | ||
var _options$url = options.url, | ||
url = _options$url === void 0 ? '' : _options$url, | ||
_options$css = options.css, | ||
css = _options$css === void 0 ? '' : _options$css, | ||
_options$js = options.js, | ||
js = _options$js === void 0 ? '' : _options$js; | ||
var linkUrl = ''; | ||
var scriptUrl = ''; | ||
// 加载单色图标和多色图标字体资源 | ||
if (url) { | ||
@@ -48,23 +28,27 @@ if (url.endsWith(".css")) { | ||
} else { | ||
if (css) | ||
linkUrl = css; | ||
if (js) | ||
scriptUrl = js; | ||
if (css) linkUrl = css; | ||
if (js) scriptUrl = js; | ||
} | ||
// 添加单色图标(font)字体资源链接 | ||
if (linkUrl) { | ||
const link = document.createElement("link"); | ||
link.setAttribute("rel", "stylesheet"); | ||
link.setAttribute("type", "text/css"); | ||
link.setAttribute("href", linkUrl); | ||
var link = document.createElement('link'); | ||
link.setAttribute('rel', 'stylesheet'); | ||
link.setAttribute('type', 'text/css'); | ||
link.setAttribute('href', linkUrl); | ||
document.head.appendChild(link); | ||
} | ||
// 添加多色图标(svg)字体资源链接 | ||
if (scriptUrl) { | ||
const script = document.createElement("script"); | ||
script.setAttribute("type", "text/javascript"); | ||
script.setAttribute("src", scriptUrl); | ||
var script = document.createElement('script'); | ||
script.setAttribute('type', 'text/javascript'); | ||
script.setAttribute('src', scriptUrl); | ||
document.head.appendChild(script); | ||
} | ||
app.component("HhIcon", import_Icon.default); | ||
// 全局注册 HhIcon 组件 | ||
app.component('HhIcon', _index.default); | ||
} | ||
}; | ||
var stdin_default = installHhIcon; | ||
var _default = exports.default = installHhIcon; |
@@ -1,39 +0,27 @@ | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __export = (target, all) => { | ||
for (var name in all) | ||
__defProp(target, name, { get: all[name], enumerable: true }); | ||
}; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
var stdin_exports = {}; | ||
__export(stdin_exports, { | ||
default: () => stdin_default, | ||
install: () => install, | ||
version: () => version | ||
}); | ||
module.exports = __toCommonJS(stdin_exports); | ||
const version = "0.0.8"; | ||
function install(app) { | ||
const components = []; | ||
components.forEach((item) => { | ||
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
exports.__esModule = true; | ||
exports.default = void 0; | ||
exports.install = install; | ||
exports.version = void 0; | ||
var _icon = _interopRequireDefault(require("./icon")); | ||
exports.Icon = _icon.default; | ||
var version = exports.version = '0.0.9'; | ||
function install(Vue) { | ||
var components = [_icon.default]; | ||
components.forEach(function (item) { | ||
if (item.install) { | ||
app.use(item); | ||
Vue.use(item); | ||
} else if (item.name) { | ||
app.component(item.name, item); | ||
Vue.component(item.name, item); | ||
} | ||
}); | ||
} | ||
var stdin_default = { | ||
install, | ||
version | ||
}; | ||
if (typeof window !== 'undefined' && window.Vue) { | ||
install(window.Vue); | ||
} | ||
var _default = exports.default = { | ||
install: install, | ||
version: version | ||
}; |
{ | ||
"name": "@hhorg/icon", | ||
"version": "0.0.8", | ||
"description": "图标库", | ||
"main": "lib/hh-icon.js", | ||
"module": "es/index.js", | ||
"version": "0.0.9", | ||
"description": "", | ||
"main": "lib/vue2-demo.js", | ||
"style": "lib/index.css", | ||
"typings": "lib/index.d.ts", | ||
"files": [ | ||
@@ -15,24 +13,33 @@ "lib", | ||
"dev": "vant-cli dev", | ||
"test": "vant-cli test", | ||
"lint": "vant-cli lint", | ||
"test": "vant-cli test", | ||
"build": "vant-cli build", | ||
"build:site": "vant-cli build-site", | ||
"release": "vant-cli release --tag next", | ||
"release:site": "pnpm build:site && npx gh-pages -d site-dist", | ||
"test:watch": "vant-cli test --watch", | ||
"test:coverage": "open test/coverage/index.html" | ||
"release": "vant-cli release", | ||
"test:coverage": "open test/coverage/index.html", | ||
"build-site": "vant-cli build-site && npx gh-pages -d site-dist" | ||
}, | ||
"author": "", | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "nano-staged", | ||
"commit-msg": "vant-cli commit-lint" | ||
} | ||
}, | ||
"nano-staged": { | ||
"*.md": "prettier --write", | ||
"*.{ts,tsx,js,vue,less,scss}": "prettier --write", | ||
"*.{ts,tsx,js,vue}": "eslint --fix" | ||
"*.{ts,tsx,js,jsx,vue}": "eslint --fix" | ||
}, | ||
"peerDependencies": { | ||
"vue": "^2.6.11", | ||
"vue-template-compiler": "^2.6.11" | ||
}, | ||
"devDependencies": { | ||
"@vant/cli": "^6.0.0", | ||
"sass": "^1.49.7", | ||
"vue-demi": "^0.14.10" | ||
"@vant/cli": "^2.0.0", | ||
"vue": "^2.6.11", | ||
"vue-template-compiler": "^2.6.11" | ||
}, | ||
"eslintConfig": { | ||
"root": true | ||
"root": true, | ||
"extends": [ | ||
"@vant" | ||
] | ||
}, | ||
@@ -43,9 +50,5 @@ "prettier": { | ||
"browserslist": [ | ||
"Chrome >= 51", | ||
"iOS >= 10" | ||
], | ||
"publishConfig": { | ||
"access": "public", | ||
"registry": "https://registry.npmjs.org" | ||
} | ||
} | ||
"Android >= 4.0", | ||
"iOS >= 8" | ||
] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
48602
27
1275
2
1