@yoyaflow/yoya-ui 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +198 -0
- package/README.zh-CN.md +199 -0
- package/dist/echarts.min.js +45 -0
- package/dist/yoya-ui.umd.js +35 -0
- package/dist/yoya.core.js +1674 -0
- package/dist/yoya.echart.js +636 -0
- package/dist/yoya.ssr.js +491 -0
- package/dist/yoya.ui.css +2010 -0
- package/dist/yoya.ui.js +11899 -0
- package/package.json +94 -0
- package/types/actions.d.ts +166 -0
- package/types/async.d.ts +58 -0
- package/types/chart.d.ts +40 -0
- package/types/core.d.ts +495 -0
- package/types/css.d.ts +5 -0
- package/types/data-display.d.ts +518 -0
- package/types/effects.d.ts +40 -0
- package/types/feedback.d.ts +119 -0
- package/types/form.d.ts +486 -0
- package/types/html.d.ts +288 -0
- package/types/i18n.d.ts +56 -0
- package/types/index.d.ts +4 -0
- package/types/layout.d.ts +429 -0
- package/types/navigation.d.ts +275 -0
- package/types/router.d.ts +123 -0
- package/types/ssr.d.ts +81 -0
- package/types/svg.d.ts +158 -0
- package/types/theme.d.ts +40 -0
- package/types/yoya.core.d.ts +7 -0
- package/types/yoya.echart.d.ts +4 -0
- package/types/yoya.ssr.d.ts +4 -0
- package/types/yoya.ui.d.ts +19 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 zhanglj
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# yoya-ui
|
|
2
|
+
|
|
3
|
+
> **English** | [简体中文](./README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
> Browser-native UI library with declarative HTML authoring — no virtual DOM, no JSX/SFC, no build chain.
|
|
6
|
+
|
|
7
|
+
yoya-ui builds views directly on the real DOM: declarative HTML authoring, a component library, router, i18n, theming and state out of the box, with server-side rendering (SSR) and pure client rendering switchable from the same code.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Low-barrier declarative authoring**: describe UI with native elements; only HTML and plain JS are required, with no framework-specific concepts
|
|
12
|
+
- **Backend/full-stack friendly**: built for backend and full-stack developers to quickly build admin and management interfaces without frontend framework experience
|
|
13
|
+
- **Microservice-cohesive delivery**: ship UI together with the backend service, suitable for atomic per-service deployment
|
|
14
|
+
- **AI-friendly**: declarative structure plus zero build chain means AI-generated component code runs directly
|
|
15
|
+
- **Ready-to-use component library**: forms, navigation, feedback, data display, layout, charts and more for high-frequency scenarios
|
|
16
|
+
- **Built-in router / i18n / theme / state**: everything a SPA needs, no extra selection required
|
|
17
|
+
- **Server-side rendering**: one codebase, two modes — full-site SSR and island-style client enhancement both work
|
|
18
|
+
- **Small core, zero dependencies, easy to extend**: follows standard component patterns; third-party components compose seamlessly with built-ins; import per module fits any project
|
|
19
|
+
- **Maintenance-friendly**: the core stays stable, so long-lived projects don't fear version churn or rewrites
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install @yoyaflow/yoya-ui
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
import { div, vButton, toast } from '@yoyaflow/yoya-ui';
|
|
31
|
+
import '@yoyaflow/yoya-ui/ui.css';
|
|
32
|
+
|
|
33
|
+
div((page) => {
|
|
34
|
+
page.vButton('Start task', (button) => {
|
|
35
|
+
button.variant('primary');
|
|
36
|
+
button.on('click', () => toast.success('Task started'));
|
|
37
|
+
});
|
|
38
|
+
}).bindTo('#app');
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The page only needs a `<div id="app"></div>` loaded with a module script.
|
|
42
|
+
|
|
43
|
+
## Server-Side Rendering (SSR)
|
|
44
|
+
|
|
45
|
+
The same page factory switches between server rendering and client rendering:
|
|
46
|
+
|
|
47
|
+
```js
|
|
48
|
+
// Server
|
|
49
|
+
import { renderToString } from '@yoyaflow/yoya-ui/ssr';
|
|
50
|
+
const { html, state } = renderToString(createPage, { state: { path: '/home' } });
|
|
51
|
+
|
|
52
|
+
// Client
|
|
53
|
+
import { hydrate, mount, parseState } from '@yoyaflow/yoya-ui/ssr';
|
|
54
|
+
const data = parseState(document.getElementById('__YOYA_DATA__').textContent);
|
|
55
|
+
const app = document.getElementById('app');
|
|
56
|
+
if (app.firstElementChild) {
|
|
57
|
+
hydrate(createPage, app, data); // Server HTML exists: adopt DOM, bind events
|
|
58
|
+
} else {
|
|
59
|
+
mount(createPage, app, data); // Empty shell: full client render
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Key points:
|
|
64
|
+
|
|
65
|
+
- `vClientOnly(loader)`: non-SSR modules (e.g. ECharts) emit a placeholder on the server and load on the client after hydration
|
|
66
|
+
- `Router.renderPath(path)`: renders the matching route for a request path (params / guards / 404)
|
|
67
|
+
- Per-request i18n instance, render-context id allocator, auto-destroy after render — the server stays stateless
|
|
68
|
+
- `maxNodes` falls back to client rendering automatically when exceeded
|
|
69
|
+
|
|
70
|
+
Full integration guide: [docs/ssr.md](docs/ssr.md) (Chinese); runnable example:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm run build
|
|
74
|
+
node src/examples/ssr/server-http.mjs
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Import per Module
|
|
78
|
+
|
|
79
|
+
```js
|
|
80
|
+
import { div, svg, createI18n } from '@yoyaflow/yoya-ui/core'; // core HTML/SVG/state
|
|
81
|
+
import { vButton, vCard, vForm, vTable } from '@yoyaflow/yoya-ui/ui'; // official component library
|
|
82
|
+
import { vEchart } from '@yoyaflow/yoya-ui/echart'; // ECharts component (bring your own echarts)
|
|
83
|
+
import { renderToString, hydrate } from '@yoyaflow/yoya-ui/ssr'; // server-side rendering
|
|
84
|
+
import '@yoyaflow/yoya-ui/ui.css'; // default styles and theme variables
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## TypeScript Support
|
|
88
|
+
|
|
89
|
+
The source stays plain JavaScript (zero build, runs directly); full TypeScript experience comes from the type declarations shipped with the package. The `types/` directory covers all four entry points (root / `core` / `echart` / `ssr`) and includes node classes, factory signatures, component state APIs and parent shortcut methods (e.g. `page.vButton(...)`).
|
|
90
|
+
|
|
91
|
+
TypeScript projects get hints and type checking with no extra configuration:
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
import { div, vButton, vCard, vTable, toast } from '@yoyaflow/yoya-ui';
|
|
95
|
+
import { createI18n } from '@yoyaflow/yoya-ui/core';
|
|
96
|
+
import { renderToString } from '@yoyaflow/yoya-ui/ssr';
|
|
97
|
+
import '@yoyaflow/yoya-ui/ui.css';
|
|
98
|
+
|
|
99
|
+
div((page) => {
|
|
100
|
+
page.className('app');
|
|
101
|
+
page.vButton('Start task', (button) => {
|
|
102
|
+
button.variant('primary');
|
|
103
|
+
button.on('click', () => toast.success('Task started'));
|
|
104
|
+
});
|
|
105
|
+
page.vCard((card) => {
|
|
106
|
+
card.vCardBody((body) => {
|
|
107
|
+
body.vTable((table) => {
|
|
108
|
+
table.columns([{ key: 'name', title: 'Name', dataIndex: 'name' }]);
|
|
109
|
+
table.rows([{ name: 'api-gateway' }]);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Type declaration quality is maintained in-repo:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npm run typecheck # validates declaration files and consumer type tests
|
|
120
|
+
npm run test:types # same as typecheck
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Core Capabilities
|
|
124
|
+
|
|
125
|
+
| Category | Content |
|
|
126
|
+
| ---------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
127
|
+
| HTML | Full WHATWG element factories with `HtmlElementNode` nested shortcuts |
|
|
128
|
+
| SVG | `svg()` namespace entry and built-in icons (`SearchOutlined`, etc.) |
|
|
129
|
+
| Layout | `flex` / `grid` / `stack` / `container` / `vRow` / `vCol` / `vContainer` / `mobileLayout` / `themeShell` |
|
|
130
|
+
| Actions | `vButton` / `vButtons` / `vFloatButton` / `vDropdownMenu` / `vContextMenu` |
|
|
131
|
+
| Navigation | `vMenu` / `vBreadcrumb` / `vSteps` / `vTabs` / `vAnchor` / `vNavbar` / Router / `vLink` |
|
|
132
|
+
| Feedback | `vDialog` / `vTooltip` / `vMessage` / `vMessageManager` / `toast` |
|
|
133
|
+
| Forms | `vForm` / `vInput` / `vSelect` / `vCheckbox` / `vRadio` / `vSwitch` / `vRate` / `vTimer` / `vUpload` |
|
|
134
|
+
| Data | `vCard` / `vTable` / `vTree` / `vPagination` / `vProgress` / `vScroll` / `vCarousel` / `vTimeline` / `vDetail` / board series |
|
|
135
|
+
| Charts | `vEchart` (ECharts-based, import on demand) |
|
|
136
|
+
| Async | `vDynamicLoader` |
|
|
137
|
+
| State | `vStateNode` / `@preact/signals-core` extension |
|
|
138
|
+
| i18n/Theme | `createI18n` / `withI18nStringShortcut` / theme tokens and light/dark modes |
|
|
139
|
+
|
|
140
|
+
Full component demos live in the example site (`npm run examples:html`, then open `http://localhost:5173/#/components`).
|
|
141
|
+
|
|
142
|
+
## Build Output
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
npm run build
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
`dist/` contains:
|
|
149
|
+
|
|
150
|
+
- `yoya.core.js` / `yoya.ui.js` — core and component library ESM entries
|
|
151
|
+
- `yoya.echart.js` — ECharts component entry (does not bundle echarts itself)
|
|
152
|
+
- `yoya.ssr.js` — server rendering entry (`renderToString` / `hydrate` / `mount`)
|
|
153
|
+
- `echarts.min.js` — ECharts core (load globally via `<script>`)
|
|
154
|
+
- `yoya.ui.css` — default styles and theme variables
|
|
155
|
+
- `yoya-ui.umd.js` — UMD build (`window.YoyaUI`)
|
|
156
|
+
|
|
157
|
+
## Development
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
npm install
|
|
161
|
+
npm test # vitest full suite
|
|
162
|
+
npm run lint # eslint
|
|
163
|
+
npm run build # full build
|
|
164
|
+
npm run examples:html # example site (localhost:5173)
|
|
165
|
+
npm run format # prettier
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Project Structure
|
|
169
|
+
|
|
170
|
+
```text
|
|
171
|
+
src/
|
|
172
|
+
core/ ViewNode/ElementNode core, state, i18n, theme, id allocator, SSR helpers
|
|
173
|
+
html/ svg/ HTML/SVG element factories
|
|
174
|
+
layout/ layout factories
|
|
175
|
+
actions/ navigation/ feedback/ form/ data-display/ async/ chart/ effects/
|
|
176
|
+
official component categories
|
|
177
|
+
components/ component aggregation and shared logic
|
|
178
|
+
examples/ example site (SSR demos and copy-paste guides)
|
|
179
|
+
index.js dev aggregate entry
|
|
180
|
+
yoya.core.js / yoya.ui.js / yoya.echart.js / yoya.ssr.js / yoya.ui.css
|
|
181
|
+
scripts/
|
|
182
|
+
build-entries.mjs ESM entry build
|
|
183
|
+
copy-example-modules.mjs example asset copy
|
|
184
|
+
vite.config.js / vite.umd.config.js / vite.examples.config.js
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Documentation
|
|
188
|
+
|
|
189
|
+
- [Server-Side Rendering Guide](docs/ssr.md) (Chinese)
|
|
190
|
+
- [Component Development Spec](docs/component-development-spec.md) (Chinese)
|
|
191
|
+
- [Component Library Authoring Guide](docs/component-library-authoring.md) (Chinese)
|
|
192
|
+
- [Theme Styling Spec](docs/theme-styling.md) (Chinese)
|
|
193
|
+
- [Component Catalog](docs/components.md) (Chinese)
|
|
194
|
+
- [Core Implementation Summary](docs/yoya-basic-core-summary.md) (Chinese)
|
|
195
|
+
|
|
196
|
+
## License
|
|
197
|
+
|
|
198
|
+
MIT
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# yoya-ui
|
|
2
|
+
|
|
3
|
+
> [English](./README.md) | **简体中文**
|
|
4
|
+
|
|
5
|
+
> Browser-native UI library with declarative HTML authoring — no virtual DOM, no JSX/SFC, no build chain.
|
|
6
|
+
> 面向后端与全栈开发者的轻量原生 JS UI 基础库:小核心 + 开放标准 + 官方组件库。
|
|
7
|
+
|
|
8
|
+
yoya-ui 直接在真实 DOM 上构建视图:声明式 HTML 写法、组件库、路由、i18n、主题与状态系统开箱即用,支持服务端渲染(SSR)与纯客户端渲染同代码切换。
|
|
9
|
+
|
|
10
|
+
## 特性
|
|
11
|
+
|
|
12
|
+
- **低门槛声明式构建**:直接用原生元素描述界面,只学 HTML 与原生 JS 即可使用,无框架专属概念
|
|
13
|
+
- **后端全栈友好**:面向后端与全栈开发者,无需前端框架经验即可快速构建后台与管理界面
|
|
14
|
+
- **微服务一体发布**:UI 与后端服务同包发布、随服务整体交付,适合微服务独立部署(原子化发布)
|
|
15
|
+
- **AI 友好**:声明式结构 + 零构建链,AI 生成的组件代码可直接运行
|
|
16
|
+
- **开箱即用的组件库**:表单、导航、反馈、数据展示、布局、图表等高频场景开箱即用
|
|
17
|
+
- **内置路由 / i18n / 主题 / 状态管理**:单页应用所需能力自带,无需额外选型
|
|
18
|
+
- **服务端渲染**:一套代码双模式可切换,整站服务端渲染与局部组件客户端加载加强均可用
|
|
19
|
+
- **小核心、零依赖、易扩展**:遵循标准组件形态,第三方组件可与内置组件无缝组合,按模块引入适配任意工程
|
|
20
|
+
- **长期维护友好**:核心库保持稳定,长期项目无需担心版本过时或升级重写
|
|
21
|
+
|
|
22
|
+
## 安装
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install @yoyaflow/yoya-ui
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## 快速开始
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
import { div, vButton, toast } from '@yoyaflow/yoya-ui';
|
|
32
|
+
import '@yoyaflow/yoya-ui/ui.css';
|
|
33
|
+
|
|
34
|
+
div((page) => {
|
|
35
|
+
page.vButton('启动任务', (button) => {
|
|
36
|
+
button.variant('primary');
|
|
37
|
+
button.on('click', () => toast.success('任务已启动'));
|
|
38
|
+
});
|
|
39
|
+
}).bindTo('#app');
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
页面只需要一个 `<div id="app"></div>`,用模块脚本加载即可。
|
|
43
|
+
|
|
44
|
+
## 服务端渲染(SSR)
|
|
45
|
+
|
|
46
|
+
同一份页面工厂代码,服务端渲染与客户端渲染可切换:
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
// 服务端
|
|
50
|
+
import { renderToString } from '@yoyaflow/yoya-ui/ssr';
|
|
51
|
+
const { html, state } = renderToString(createPage, { state: { path: '/home' } });
|
|
52
|
+
|
|
53
|
+
// 客户端
|
|
54
|
+
import { hydrate, mount, parseState } from '@yoyaflow/yoya-ui/ssr';
|
|
55
|
+
const data = parseState(document.getElementById('__YOYA_DATA__').textContent);
|
|
56
|
+
const app = document.getElementById('app');
|
|
57
|
+
if (app.firstElementChild) {
|
|
58
|
+
hydrate(createPage, app, data); // 有服务端 HTML:收养 DOM、绑定事件
|
|
59
|
+
} else {
|
|
60
|
+
mount(createPage, app, data); // 空壳:全量客户端渲染
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
要点:
|
|
65
|
+
|
|
66
|
+
- `vClientOnly(loader)`:非 SSR 模块(如 ECharts)服务端只出占位,hydration 后客户端加载
|
|
67
|
+
- `Router.renderPath(path)`:服务端按请求路径渲染匹配路由(参数 / 守卫 / 404)
|
|
68
|
+
- 每请求 i18n 实例、渲染上下文 id 分配器、渲染后自动销毁——服务端保持无状态
|
|
69
|
+
- `maxNodes` 超限自动回退客户端渲染
|
|
70
|
+
|
|
71
|
+
完整集成指南见 [docs/ssr.md](docs/ssr.md);可运行示例:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm run build
|
|
75
|
+
node src/examples/ssr/server-http.mjs
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## 按需引入
|
|
79
|
+
|
|
80
|
+
```js
|
|
81
|
+
import { div, svg, createI18n } from '@yoyaflow/yoya-ui/core'; // 核心 HTML/SVG/状态
|
|
82
|
+
import { vButton, vCard, vForm, vTable } from '@yoyaflow/yoya-ui/ui'; // 官方组件库
|
|
83
|
+
import { vEchart } from '@yoyaflow/yoya-ui/echart'; // ECharts 组件(需自行引入 echarts)
|
|
84
|
+
import { renderToString, hydrate } from '@yoyaflow/yoya-ui/ssr'; // 服务端渲染
|
|
85
|
+
import '@yoyaflow/yoya-ui/ui.css'; // 默认样式与主题变量
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## TypeScript 支持
|
|
89
|
+
|
|
90
|
+
源码保持纯 JavaScript(零构建、可直接运行),通过随包发布的类型声明提供完整的 TypeScript 体验。`types/` 目录覆盖四个入口(根入口 / `core` / `echart` / `ssr`),并包含节点类、工厂函数签名、组件状态 API 与父节点快捷方法(如 `page.vButton(...)`)的类型。
|
|
91
|
+
|
|
92
|
+
TypeScript 项目无需额外配置即可获得提示与类型检查:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
import { div, vButton, vCard, vTable, toast } from '@yoyaflow/yoya-ui';
|
|
96
|
+
import { createI18n } from '@yoyaflow/yoya-ui/core';
|
|
97
|
+
import { renderToString } from '@yoyaflow/yoya-ui/ssr';
|
|
98
|
+
import '@yoyaflow/yoya-ui/ui.css';
|
|
99
|
+
|
|
100
|
+
div((page) => {
|
|
101
|
+
page.className('app');
|
|
102
|
+
page.vButton('启动任务', (button) => {
|
|
103
|
+
button.variant('primary');
|
|
104
|
+
button.on('click', () => toast.success('任务已启动'));
|
|
105
|
+
});
|
|
106
|
+
page.vCard((card) => {
|
|
107
|
+
card.vCardBody((body) => {
|
|
108
|
+
body.vTable((table) => {
|
|
109
|
+
table.columns([{ key: 'name', title: '名称', dataIndex: 'name' }]);
|
|
110
|
+
table.rows([{ name: 'api-gateway' }]);
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
库内维护类型声明质量:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npm run typecheck # 校验声明文件与 consumer 类型测试
|
|
121
|
+
npm run test:types # 同 typecheck
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## 核心能力
|
|
125
|
+
|
|
126
|
+
| 分类 | 内容 |
|
|
127
|
+
| ----------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
128
|
+
| HTML 元素 | WHATWG 全量元素工厂,`HtmlElementNode` 嵌套快捷方法 |
|
|
129
|
+
| SVG | `svg()` 命名空间入口与内置图标(`SearchOutlined` 等) |
|
|
130
|
+
| 布局 | `flex` / `grid` / `stack` / `container` / `vRow` / `vCol` / `vContainer` / `mobileLayout` / `themeShell` |
|
|
131
|
+
| 动作 | `vButton` / `vButtons` / `vFloatButton` / `vDropdownMenu` / `vContextMenu` |
|
|
132
|
+
| 导航 | `vMenu` / `vBreadcrumb` / `vSteps` / `vTabs` / `vAnchor` / `vNavbar` / Router / `vLink` |
|
|
133
|
+
| 反馈 | `vDialog` / `vTooltip` / `vMessage` / `vMessageManager` / `toast` |
|
|
134
|
+
| 表单 | `vForm` / `vInput` / `vSelect` / `vCheckbox` / `vRadio` / `vSwitch` / `vRate` / `vTimer` / `vUpload` |
|
|
135
|
+
| 数据展示 | `vCard` / `vTable` / `vTree` / `vPagination` / `vProgress` / `vScroll` / `vCarousel` / `vTimeline` / `vDetail` / 看板系列 |
|
|
136
|
+
| 图表 | `vEchart`(基于 ECharts,按需引入) |
|
|
137
|
+
| 异步 | `vDynamicLoader` |
|
|
138
|
+
| 状态 | `vStateNode` / `@preact/signals-core` 扩展 |
|
|
139
|
+
| i18n / 主题 | `createI18n` / `withI18nStringShortcut` / 主题 token 与明暗模式 |
|
|
140
|
+
|
|
141
|
+
完整组件与交互演示见示例站(`npm run examples:html` 后打开 `http://localhost:5173/#/components`)。
|
|
142
|
+
|
|
143
|
+
## 构建产物
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
npm run build
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
`dist/` 输出:
|
|
150
|
+
|
|
151
|
+
- `yoya.core.js` / `yoya.ui.js` — 核心与组件库 ESM 入口
|
|
152
|
+
- `yoya.echart.js` — ECharts 组件入口(不包含 echarts 本体)
|
|
153
|
+
- `yoya.ssr.js` — 服务端渲染入口(`renderToString` / `hydrate` / `mount`)
|
|
154
|
+
- `echarts.min.js` — ECharts 本体(用 `<script>` 标签全局引入)
|
|
155
|
+
- `yoya.ui.css` — 默认样式与主题变量
|
|
156
|
+
- `yoya-ui.umd.js` — UMD 版(`window.YoyaUI`)
|
|
157
|
+
|
|
158
|
+
## 开发
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
npm install
|
|
162
|
+
npm test # vitest 全量测试
|
|
163
|
+
npm run lint # eslint
|
|
164
|
+
npm run build # 全量构建
|
|
165
|
+
npm run examples:html # 示例站(localhost:5173)
|
|
166
|
+
npm run format # prettier
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## 目录结构
|
|
170
|
+
|
|
171
|
+
```text
|
|
172
|
+
src/
|
|
173
|
+
core/ ViewNode/ElementNode 核心、状态、i18n、主题、id 分配器、SSR 助手
|
|
174
|
+
html/ svg/ HTML/SVG 元素工厂
|
|
175
|
+
layout/ 布局工厂
|
|
176
|
+
actions/ navigation/ feedback/ form/ data-display/ async/ chart/ effects/
|
|
177
|
+
官方组件库各分类
|
|
178
|
+
components/ 组件聚合与共享逻辑
|
|
179
|
+
examples/ 示例站(含 SSR 演示与复制即用指南)
|
|
180
|
+
index.js 开发聚合入口
|
|
181
|
+
yoya.core.js / yoya.ui.js / yoya.echart.js / yoya.ssr.js / yoya.ui.css
|
|
182
|
+
scripts/
|
|
183
|
+
build-entries.mjs ESM 入口构建
|
|
184
|
+
copy-example-modules.mjs 示例资源拷贝
|
|
185
|
+
vite.config.js / vite.umd.config.js / vite.examples.config.js
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## 文档
|
|
189
|
+
|
|
190
|
+
- [服务端渲染集成指南](docs/ssr.md)
|
|
191
|
+
- [组件开发规格](docs/component-development-spec.md)
|
|
192
|
+
- [组件库开发规范(第三方开发者)](docs/component-library-authoring.md)
|
|
193
|
+
- [主题样式规范](docs/theme-styling.md)
|
|
194
|
+
- [组件目录](docs/components.md)
|
|
195
|
+
- [核心实现摘要](docs/yoya-basic-core-summary.md)
|
|
196
|
+
|
|
197
|
+
## License
|
|
198
|
+
|
|
199
|
+
MIT
|