Files
shawn 0de9b6e66e init: @ui-arch 私人组件库 monorepo
- core/table-core: Headless 表格内核(排序/筛选/分页/选择插件 + 冒烟 9 项)
- core/frame: signal/computed/effect + hyperscript 微框架(零依赖)
- skin/ui: 16 个 DOM 组件(含自绘 select、滑动指示条 tabs、行选择 dataTable、form 表单校验)
- design/tokens: --ua-* 设计令牌(light/dark)
- tools/cli: ua 命令行(index/list/info/docs/style/mcp)+ MCP 注册表服务
- apps: demo 演示站(esbuild 单文件)+ docs 双轨文档(人类版 + llms-full.txt)
2026-10-23 14:58:53 +08:00

42 lines
2.1 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"name": "@ui-arch/frame",
"type": "headless-core",
"description": "自研微框架:signal / computed / effect 信号系统 + hyperscript(h)DOM 层。函数值属性与函数型子节点自动响应式;renderList 做列表整体替换;零依赖、无虚拟 DOM。",
"tags": [
"framework",
"signal",
"reactive",
"hyperscript"
],
"api": {
"entry": "src/index.ts",
"exports": [
"signal(initial) -> Signal<T>:无参读值并收集依赖,传参写值并触发订阅",
"effect(fn):立即执行并追踪依赖,信号变化自动重跑",
"computed(fn):由信号派生的只读计算值",
"h(tag, props, ...children):hyperscript;on* 绑事件,函数值属性/子节点自动响应式",
"renderList(el, fn):信号变化时整体替换容器子节点",
"mount(target, view):挂载视图"
],
"keyTypes": [
"Signal"
]
},
"usage": "const count = signal(0); mount('#app', () => h('button', { onClick: () => count(count() + 1) }, () => `count = ${count()}`))",
"conventions": [
"组件 = 返回 DOM 节点的普通函数,不做类组件与生命周期抽象",
"跨系统状态(如 table-core)用桥接信号:subscribe 里递增 version 信号"
],
"docs": {
"intro": "零依赖微框架:组件 = 返回 DOM 的普通函数。signal/effect/computed 管状态,h() 管 DOM,无虚拟 DOM 无生命周期抽象。",
"steps": [
"引入:import { signal, computed, effect, h, mount } from '@ui-arch/frame'",
"声明状态:const count = signal(0);无参调用读值 count(),传参写值 count(1)",
"渲染视图:mount('#app', () => h('div', null, () => `count = ${count()}`))——函数型子节点即响应式文本",
"绑定事件:props 里 on 开头且值为函数的键(onClick 等)自动 addEventListener",
"派生数据:const double = computed(() => count() * 2),视图里直接调用 double(),依赖自动追踪",
"列表渲染:renderList(tbody, () => rows.map(r => h('tr', null, r.name))),信号变化整体替换子节点"
]
}
}