@aglyn/shared-data-mdi

中文文档
1.18.0发布于 2026/11/07Apache-2.0TypeScriptES Module构建来源已验证近 30 天下载 2万

Material Design Icons as data. Every icon is a plain object carrying its id, display name, SVG path, aliases and tags, plus a lazily loaded catalog for icon pickers and search. Aglyn uses it wherever an icon is chosen by id and stored as data; it is usabl

原始使用文档
文档目录5 节
  1. Install
  2. What's in it
  3. Usage
  4. How it fits
  5. License

@aglyn/shared-data-mdi

Material Design Icons as data. Every icon is a plain object carrying its id, display name, SVG path, aliases and tags, plus a lazily loaded catalog for icon pickers and search. Aglyn uses it wherever an icon is chosen by id and stored as data; it is usable in any project that wants MDI paths without a component library.

Published to npm from the Aglyn monorepo. Versions follow semantic versioning.

Install

npm install @aglyn/shared-data-mdi

No peer dependencies, and no React.

What's in it

  • The generated icon set. One named export per icon, in camel case with an mdi prefix (mdiAbacus, mdiAccessPoint). Each is an Icon: { id, name, path, as, tags }, where path is the SVG path data for a 24 by 24 viewBox. The set is generated from Material Design Icons 6.5.95 and ships in the package under generated/6.5.95/.
  • The catalog. loadMdiIcons() dynamically imports the whole set, fills the MdiIcons map (Map<IconId, Icon>) on first call and caches the promise. Nothing loads the catalog at import time, because it is large; call it only on a surface that needs every icon.
  • Lookups against the loaded catalog. getMdiIconPath(id) returns the path, or undefined when the id is unknown or the catalog is not loaded. getMdiIconFromId(idOrIds) returns the icon, substituting DEFAULT_ICON on a miss. getMdiAllIcons() returns the map.
  • Helpers. convertIdToModuleName('access-point') gives 'mdiAccessPoint'. iconPathPropName('iconId') gives 'iconPath', the companion prop name for storing a resolved path beside an id. handleIconNotFound and DEFAULT_ICON are the fallback pieces.
  • Types. Icon, Icons, IconId, IconName, IconPath, IconTag, IconTags, IconAliases.

Usage

A named icon, tree-shaken to the one object:

import { mdiAbacus } from '@aglyn/shared-data-mdi'

mdiAbacus.path // 'M5 5H7V11H5V5M10 5H8V11H10V5…'

The whole catalog, for a picker:

import { getMdiIconPath, loadMdiIcons } from '@aglyn/shared-data-mdi'

const icons = await loadMdiIcons() // Map<IconId, Icon>
const path = getMdiIconPath('abacus')

The generated files are build output. Do not edit them by hand.

How it fits

A shared data package. It depends only on @aglyn/shared-util-tools. @aglyn/shared-data-enums names its icon constants from it, and @aglyn/shared-ui-jsx re-exports it beside the MdiIcon component that renders a path. Shared packages are generic: they import only other shared packages and hold no plugin's domain.

License

Apache-2.0. Source: https://github.com/aglyn/aglyn/tree/main/libs/shared/data/mdi

The icon paths come from the Material Design Icons project (https://github.com/Templarian/MaterialDesign), which publishes them under its own license.

版本与发布记录

@aglyn/shared-data-mdi 共发布 160 个版本,首次发布于 2026/09/21;过去 12 个月发布了 160 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.18.0latest2026/11/07今天
1.17.02026/11/07今天
1.16.02026/11/07今天
1.15.22026/11/061 天前
1.15.12026/11/061 天前
1.15.02026/11/061 天前

其他发布通道:beta → 1.0.0-beta.296。

关于 @aglyn/shared-data-mdi 的常见问题

@aglyn/shared-data-mdi 是什么?

Material Design Icons as data. Every icon is a plain object carrying its id, display name, SVG path, aliases and tags, plus a lazily loaded catalog for icon pickers and search. Aglyn uses it wherever an icon is chosen by id and stored as data; it is usabl

如何安装 @aglyn/shared-data-mdi?

在项目目录运行 npm install @aglyn/shared-data-mdi,或使用 pnpm add / yarn add / bun add。

@aglyn/shared-data-mdi 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@aglyn/shared-data-mdi 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@aglyn/shared-data-mdi 可以商用吗?

@aglyn/shared-data-mdi 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@aglyn/shared-data-mdi 的下载量有多少?

根据 npm 官方下载统计,@aglyn/shared-data-mdi 在 2026/10/05 – 2026/11/03 这 30 天内被下载 20,412 次,日均约 680 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@aglyn/shared-data-mdi 还在维护吗?

最新版本 1.18.0 发布于 2026/11/07(今天);至今共发布 160 个版本,其中过去 12 个月发布了 160 个;首次发布于 2026/09/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。