首页Home / 内容Content / Materin UI
Materin UI v0.8.0
一套令牌与命名契约,加一个 Vue 3 组件库。颜色跟随宿主主题,形状与间距固定;每个组件有唯一的名字,改哪儿、在哪儿改,按名可查。
One token sheet and one naming contract, plus a Vue 3 component library. Colours follow the host theme, shape and spacing stay fixed, and every component has a single name — so what to change, and where, is findable by name.
组件演示与令牌实时取值:打开文档与风格展示站点 · 规范正文:设计规范 Live component demos and token values: open the docs and style showcase · Full spec: UI spec
概览
Materin 的内容分散在若干处:Obsidian 插件、组织站点,以及一套 Vue 3 组件库。如果各写各的样式,改一次颜色要改四个仓库。Materin UI 把这些收在一处——令牌管取值,契约管命名,插件与站点只消费,不各自发挥。
四件东西
- 令牌表(
tokens/materin-ui.css)—— 要改风格只改这一个文件。取值规则是「先宿主、后品牌」:宿主主题(Obsidian 的--interactive-accent、--background-primary、--radius-s…)有该变量就用宿主的,没有才用品牌回落值。用户换主题,界面自动跟着变; - 命名契约 ——
materin-<scope>-<component>[__part][--variant]。一个组件一个名字,不允许别名。这样人和工具都能按名定位到组件与它的样式; - Vue 3 组件库(
@materin-tech/materin-ui)—— 4 个组件,全部只引用令牌,零硬编码颜色; - 校验脚本(
tools/check-components.py)—— 核对名字、清单、样式、令牌四者是否一致:有没有用了没登记的类名、有没有引用了不存在的令牌、有没有绕过令牌写死色值。契约不靠自觉,靠脚本。
组件(当前 93 个)
- 布局 9 个 —— Container / Header / Aside / Main / Footer(侧栏一出现容器自动转横向)、Row / Col(24 栅格,span / offset / order + xs~xl 断点)、Space、Divider(横竖、三种线型、文字位置);
- 基础与展示 8 个 —— Link(七种语义色)、Text(语义色 / 三档字号 / 单行与多行省略)、Title(1–6 级)、Badge(数字 / 小红点 / 超出显示 99+)、Avatar(图片 / 文字 / 默认剪影,圆或方)、Skeleton 与 SkeletonItem(扫光骨架屏)、Empty(空状态);
- 最终批 38 个(v0.8.0 完成) —— 数据层的树、表格、日历、二维码、水印、无限滚动与树选择;导航层的菜单、标签页、面包屑、步骤条、下拉、锚点、回到顶部、固钉与页头;表单收尾的日期、时间、上传、穿梭框、级联、颜色、自动补全、提及与命令式弹窗;外加分栏、按钮组、滚动条、轮播、配置注入、图标,以及本系列独有的复制按钮、HTTP 方法徽标、状态点、毛玻璃面板和页面骨架;
- 数据展示 11 个 —— Progress(线性与环形、不确定进度)、Statistic(千分位、前后缀)、Descriptions、Result、Collapse(多开或手风琴)、Timeline(末节点自动收线)、Pagination(省略号页码、受控)、Segmented、Image(加载扫光、失败回落、懒加载);
- 反馈与浮层 10 个 —— Alert、Loading(局部与全屏遮罩)、Tooltip / Popover / Popconfirm(一套浮层机制,四个方向、点外部关闭)、Dialog(遮罩、居中/全屏/玻璃、ESC 关闭、打开锁滚动)、Drawer(四边滑出)、MiMessage 与 MiNotification(一行调用的全局消息与通知)、Tour(逐步骤高亮引导);
- 表单与选择 13 个 —— Form / FormItem(自研轻量校验:必填、类型、长度、区间、正则、自定义,可按失焦或变更触发;
validate/validateField/resetFields/clearValidate齐全)、InputNumber、Select + Option + OptionGroup(单选多选、键盘导航、点外部关闭、分组标题)、Checkbox 与 CheckboxGroup、Radio 与 RadioGroup、Switch、Slider(含双滑块区间)、Rate; - 展示 4 个 —— Input(
materin-ui-field,在表单里会跟着表单项切尺寸 / 禁用 / 错误态)、Button、Tag、Card(default / glass / hero,不支持backdrop-filter时自动降级为不透明面); - 路线图 97 项全部完成 —— 对标 Element Plus 的 92 项已全覆盖,另加本系列需要的 5 件; —— 目标是对标 Element Plus 全覆盖(92 项),另加本系列需要的 5 件:复制按钮、HTTP 方法徽标、状态点、毛玻璃面板、页面骨架。清单在
registry/roadmap.json,已完成与待做都标着。
安装与使用
npm install @materin-tech/materin-ui
import { createApp } from 'vue'
import MaterinUI from '@materin-tech/materin-ui'
import '@materin-tech/materin-ui/styles' // 组件样式
import '@materin-tech/materin-ui/tokens' // 令牌表
createApp(App).use(MaterinUI).mount('#app')
不用 Vue 的地方(例如 Obsidian 插件)只取令牌表:
<link rel="stylesheet" href="https://materin-tech.github.io/materin-ui/tokens/materin-ui.css">
命名契约的 scope
名字的第二段说明它属于哪儿,目前六档:ui(共享组件)、site(组织站点)、docs(文档站)、office / view / ctx(三个插件)。状态一律 is-* 或 ARIA 属性,布局工具用 materin-u-*。
文档与本地开发
组件演示、令牌实时取值与安装方式都在 文档与风格展示站点。仓库里:
npm install
npm run docs:dev # 文档站开发预览
npm run build # 打包组件库 + 生成类型声明
npm run docs:build # 构建文档站到 docs-dist/
python3 tools/check-components.py --repo . # 契约检查
文档站由 CI 构建发布,契约检查是发布门禁:名字、清单、样式、令牌不一致就不发布。
许可
MIT。
内容来源
本页依据仓库 materin-tech/materin-ui 的 README、CHANGELOG 与路线图整理(版本 0.8.0)。以源码仓库为准。
Overview
Materin's work lives in several places: Obsidian plugins, the organization site, and a Vue 3 component library. If each kept its own styles, changing one colour would mean editing four repositories. Materin UI collects that in one place — tokens decide values, the contract decides names — and the plugins and the site only consume it.
Four pieces
- Token sheet (
tokens/materin-ui.css) — the single file to edit when the look changes. Host first, brand second: if the host theme (Obsidian's--interactive-accent,--background-primary,--radius-s…) defines the variable it wins, otherwise the brand fallback applies. Change the theme and the interface follows; - Naming contract —
materin-<scope>-<component>[__part][--variant]. One name per component, no aliases, so both people and tools can locate a component and its styles by name; - Vue 3 component library (
@materin-tech/materin-ui) — four components, every one of them referencing tokens only, with no hard-coded colours; - Checker (
tools/check-components.py) — verifies that names, registry, styles and tokens agree: class names not in the registry, references to tokens that do not exist, colours written past the tokens. The contract is enforced by a script, not by good intentions.
Components (93 today)
- Nine layout pieces — Container / Header / Aside / Main / Footer (the container turns horizontal as soon as an aside appears), Row / Col (24-column grid with span / offset / order and xs–xl breakpoints), Space, Divider (horizontal or vertical, three line styles, text position);
- Eight foundation and display pieces — Link (seven semantic colours), Text (semantic colours, three sizes, single- and multi-line truncation), Title (levels 1–6), Badge (numbers, status dot, 99+ over the max), Avatar (image, text or default silhouette; circle or square), Skeleton and SkeletonItem (sweeping placeholders), Empty;
- A final batch of 38 (completing v0.8.0) — tree, table, calendar, QR code, tamper-proof watermark, infinite scroll and tree select; menu, tabs, breadcrumb, steps, dropdown, anchor, back-to-top, affix and page header; date, time, upload, transfer, cascader, colour, autocomplete, mention and a command message box; plus splitter, button group, scrollbar, carousel, config provider, icons, and five pieces unique to this series: copy, HTTP method badge, status dot, glass panel and page shell;
- Eleven data display pieces — Progress (line or ring, indeterminate), Statistic (grouping, prefix and suffix), Descriptions, Result, Collapse (multiple or accordion), Timeline (the last node drops its line automatically), Pagination (ellipsis pagers, works controlled), Segmented, and Image (loading shimmer, error fallback, lazy loading);
- Ten feedback and overlay pieces — Alert, Loading (local or fullscreen mask), Tooltip / Popover / Popconfirm (one popper mechanism: four placements, closes on outside click), Dialog (overlay, centred, fullscreen or glass, closes on Escape, locks scrolling), Drawer (slides in from any side), MiMessage and MiNotification (one-line global messages and notices) and Tour (step-by-step highlighting);
- Thirteen form and choice pieces — Form / FormItem (a small self-contained validator: required, type, length, range, pattern, custom, triggered on blur or change, with
validate/validateField/resetFields/clearValidate), InputNumber, Select + Option + OptionGroup (single or multiple, keyboard navigation, closes on outside click, grouped options), Checkbox and CheckboxGroup, Radio and RadioGroup, Switch, Slider (including a two-handle range) and Rate; - Four display pieces — Input (
materin-ui-field, which inherits size, disabled and error state from its form item), Button, Tag, Card (default / glass / hero, falling back to an opaque surface withoutbackdrop-filter); - The roadmap is complete: all 97 items — full Element Plus coverage (92) plus the five this series needs; — the target is full Element Plus coverage (92 items) plus five components this series needs: a copy button, an HTTP method badge, a status dot, a glass panel and a page shell. The list lives in
registry/roadmap.json, done and pending both marked.
Install and use
npm install @materin-tech/materin-ui
import { createApp } from 'vue'
import MaterinUI from '@materin-tech/materin-ui'
import '@materin-tech/materin-ui/styles' // component styles
import '@materin-tech/materin-ui/tokens' // token sheet
createApp(App).use(MaterinUI).mount('#app')
Where there is no Vue — the Obsidian plugins, for instance — take the token sheet alone:
<link rel="stylesheet" href="https://materin-tech.github.io/materin-ui/tokens/materin-ui.css">
Scopes in the contract
The second segment says where a name belongs; there are six: ui (shared components), site (the organization site), docs (the docs site), and office / view / ctx (the three plugins). States are is-* or ARIA attributes; layout utilities use materin-u-*.
Docs and local development
Component demos, live token values and installation are on the docs and style showcase site. In the repository:
npm install
npm run docs:dev # docs dev server
npm run build # build the library + type declarations
npm run docs:build # build the docs site into docs-dist/
python3 tools/check-components.py --repo . # naming contract check
The docs site is built in CI, and the contract check gates the release: if names, registry, styles and tokens disagree, nothing is published.
License
MIT.
Source
This page is based on the README, CHANGELOG and roadmap of materin-tech/materin-ui (version 0.8.0). The source repository is authoritative.