@yoyaflow/yoya-ui 0.2.0 → 0.3.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/README.md +38 -0
- package/README.zh-CN.md +38 -0
- package/dist/yoya-ui.umd.js +2 -2
- package/dist/yoya.core.js +194 -113
- package/dist/yoya.ssr.js +2468 -126
- package/dist/yoya.ui.css +35 -11
- package/dist/yoya.ui.js +2916 -2110
- package/package.json +1 -1
- package/types/core.d.ts +63 -0
- package/types/data-display.d.ts +77 -0
- package/types/form.d.ts +21 -0
- package/types/ssr.d.ts +43 -0
- package/types/svg.d.ts +1 -0
- package/types/yoya.ssr.d.ts +6 -1
package/README.md
CHANGED
|
@@ -6,6 +6,28 @@
|
|
|
6
6
|
|
|
7
7
|
yoya-ui is a web foundation library — a new form of business UI construction. Views are built directly on the real DOM: declarative HTML authoring, router, i18n, theming, state and server-side rendering (SSR) out of the box, with pure client rendering switchable from the same code. Bundled UI components exist for out-of-the-box convenience; they are not the boundary of the library — native elements and third-party components compose the same way.
|
|
8
8
|
|
|
9
|
+
## Hello World — declarative UI and reactive i18n
|
|
10
|
+
|
|
11
|
+
No framework runtime, no virtual DOM, no JSX build step: views are real DOM nodes described in plain JS, and i18n is a string shortcut.
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
// HelloWorldExample — declarative UI
|
|
15
|
+
function HelloWorldExample() {
|
|
16
|
+
return div((root) => {
|
|
17
|
+
root.p('Hello,World!');
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
// HelloWorldExampleI18n — reactive i18n text with params
|
|
24
|
+
function HelloWorldExampleI18n() {
|
|
25
|
+
return div((root) => {
|
|
26
|
+
root.p('Hello, {name}!'.s('greeting.hello', { name: 'yoya-ui' }));
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
9
31
|
## Features
|
|
10
32
|
|
|
11
33
|
- **Low-barrier declarative authoring**: build UI with declarative structured JS elements — view and logic live in the same language, eliminating the friction between HTML markup and complex manipulation logic; only HTML and plain JS are required, with no framework-specific concepts
|
|
@@ -22,6 +44,22 @@ yoya-ui is a web foundation library — a new form of business UI construction.
|
|
|
22
44
|
|
|
23
45
|
## Installation
|
|
24
46
|
|
|
47
|
+
### Scaffold a new project
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npx create-yoya-ui@latest my-app # basic template (SPA)
|
|
51
|
+
npx create-yoya-ui@latest my-app --template ssr # SSR template (renderPage + hydrateOrMount)
|
|
52
|
+
npx create-yoya-ui@latest my-app --template admin # admin console template (top nav + collapsible sidebar + RouterViews)
|
|
53
|
+
cd my-app
|
|
54
|
+
npm install
|
|
55
|
+
npm run dev # basic / admin: dev server
|
|
56
|
+
# SSR: npm run build && npm start
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
`--template admin` scaffolds a standard admin console: top navigation, collapsible sidebar and a titled RouterViews content area, with feature examples for dashboard (data boards & charts), member / role / permission management, and dictionary management (type table with an item editor dialog).
|
|
60
|
+
|
|
61
|
+
### Install into an existing project
|
|
62
|
+
|
|
25
63
|
```bash
|
|
26
64
|
npm install @yoyaflow/yoya-ui
|
|
27
65
|
```
|
package/README.zh-CN.md
CHANGED
|
@@ -7,6 +7,28 @@
|
|
|
7
7
|
|
|
8
8
|
yoya-ui 是一套新的业务界面构建形式,也是一个 Web 基础库:直接在真实 DOM 上构建视图,声明式 HTML 写法、路由、i18n、主题与状态系统开箱即用,支持服务端渲染(SSR)与纯客户端渲染同代码切换。自带 UI 组件只是为了开箱即用,组件清单并不代表库的能力边界——原生元素与第三方组件以同样方式自由组合。
|
|
9
9
|
|
|
10
|
+
## Hello World——声明式构建与响应式 i18n
|
|
11
|
+
|
|
12
|
+
没有框架运行时、没有虚拟 DOM、没有 JSX 构建链:视图就是由原生 JS 描述的真实 DOM,i18n 只是字符串快捷方式。
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
// HelloWorldExample —— 声明式构建
|
|
16
|
+
function HelloWorldExample() {
|
|
17
|
+
return div((root) => {
|
|
18
|
+
root.p('Hello,World!');
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
// HelloWorldExampleI18n —— 响应式 i18n 文本(带参数)
|
|
25
|
+
function HelloWorldExampleI18n() {
|
|
26
|
+
return div((root) => {
|
|
27
|
+
root.p('Hello, {name}!'.s('greeting.hello', { name: 'yoya-ui' }));
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
10
32
|
## 特性
|
|
11
33
|
|
|
12
34
|
- **低门槛声明式构建**:采用声明式结构化 JS 元素构建方案,视图与操作逻辑同源,消除 HTML 标签化语言与复杂操作逻辑不兼容的问题;只学 HTML 与原生 JS 即可使用,无框架专属概念
|
|
@@ -23,6 +45,22 @@ yoya-ui 是一套新的业务界面构建形式,也是一个 Web 基础库:
|
|
|
23
45
|
|
|
24
46
|
## 安装
|
|
25
47
|
|
|
48
|
+
### 脚手架快速搭建
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npx create-yoya-ui@latest my-app # basic 模板(SPA)
|
|
52
|
+
npx create-yoya-ui@latest my-app --template ssr # SSR 模板(renderPage + hydrateOrMount)
|
|
53
|
+
npx create-yoya-ui@latest my-app --template admin # admin 后台管理模板(顶部导航 + 可折叠侧栏 + RouterViews)
|
|
54
|
+
cd my-app
|
|
55
|
+
npm install
|
|
56
|
+
npm run dev # basic / admin:开发服务器
|
|
57
|
+
# SSR:npm run build && npm start
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`--template admin` 生成标准后台管理模板:顶部导航 + 可折叠侧栏 + 带标题的 RouterViews 内容区,内置数据概览看板与图表,以及成员 / 角色 / 权限 / 字典管理等业务域示例。
|
|
61
|
+
|
|
62
|
+
### 已有项目引入
|
|
63
|
+
|
|
26
64
|
```bash
|
|
27
65
|
npm install @yoyaflow/yoya-ui
|
|
28
66
|
```
|