快速开始Get started
三步之内把设计系统接进项目:拿资产 → 引样式 → 用组件。所有资产都是普通文件,没有构建插件。Three steps to adopt: grab the assets, link the CSS, use the components. Everything is plain files — no build plugin.
1安装Install
# A. 直接复制(推荐起步):拿 css/ + fonts/ + 需要的组件
git clone https://github.com/YimoLab/authnexus-design
cp -r authnexus-design/css authnexus-design/fonts ./vendor/authnexus-design/
# B. 作为依赖安装(未发布 npm,走 git)
npm i github:YimoLab/authnexus-design2引入样式与字体Link CSS & fonts
只需 css/index.css 一个入口(内部按依赖顺序引入七件套);字体已自托管,无外链请求。A single entry: css/index.css (it imports the seven files in dependency order). Fonts are self-hosted — no external requests.
<!-- 方式一:单入口 CSS(顺序已由 index.css 保证) -->
<link rel="stylesheet" href="./vendor/authnexus-design/fonts/fonts.css" />
<link rel="stylesheet" href="./vendor/authnexus-design/css/index.css" />
<!-- 方式二:JS 引入 -->
import '@yimolab/authnexus-design/css'<!-- index.html:首屏前预置主题(避免闪烁) -->
<script>
(function () {
var t = localStorage.getItem('authnexus.theme')
if (t !== 'dark' && t !== 'light') t = 'light'
document.documentElement.setAttribute('data-theme', t)
})()
</script>
<!-- 切换:改 data-theme 即可(配合 lib/theme.ts 的涟漪过渡) -->
<button onclick="document.documentElement.setAttribute('data-theme', 'dark')">深色</button>3使用组件Use components
Vue 3 项目直接复制 vue/ 源码;React 项目按 交互规范 实现(class 与行为一致,审计即验收)。For Vue 3, copy the vue/ sources. For React, implement against the behavior spec — same classes, same behavior, verified by the audits.
// Vue 3:按需引入组件源码(文件即组件,无构建魔法)
import SelectMenu from './vendor/authnexus-design/vue/ui/SelectMenu.vue'
import { toast } from './vendor/authnexus-design/vue/overlay/toast'
import { openModal, confirmDialog } from './vendor/authnexus-design/vue/overlay/manager'
// 逻辑模块
import { usePager } from './vendor/authnexus-design/vue/lib/usePager'
import { toggleTheme } from './vendor/authnexus-design/vue/lib/theme'命名空间与铁律Namespace & rules
anx-* | 资产类一律带前缀(.anx-btn / .anx-field)——命名空间隔离,避免污染宿主All asset classes carry the prefix (.anx-btn, .anx-field) — namespace isolation, no host pollution |
is-* / has-* | 状态类不加前缀(is-open / has-error)——与资产类区分,便于 JS 勾选State classes stay unprefixed (is-open, has-error) — distinct from assets, easy to toggle |
--* | CSS 自定义属性不用前缀(--acid / --r)——换品牌只改 brand.cssCustom properties stay unprefixed (--acid, --r) — rebrand via brand.css only |
od-* | OpenDesign 第三方层,仅原型遗留;新代码不要使用Legacy OpenDesign layer from the prototype — do not use in new code |
- 禁用原生
<select>——弹出层由系统绘制,样式不可控;用SelectMenu。Never use native<select>— the popup is OS-drawn; useSelectMenu. - 浮层必须包在
.anx-overlay-layer内——承载层提供 z-index 与隔离。Overlays must live inside.anx-overlay-layer— the carrier owns z-index and isolation. - Toast 必须带
.anx-toast__icon——三种 tone 的区分完全在图标颜色上。Toasts must include.anx-toast__icon— tone is conveyed by icon color.
把铁律变成检查Turn rules into checks
写完代码跑一遍 lint;改完样式跑一遍审计。这两条命令是质量阀门的全部秘密。Run lint after writing code; run the audits after touching styles. These two commands are the whole quality gate.
# 铁律可执行检查(禁原生 select / 浮层承载层 / 裸色值…)
node tools/lint-usage.mjs src/
# 黑盒审计(52 项浏览器断言,gallery 起点)
node audit/audit-gallery.mjsAI 专区:让模型也用同一份契约 →For AI: let models use the same contracts →