{"versions":{"2.0.0-release.1":{"name":"@metric/icons","version":"2.0.0-release.1","private":false,"main":"index.js","scripts":{"dev":"vite","serve":"vite preview","gen":"node ./gen.js","icons":"npm run gen","preview":"svgicon-viewer ./svgs/ ./metas.json","build:preview":"svgicon-viewer ./svgs/ ./metas.json -o ./dist/","release":"npm run icons && npm version patch && npm publish && git push","release2":"npm run icons  && npm publish","build":"npm run icons","postinstall":"npm run gen"},"files":["data","entry","README.md","package.json","index.js","index.css","gen.js","gen-entry.js"],"dependencies":{"@yzfe/svgicon":"^1.0.1","@yzfe/svgicon-viewer":"^1.0.2","@yzfe/vue-svgicon":"^4.0.2"},"devDependencies":{"@vitejs/plugin-legacy":"^2.0.0","@vitejs/plugin-vue":"^4.5.2","@vitejs/plugin-vue2":"^1.1.2","@vue/compiler-sfc":"^3.0.5","@yzfe/svgicon-gen":"^1.0.2","vite":"^3.0.2","vue":"2.7.14"},"_id":"@metric/icons@2.0.0-release.1","readmeFilename":"README.md","gitHead":"72e6f869df9dd487187b023e6332021c12b1f6e6","description":"指标图标库","_nodeVersion":"20.19.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-fMgKSG8fU6Yzm6rQcG8IsvLx051TGW9sNQOmgDzSFk5EjQS3HXrSn4XSeKWhqqiRuyaTQ7u6T/iis7Ra572fqw==","shasum":"e1f776464fcb661a262ff22b0da883f127c561f3","tarball":"http://123.232.10.234:8212/nexus/content/groups/npm-public/@metric/icons/-/icons-2.0.0-release.1.tgz"},"contributors":[]}},"dist-tags":{"latest":"2.0.0-release.1"},"name":"@metric/icons","time":{"modified":"2026-05-15T09:54:30.086Z","created":"2026-05-15T09:54:30.086Z","2.0.0-release.1":"2026-05-15T09:54:30.086Z"},"readme":"# @metric/icons\r\n\r\n指标图标库\r\n\r\n- 开箱即用，无需配置`webpack loader`\r\n- 按需加载，不重复打包 \r\n- 支持单色和多色图标 \r\n- 多项目共享图标库，支持无限扩展 \r\n- 基于[svgicon](https://mmf-fe.github.io/svgicon/)封装\r\n\r\n![](https://pic.imgdb.cn/item/65a48d1f871b83018a2ee344.png)\r\n\r\n## 安装\r\n\r\n- 项目安装图标库\r\n\r\n```sh\r\nnpm install @metric/icons -S\r\n# or\r\nyarn add @metric/icons -S\r\n```\r\n\r\n- `@metric/icons`：图标数据`json`格式\r\n\r\n## 项目配置\r\n\r\nwebpack 配置\r\n\r\n```js\r\nmodule.exports = {\r\n  //...\r\n  externals: [\r\n    (context, request, callback) => {\r\n      if (/^@metric\\/icons($|\\/)/.test(request)) {\r\n        return callback(null, `commonjs ${request}`);\r\n      }\r\n      callback();\r\n    }\r\n}\r\n\r\nrollup 配置\r\n\r\nexport default {\r\n  //...\r\n  external: [\r\n    /^@metric\\/icons($|\\/)/,\r\n  ],\r\n}\r\n```\r\n\r\n## 使用\r\n\r\n1. 注册全局组件\r\n\r\n```js\r\n<template>\r\n  <h-icon data={require('@metric/icons/data/add.json')} />\r\n</template>\r\nimport HussarIconPlugin from '@metric/icons'\r\nVue.use(HussarIconPlugin)\r\n```\r\n\r\n2. 引用组件\r\n\r\n```js\r\nimport { HIcon } from '@metric/icons'\r\n\r\n<script>\r\nexport default defineComponent({\r\n  {\r\n    render(h) {\r\n      return <HIcon data={require('@metric/icons/data/add.json')} />\r\n    }\r\n  }\r\n})\r\n</script>\r\n\r\n```\r\n\r\n#  `HIcon` \r\n\r\n> [DEMO查看](https://mmf-fe.github.io/svgicon/guide/component.html)\r\n\r\n| 字段     | 类型           | 描述                                                |\r\n| -------- | -------------- |---------------------------------------------------|\r\n| data     | Object         | 组件数据,在目录下找`@metric/icons/data`               |\r\n| width    | String /Number | 宽（px），默认16px                                      |\r\n| height   | String/Number  | 高（px），默认16px                                      |\r\n| color    | String         | 有效的颜色单位                                           |\r\n| scale    | String/Number  | 缩放比例                                              |\r\n| original | Boolean        | (默认false)是否原图，true则color失效                        |\r\n| dir      | String         | 方向`up/down/lefe/right`                            |\r\n| fill     | Boolean        | 是否只采用fill，忽略stroke(默认true，为false是采用stroke,忽略fill) |\r\n\r\n```html\r\n<!-- 使用data同步加载图标 -->\r\n<h-icon :data=\"require('@metric/icons/data/add.json')\"  \r\n  width=\"36\"\r\n  height=\"36\"\r\n  ></-icon>  \r\n```\r\n\r\n# 添加图标\r\n\r\n- 执行`npm run preview`，打开命令行输出的预览页面地址，如图标已存在则复用，不得重复添加\r\n- 若图标不存在，将本项目克隆进工程项目中跑源码，将图标 svg 文件复制到`svgs`目录下，文件命名用小写单词\r\n- 执行`npm run icons`，进行 icon json 数据生成，然后在代码中使用，确保显示正常\r\n- 如需根据不同类型加载不同图标，可在`entry`目录下添加相应的js\r\n- 在`metas.json`配置对应的中文名称，方便他人搜索\r\n- 检查无误后，执行`npm run release`发布，已发布的图标不允许变更（删除、修改名称等）\r\n  - 若执行`npm run release`有报错，需查看具体报错原因，解决后应分别执行后续对应的子命令，子命令含义见下表\r\n  - 若报错 ERR! code E401 Unable to authenticate，需要登录/注册 npm 仓库账号后再发布，或请他人代发布\r\n\r\n| 命令              | 说明            |\r\n| ----------------- | --------------- |\r\n| npm run icons     | 生成 json 文件  |\r\n| npm version patch | 增加版本号      |\r\n| npm publish       | 发布到 npm 仓库 |\r\n| git push          | 推送代码        |","users":{}}