weifuwu 0.70.0 → 0.72.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 +66 -55
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Affix/Affix.d.ts +1 -1
- package/dist/components/AiChat/AiChat.d.ts +2 -2
- package/dist/components/Alert/Alert.d.ts +1 -1
- package/dist/components/AlertGroup/AlertGroup.d.ts +1 -1
- package/dist/components/Anchor/Anchor.d.ts +1 -1
- package/dist/components/ApprovalCard/ApprovalCard.d.ts +3 -1
- package/dist/components/AspectRatio/AspectRatio.d.ts +1 -1
- package/dist/components/AutoComplete/AutoComplete.d.ts +1 -1
- package/dist/components/Avatar/Avatar.d.ts +1 -1
- package/dist/components/AvatarGroup/AvatarGroup.d.ts +1 -1
- package/dist/components/BackTop/BackTop.d.ts +1 -1
- package/dist/components/Badge/Badge.d.ts +7 -1
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Calendar/Calendar.d.ts +1 -1
- package/dist/components/Card/Card.d.ts +1 -1
- package/dist/components/Carousel/Carousel.d.ts +1 -1
- package/dist/components/Cascader/Cascader.d.ts +7 -3
- package/dist/components/Chart/Chart.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
- package/dist/components/CodeBlock/CodeBlock.d.ts +1 -1
- package/dist/components/Collapse/Collapse.d.ts +1 -1
- package/dist/components/ColorPicker/ColorPicker.d.ts +1 -1
- package/dist/components/Command/Command.d.ts +1 -1
- package/dist/components/Confirm/Confirm.d.ts +2 -2
- package/dist/components/ContextMenu/ContextMenu.d.ts +1 -1
- package/dist/components/CopyButton/CopyButton.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/Descriptions/Descriptions.d.ts +1 -1
- package/dist/components/DiffView/DiffView.d.ts +1 -1
- package/dist/components/Divider/Divider.d.ts +1 -1
- package/dist/components/Drawer/Drawer.d.ts +1 -1
- package/dist/components/Dropdown/Dropdown.d.ts +1 -1
- package/dist/components/Editor/Editor.d.ts +1 -1
- package/dist/components/Editor/tools/toolbar.d.ts +1 -1
- package/dist/components/EmptyState/EmptyState.d.ts +3 -2
- package/dist/components/Field/Field.d.ts +1 -1
- package/dist/components/FileUpload/FileUpload.d.ts +1 -1
- package/dist/components/FloatButton/FloatButton.d.ts +1 -1
- package/dist/components/Form/Form.d.ts +1 -1
- package/dist/components/Grid/Grid.d.ts +1 -1
- package/dist/components/Highlight/Highlight.d.ts +1 -1
- package/dist/components/HoverCard/HoverCard.d.ts +2 -2
- package/dist/components/Icon/Icon.d.ts +1 -1
- package/dist/components/Img/Img.d.ts +1 -1
- package/dist/components/InView/InView.d.ts +1 -1
- package/dist/components/InfiniteScroll/InfiniteScroll.d.ts +1 -1
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/InputNumber/InputNumber.d.ts +3 -3
- package/dist/components/JSONViewer/JSONViewer.d.ts +1 -1
- package/dist/components/Kanban/Kanban.d.ts +1 -1
- package/dist/components/Label/Label.d.ts +1 -1
- package/dist/components/Layout/Layout.d.ts +3 -1
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/List/List.d.ts +1 -1
- package/dist/components/Loading/Loading.d.ts +1 -1
- package/dist/components/LogViewer/LogViewer.d.ts +1 -1
- package/dist/components/Markdown/Markdown.d.ts +1 -1
- package/dist/components/Markdown/parser.d.ts +11 -5
- package/dist/components/Mentions/Mentions.d.ts +1 -1
- package/dist/components/Menu/Menu.d.ts +2 -2
- package/dist/components/Menubar/Menubar.d.ts +1 -1
- package/dist/components/MessageBubble/MessageBubble.d.ts +1 -1
- package/dist/components/Modal/Modal.d.ts +1 -1
- package/dist/components/NavMenu/NavMenu.d.ts +1 -1
- package/dist/components/Notification/Notification.d.ts +2 -2
- package/dist/components/PageHeader/PageHeader.d.ts +1 -1
- package/dist/components/Pagination/Pagination.d.ts +1 -1
- package/dist/components/PasswordInput/PasswordInput.d.ts +1 -1
- package/dist/components/PinInput/PinInput.d.ts +1 -1
- package/dist/components/Pipeline/Pipeline.d.ts +1 -1
- package/dist/components/Popconfirm/Popconfirm.d.ts +2 -2
- package/dist/components/Popover/Popover.d.ts +2 -2
- package/dist/components/ProgressBar/ProgressBar.d.ts +6 -1
- package/dist/components/QRCode/QRCode.d.ts +1 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/components/Rate/Rate.d.ts +3 -1
- package/dist/components/Resizable/Resizable.d.ts +1 -1
- package/dist/components/Result/Result.d.ts +1 -1
- package/dist/components/Scrollbar/Scrollbar.d.ts +1 -1
- package/dist/components/SearchInput/SearchInput.d.ts +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/components/Select/Select.d.ts +1 -1
- package/dist/components/Skeleton/Skeleton.d.ts +1 -1
- package/dist/components/Slider/Slider.d.ts +1 -1
- package/dist/components/Space/Space.d.ts +1 -1
- package/dist/components/Sparkline/Sparkline.d.ts +3 -1
- package/dist/components/StatCard/StatCard.d.ts +5 -3
- package/dist/components/Steps/Steps.d.ts +1 -1
- package/dist/components/Switch/Switch.d.ts +1 -1
- package/dist/components/Table/Table.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +1 -1
- package/dist/components/Tag/Tag.d.ts +1 -1
- package/dist/components/TagsInput/TagsInput.d.ts +1 -1
- package/dist/components/Textarea/Textarea.d.ts +1 -1
- package/dist/components/ThemeSwitch/ThemeSwitch.d.ts +1 -1
- package/dist/components/Timeline/Timeline.d.ts +6 -5
- package/dist/components/Toast/Toast.d.ts +2 -2
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +1 -1
- package/dist/components/ToolCallCard/ToolCallCard.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +2 -2
- package/dist/components/Tour/Tour.d.ts +1 -1
- package/dist/components/Transfer/Transfer.d.ts +7 -3
- package/dist/components/Tree/Tree.d.ts +4 -2
- package/dist/components/TreeSelect/TreeSelect.d.ts +1 -1
- package/dist/components/Typography/Typography.d.ts +1 -1
- package/dist/components/VirtualList/VirtualList.d.ts +1 -1
- package/dist/components/VirtualTable/VirtualTable.d.ts +10 -2
- package/dist/components/Watermark/Watermark.d.ts +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +13 -13
- package/dist/components/style.css +803 -320
- package/dist/dev/index.js +1 -1
- package/dist/index.js +12 -5
- package/dist/layout/weifuwu-layout.css +133 -15
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/ssr-page.d.ts +1 -1
- package/dist/ui/ssr.d.ts +1 -1
- package/dist/ui-dom/Confirm.d.ts +44 -0
- package/dist/ui-dom/Notification.d.ts +70 -0
- package/dist/ui-dom/Toast.d.ts +43 -0
- package/dist/{client → ui-dom}/diff.d.ts +7 -6
- package/dist/ui-dom/index.d.ts +33 -0
- package/dist/ui-dom/index.js +18 -0
- package/dist/ui-dom/jsx-runtime.d.ts +4 -0
- package/dist/ui-dom/jsx-runtime.js +1 -0
- package/dist/ui-dom/popup-tracker.d.ts +36 -0
- package/dist/ui-dom/registry.d.ts +39 -0
- package/dist/{client → ui-dom}/render.d.ts +14 -6
- package/dist/ui-dom/router.d.ts +66 -0
- package/dist/ui-dom/serve.d.ts +28 -0
- package/dist/ui-dom/ssr.d.ts +56 -0
- package/dist/{client → ui-dom}/types.d.ts +63 -18
- package/dist/{client → ui-dom}/ui.d.ts +9 -1
- package/dist/{client → ui-dom}/vnode.d.ts +24 -16
- package/docs/components.md +2 -2
- package/docs/custom-components.md +2 -0
- package/docs/frontend-middleware.md +3 -1
- package/docs/frontend-ui-dom.md +110 -0
- package/docs/frontend.md +3 -1
- package/docs/layout.md +37 -9
- package/docs/realtime.md +2 -0
- package/docs/saas.md +2 -0
- package/package.json +7 -7
- package/dist/client/app.d.ts +0 -26
- package/dist/client/error-boundary.d.ts +0 -23
- package/dist/client/index.d.ts +0 -54
- package/dist/client/index.js +0 -6
- package/dist/client/registry.d.ts +0 -34
- package/dist/client/router.d.ts +0 -26
- package/dist/client/type-flow.test.d.ts +0 -7
- /package/dist/{client → ui-dom}/ai.d.ts +0 -0
- /package/dist/{client → ui-dom}/browser.d.ts +0 -0
- /package/dist/{client → ui-dom}/focus-trap.d.ts +0 -0
- /package/dist/{client → ui-dom}/hydration.d.ts +0 -0
- /package/dist/{client → ui-dom}/i18n.d.ts +0 -0
- /package/dist/{client → ui-dom}/locale/en_US.d.ts +0 -0
- /package/dist/{client → ui-dom}/locale/zh_CN.d.ts +0 -0
- /package/dist/{client → ui-dom}/middleware/api.d.ts +0 -0
- /package/dist/{client → ui-dom}/middleware/auth.d.ts +0 -0
- /package/dist/{client → ui-dom}/middleware/ws.d.ts +0 -0
- /package/dist/{client → ui-dom}/motion.d.ts +0 -0
- /package/dist/{client → ui-dom}/popup.d.ts +0 -0
- /package/dist/{client → ui-dom}/reactive.d.ts +0 -0
- /package/dist/{client → ui-dom}/route-match.d.ts +0 -0
- /package/dist/{client → ui-dom}/scroll-lock.d.ts +0 -0
- /package/dist/{client → ui-dom}/use-chat.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# weifuwu
|
|
2
2
|
|
|
3
|
-
**自托管全栈框架** — 一个 npm 包 = 后端 HTTP + 前端 VDOM +
|
|
3
|
+
**自托管全栈框架** — 一个 npm 包 = 后端 HTTP + 前端 VDOM + 109 组件 + CSS 设计系统 + SaaS 地基(认证 / 消息 / 队列 / AI)。全自研、零构建、消灭样板。
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
npm install weifuwu # 一个依赖,完整应用栈
|
|
@@ -23,9 +23,9 @@ npm install weifuwu # 一个依赖,完整应用栈
|
|
|
23
23
|
| 层 | 入口 | 能力 |
|
|
24
24
|
|----|------|------|
|
|
25
25
|
| 后端 | `weifuwu` | Trie 路由 / 中间件链 / serve / 自研 PG+Redis / SSR / GraphQL / WebSocket |
|
|
26
|
-
| 前端 | `weifuwu/
|
|
27
|
-
| 组件 | `weifuwu/components` |
|
|
28
|
-
| 样式 | `weifuwu/layout` |
|
|
26
|
+
| 前端 | `weifuwu/ui-dom` | **UIRouter(纯路由 + ctx 注入链)+ uiServe(渲染运行时)+ SSR/hydration**——handler=异步组件 / 中间件两阶段 / ctx.params 对齐后端;**weifuwu/components 直接复用**(VNode 契约唯一来源 ui-dom,见 `docs/frontend-ui-dom.md`) |
|
|
27
|
+
| 组件 | `weifuwu/components` | 109 个 HTML 原语组件(表单/表格/弹层/AiChat…),引用 `--wf-*` 主题变量 |
|
|
28
|
+
| 样式 | `weifuwu/layout` | 57 布局原语 + 136 工具类 + 167 主题 Token,零自定义 CSS 文件 |
|
|
29
29
|
| SaaS 地基 | 随包内置 | rateLimit / email / userSystem / messager / queue / ai → `ctx.*` 一行接入 |
|
|
30
30
|
|
|
31
31
|
> ⚠️ **注意:前后端都有 `ctx.ui`,但用途完全不同**
|
|
@@ -109,7 +109,7 @@ npm install weifuwu # 一个依赖,完整应用栈
|
|
|
109
109
|
|
|
110
110
|
**自研数据层** — `ctx.sql`(PG v3 协议)与 `ctx.redis`(RESP2 协议)为**自研客户端**:确定性输出、行为可预测、统一错误模型。jsonb 自动解码、TTL 安全 API、schema 写前校验——高频痛点(双重编码/parseRow 样板/`'EX'` 参数顺序)从根上消除。
|
|
111
111
|
|
|
112
|
-
> **实践验证**:多租户 AI 平台(`apps/agent-platform`——14 页 + 部门聊天 + 知识库 + HITL 审批)已完全运行在框架上:auth(userSystem)/ AI 引擎(ai)/ 实时消息(messager)/ UI(
|
|
112
|
+
> **实践验证**:多租户 AI 平台(`apps/agent-platform`——14 页 + 部门聊天 + 知识库 + HITL 审批)已完全运行在框架上:auth(userSystem)/ AI 引擎(ai)/ 实时消息(messager)/ UI(109 组件)/ 数据管道(ctx.api)零自研替代。框架哲学(中间件注入、诚实裁剪、机制与策略分离)经受住了真实复杂应用的检验——这也是我们确定「哪些进框架、哪些留应用层」的依据。
|
|
113
113
|
|
|
114
114
|
---
|
|
115
115
|
|
|
@@ -125,9 +125,10 @@ npm install weifuwu # 一个依赖,完整应用栈
|
|
|
125
125
|
### 先写共享部分(两种模式都一样)
|
|
126
126
|
|
|
127
127
|
```tsx
|
|
128
|
-
// routes.tsx ——
|
|
129
|
-
import
|
|
130
|
-
|
|
128
|
+
// routes.tsx —— 页面声明(前后端共用 UIRouter)
|
|
129
|
+
import { UIRouter, asyncComponent } from 'weifuwu/ui-dom'
|
|
130
|
+
|
|
131
|
+
const app = new UIRouter()
|
|
131
132
|
|
|
132
133
|
// async 工厂组件:await 数据 → 返回视图(两阶段:外层初始化,内层渲染)
|
|
133
134
|
const Home = asyncComponent(async (ctx) => {
|
|
@@ -136,7 +137,9 @@ const Home = asyncComponent(async (ctx) => {
|
|
|
136
137
|
(props) => <h1>{msg.msg}</h1>
|
|
137
138
|
})
|
|
138
139
|
|
|
139
|
-
|
|
140
|
+
app.get('/', async () => <Home />) // handler = 异步组件
|
|
141
|
+
|
|
142
|
+
export { app }
|
|
140
143
|
```
|
|
141
144
|
|
|
142
145
|
### 模式 A:纯 SPA
|
|
@@ -144,30 +147,31 @@ export const routes: RouteDef[] = [{ path: '/', component: Home }]
|
|
|
144
147
|
```ts
|
|
145
148
|
// server.ts
|
|
146
149
|
import { serve, Router, ui, cors } from 'weifuwu'
|
|
150
|
+
import { app } from './routes.tsx'
|
|
147
151
|
|
|
148
|
-
const
|
|
149
|
-
|
|
150
|
-
|
|
152
|
+
const router = new Router()
|
|
153
|
+
router.use(cors())
|
|
154
|
+
router.use(ui()) // 注入 ctx.ui.html / ctx.ui.js / ctx.ui.css
|
|
151
155
|
|
|
152
156
|
// SPA 外壳(空 root + 前端 bundle)
|
|
153
|
-
|
|
157
|
+
router.get('/', (req, ctx) => ctx.ui.html`
|
|
154
158
|
<!doctype html><html><body>
|
|
155
159
|
<div id="root"></div>
|
|
156
160
|
<script src="/static/app.js"></script>
|
|
157
161
|
</body></html>
|
|
158
162
|
`)
|
|
159
|
-
|
|
160
|
-
|
|
163
|
+
router.get('/static/app.js', (req, ctx) => ctx.ui.js('./src/client.ts'))
|
|
164
|
+
router.get('/api/hello', () => Response.json({ msg: 'world' }))
|
|
161
165
|
|
|
162
|
-
serve(
|
|
166
|
+
serve(router, { port: 3000 })
|
|
163
167
|
```
|
|
164
168
|
|
|
165
169
|
```ts
|
|
166
170
|
// src/client.ts —— 纯客户端渲染
|
|
167
|
-
import {
|
|
168
|
-
import {
|
|
171
|
+
import { uiServe } from 'weifuwu/ui-dom'
|
|
172
|
+
import { app } from './routes.tsx'
|
|
169
173
|
|
|
170
|
-
|
|
174
|
+
uiServe(app, { root: '#root' }) // 监听 location → 执行路由 → VDOM 落地
|
|
171
175
|
```
|
|
172
176
|
|
|
173
177
|
### 模式 B:SSR + Hydration(内容页/SEO)
|
|
@@ -175,31 +179,35 @@ createApp().use(router({ routes })).mount('#root', RouteView)
|
|
|
175
179
|
同一份 `routes`、同一个组件,差异只在**后端加 `uiSsr` 一行、客户端加 `hydrate` 参数**:
|
|
176
180
|
|
|
177
181
|
```ts
|
|
178
|
-
// server.ts —— 完整版(与模式 A 的差异:
|
|
179
|
-
import { serve, Router, ui,
|
|
180
|
-
import {
|
|
182
|
+
// server.ts —— 完整版(与模式 A 的差异:ssrPage + 一条样式路由)
|
|
183
|
+
import { serve, Router, ui, cors } from 'weifuwu'
|
|
184
|
+
import { ssrPage } from 'weifuwu/ui-dom'
|
|
185
|
+
import { app } from './routes.tsx'
|
|
181
186
|
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
187
|
+
const router = new Router()
|
|
188
|
+
router.use(cors())
|
|
189
|
+
router.use(ui())
|
|
185
190
|
|
|
186
|
-
// 路由级 SSR:GET
|
|
191
|
+
// 路由级 SSR:GET 匹配共享 router → 注入 ctx.params → await 组件工厂
|
|
187
192
|
// → 完整 HTML + __DATA__ + bundle/styles 引用(无需手写页面 handler)
|
|
188
|
-
|
|
193
|
+
router.get('*', async (req, ctx) => {
|
|
194
|
+
const { page } = await ssrPage(app, { url: req.url ?? '/' })
|
|
195
|
+
return ctx.ui.html(page)
|
|
196
|
+
})
|
|
189
197
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
198
|
+
router.get('/static/app.js', (req, ctx) => ctx.ui.js('./src/client.ts'))
|
|
199
|
+
router.get('/static/style.css', (req, ctx) => ctx.ui.css('./src/style.css'))
|
|
200
|
+
router.get('/api/hello', () => Response.json({ msg: 'world' }))
|
|
193
201
|
|
|
194
|
-
serve(
|
|
202
|
+
serve(router, { port: 3000 })
|
|
195
203
|
```
|
|
196
204
|
|
|
197
205
|
```ts
|
|
198
206
|
// src/client.ts —— 与模式 A 的唯一差异:hydrate: true(收养服务端 HTML,无闪跳)
|
|
199
|
-
import {
|
|
200
|
-
import {
|
|
207
|
+
import { uiServe } from 'weifuwu/ui-dom'
|
|
208
|
+
import { app } from './routes.tsx'
|
|
201
209
|
|
|
202
|
-
|
|
210
|
+
uiServe(app, { root: '#root', hydrate: true })
|
|
203
211
|
```
|
|
204
212
|
|
|
205
213
|
### 启动(两种模式都一样)
|
|
@@ -245,7 +253,7 @@ cd apps/agent-platform && npm run seed && npm run dev
|
|
|
245
253
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
246
254
|
<title>Weifuwu CDN 示例</title>
|
|
247
255
|
|
|
248
|
-
<!-- 组件样式(可选,如只用 weifuwu/
|
|
256
|
+
<!-- 组件样式(可选,如只用 weifuwu/ui-dom 则不需要) -->
|
|
249
257
|
<link
|
|
250
258
|
rel="stylesheet"
|
|
251
259
|
href="https://unpkg.com/weifuwu@latest/dist/components/style.css"
|
|
@@ -258,14 +266,14 @@ cd apps/agent-platform && npm run seed && npm run dev
|
|
|
258
266
|
<script type="importmap">
|
|
259
267
|
{
|
|
260
268
|
"imports": {
|
|
261
|
-
"weifuwu/
|
|
269
|
+
"weifuwu/ui-dom": "https://unpkg.com/weifuwu@latest/dist/ui-dom/index.js",
|
|
262
270
|
"weifuwu/components": "https://unpkg.com/weifuwu@latest/dist/components/index.js"
|
|
263
271
|
}
|
|
264
272
|
}
|
|
265
273
|
</script>
|
|
266
274
|
|
|
267
275
|
<script type="module">
|
|
268
|
-
import {
|
|
276
|
+
import { UIRouter, uiServe, h } from 'weifuwu/ui-dom'
|
|
269
277
|
import { Card, Button, Badge } from 'weifuwu/components'
|
|
270
278
|
|
|
271
279
|
// 组件 = (initProps, ctx) => (props) => VNode
|
|
@@ -291,7 +299,10 @@ cd apps/agent-platform && npm run seed && npm run dev
|
|
|
291
299
|
)
|
|
292
300
|
}
|
|
293
301
|
|
|
294
|
-
|
|
302
|
+
// 路由 + 渲染:监听 location → 执行 handler → VDOM 落地
|
|
303
|
+
const app = new UIRouter()
|
|
304
|
+
app.get('/', () => h(Counter, {}))
|
|
305
|
+
uiServe(app, { root: '#root' })
|
|
295
306
|
</script>
|
|
296
307
|
</body>
|
|
297
308
|
</html>
|
|
@@ -303,9 +314,9 @@ cd apps/agent-platform && npm run seed && npm run dev
|
|
|
303
314
|
|
|
304
315
|
| 资源 | CDN 地址 | 说明 |
|
|
305
316
|
|------|---------|------|
|
|
306
|
-
| `weifuwu/
|
|
317
|
+
| `weifuwu/ui-dom` | `https://unpkg.com/weifuwu@latest/dist/ui-dom/index.js` | 前端运行时(UIRouter, uiServe, h, 状态管理等) |
|
|
307
318
|
| `weifuwu/components` | `https://unpkg.com/weifuwu@latest/dist/components/index.js` | 102 个 UI 组件(Button, Card, Table, Modal, Icon 等) |
|
|
308
|
-
| `weifuwu/components` | `https://unpkg.com/weifuwu@latest/dist/components/style.css` | 组件 CSS +
|
|
319
|
+
| `weifuwu/components` | `https://unpkg.com/weifuwu@latest/dist/components/style.css` | 组件 CSS + 167 个主题 Token + 57 个布局原语 + 136 个工具类 |
|
|
309
320
|
| 独立布局系统 | `https://unpkg.com/weifuwu@latest/dist/layout/weifuwu-layout.css` | 仅 CSS 布局,不依赖 JS |
|
|
310
321
|
|
|
311
322
|
|
|
@@ -336,18 +347,17 @@ cd apps/agent-platform && npm run seed && npm run dev
|
|
|
336
347
|
| `weifuwu` | **ok / badRequest / …** | HTTP 响应辅助函数(ok/badRequest/... 等 12 个) | — |
|
|
337
348
|
| `weifuwu` | **parseBody** | JSON 请求体安全解析 | — |
|
|
338
349
|
| Router 方法 | **app.graphql()** | GraphQL 端点(支持 GraphiQL),Router 实例方法(无需单独 import) | Router |
|
|
339
|
-
| `weifuwu/
|
|
340
|
-
| `weifuwu/
|
|
341
|
-
| `weifuwu/
|
|
342
|
-
| `weifuwu/
|
|
343
|
-
| `weifuwu/
|
|
344
|
-
| `weifuwu/
|
|
345
|
-
| `weifuwu/
|
|
346
|
-
| `weifuwu/
|
|
347
|
-
| `weifuwu/
|
|
348
|
-
| `weifuwu/
|
|
349
|
-
| `weifuwu/
|
|
350
|
-
| `weifuwu/layout` | **CSS 布局** | 70 个布局原语 + 164 个主题 Token(也支持 `weifuwu/layout/style.css`) | — |
|
|
350
|
+
| `weifuwu/ui-dom` | **UIRouter** | 纯路由 + ctx 注入链(`use` 中间件累积类型,对齐后端 `app.use`);handler=异步组件 | — |
|
|
351
|
+
| `weifuwu/ui-dom` | **uiServe** | 渲染运行时:监听 location → 执行路由 → VDOM diff/patch;`hydrate: true` 收养 SSR HTML | UIRouter |
|
|
352
|
+
| `weifuwu/ui-dom` | **asyncComponent** | async 工厂组件:工厂层声明数据,mount/render 同步(三条纪律见[核心概念](#核心概念)) | — |
|
|
353
|
+
| `weifuwu/ui-dom` | **ctx.data** | 数据管道:SSR 预取 / hydration 命中 / SPA fetch(`ctx.data.get`) | uiServe |
|
|
354
|
+
| `weifuwu/ui-dom` | **api / auth / ws** | HTTP 客户端 / 认证 / WebSocket 中间件 | — |
|
|
355
|
+
| `weifuwu/ui-dom` | **i18n** | 国际化中间件(运行时切换语言) | — |
|
|
356
|
+
| `weifuwu/ui-dom` | **ssrPage / serializeData** | 服务端渲染:SSR HTML + `__DATA__` 序列化(`ctx.params` 两端同源) | — |
|
|
357
|
+
| `weifuwu/ui-dom` | **useChat / AiChat 原语** | AI 会话(流式/工具调用/HITL) | — |
|
|
358
|
+
| `weifuwu/ui-dom` | **事件原语** | `usePopup` / `useDialog` / `usePresence` / `useInView` / `useScrollPosition` / `useGlobalKey` / `useDrag` / `useDragDrop` / `useAnimationEnd` / `useTween` / `useReducedMotion`(浏览器事件/动画统一入口,见 [docs/mobile.md](docs/mobile.md)) | — |
|
|
359
|
+
| `weifuwu/components` | **113 个组件** | Button/Table/Modal/Confirm/Toast/... + `confirm()` / `toast()` 命令式中间件 | weifuwu/ui-dom |
|
|
360
|
+
| `weifuwu/layout` | **CSS 布局** | 57 个布局原语 + 136 个工具类 + 167 个主题 Token(也支持 `weifuwu/layout/style.css`) | — |
|
|
351
361
|
|
|
352
362
|
---
|
|
353
363
|
|
|
@@ -358,7 +368,7 @@ cd apps/agent-platform && npm run seed && npm run dev
|
|
|
358
368
|
| 任务 | 用 | 位置 |
|
|
359
369
|
|------|-----|------|
|
|
360
370
|
| 起 HTTP 服务 + 路由 | `serve(app)` + `new Router()` + `app.get/post/...` | [docs/server.md](docs/server.md) |
|
|
361
|
-
| 渲染页面(SPA / SSR+hydrate) | `ui()` + `
|
|
371
|
+
| 渲染页面(SPA / SSR+hydrate) | `ui()` + `ssrPage(router)`;`uiServe(router, { root, hydrate })` | [docs/frontend-ui-dom.md](docs/frontend-ui-dom.md) · [docs/frontend.md](docs/frontend.md) |
|
|
362
372
|
| 数据持久化 | `postgres()` → `` ctx.sql`SELECT *` `` · `redis()` → `ctx.redis` | [docs/data.md](docs/data.md) |
|
|
363
373
|
| 数据管道(SSR 预取/hydration/SPA) | `ctx.data.get(key)` + `asyncComponent` | [docs/frontend.md](docs/frontend.md) |
|
|
364
374
|
| 用户注册/登录/会话/多租户 | `userSystem()` → `ctx.auth` + `/api/auth/*` | [docs/saas.md](docs/saas.md) |
|
|
@@ -369,7 +379,7 @@ cd apps/agent-platform && npm run seed && npm run dev
|
|
|
369
379
|
| AI 对话 / Agent / HITL 审批 | `ai()` → `ctx.ai` + `ctx.ui.useChat()` + `AiChat` | [docs/saas.md](docs/saas.md) |
|
|
370
380
|
| GraphQL / WebSocket | `app.graphql(handler)` · `app.ws(path, handler)` | [docs/realtime.md](docs/realtime.md) |
|
|
371
381
|
| 前端 UI 组件 | `weifuwu/components`(102 个:Button/Table/Modal/AiChat/...) | [docs/components.md](docs/components.md) |
|
|
372
|
-
| 布局/主题/暗色 | `weifuwu/layout`(
|
|
382
|
+
| 布局/主题/暗色 | `weifuwu/layout`(57 原语 + 136 工具类 + 167 Token) | [docs/layout.md](docs/layout.md) |
|
|
373
383
|
| 样式定制(零自定义 CSS) | `--wf-*` 变量覆盖 + 组件定制钩子 | [docs/styling.md](docs/styling.md) |
|
|
374
384
|
| 移动端适配(tap/长按/键盘/弹层) | `usePopup` / `useHoverCapable` / `useLongPress` / `useVisualViewport` | [docs/mobile.md](docs/mobile.md) |
|
|
375
385
|
| 前后端类型安全中间件 | `createMiddleware`(声明注入即类型化) | [docs/server.md](docs/server.md) |
|
|
@@ -489,9 +499,10 @@ README 只保留入门内容(设计理念 / 快速开始 / 核心概念 / 模
|
|
|
489
499
|
| 文档 | 内容 |
|
|
490
500
|
|------|------|
|
|
491
501
|
| [docs/frontend.md](docs/frontend.md) | 前端核心:createApp / 组件模型 / 状态管理 / 条件与列表 / ref / 类型 |
|
|
502
|
+
| [docs/frontend-ui-dom.md](docs/frontend-ui-dom.md) | **ui-dom**:UIRouter 纯路由 + uiServe 渲染运行时 + ctx 注入链 + components 复用 + SSR/hydration(前端唯一运行时——weifuwu/client 已删除) |
|
|
492
503
|
| [docs/frontend-middleware.md](docs/frontend-middleware.md) | 前端中间件:router / api / auth / ws / i18n / ErrorBoundary / confirm / toast / ScrollLock / extendCtx |
|
|
493
504
|
| [docs/components.md](docs/components.md) | 组件库(113 个组件 + 使用示例 + 组件列表) |
|
|
494
|
-
| [docs/layout.md](docs/layout.md) | 布局系统:
|
|
505
|
+
| [docs/layout.md](docs/layout.md) | 布局系统:57 个布局原语 + 136 个工具类 + 167 个主题 Token |
|
|
495
506
|
| [docs/styling.md](docs/styling.md) | 样式定制指南:零自定义 CSS 模式 / 暗色 / 组件级覆盖 / 作用域主题 |
|
|
496
507
|
|
|
497
508
|
### 通用
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
* return () => h(AiChat, { chat: $ })
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
|
-
import type { Component } from '../../
|
|
22
|
-
import type { UseChatHandle, UiMessage } from '../../
|
|
21
|
+
import type { Component } from '../../ui-dom/vnode.ts';
|
|
22
|
+
import type { UseChatHandle, UiMessage } from '../../ui-dom/use-chat.ts';
|
|
23
23
|
import type { WfError, WfUsage } from '../../ai/types.ts';
|
|
24
24
|
export interface AiChatLabels {
|
|
25
25
|
send: string;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* 滚动侦听:ctx.ui.useScrollPosition(全局/容器 scroll 监听 + rAF 节流,内置方案)。
|
|
6
6
|
* 裁剪:嵌套滚动容器、滚动容器非视口(container 未提供时仅视口)、自动生成标题锚点。
|
|
7
7
|
*/
|
|
8
|
-
import type { Component } from '../../
|
|
8
|
+
import type { Component } from '../../ui-dom/vnode.ts';
|
|
9
9
|
export interface AnchorItem {
|
|
10
10
|
href: string;
|
|
11
11
|
title: any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Component } from '../../
|
|
1
|
+
import type { Component } from '../../ui-dom/vnode.ts';
|
|
2
2
|
import type { WfApprovalRequest } from '../../ai/types.ts';
|
|
3
3
|
/**
|
|
4
4
|
* ApprovalCard — 人工审批卡片(wf: 协议 §4.5 交互原语)
|
|
@@ -26,5 +26,7 @@ export interface ApprovalCardProps {
|
|
|
26
26
|
onReject?: (note?: string) => void;
|
|
27
27
|
/** 自定义详情渲染(默认显示 name + args) */
|
|
28
28
|
renderDetail?: (request: WfApprovalRequest) => any;
|
|
29
|
+
/** 提交中(按钮禁用 + 文案反馈,防连点) */
|
|
30
|
+
loading?: boolean;
|
|
29
31
|
}
|
|
30
32
|
export declare const ApprovalCard: Component<ApprovalCardProps>;
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* 裁剪(CS-05):不做分组/虚拟化候选(Select searchable 覆盖分组场景);
|
|
14
14
|
* 自定义渲染用 `renderOption` 透传。
|
|
15
15
|
*/
|
|
16
|
-
import type { Component } from '../../
|
|
16
|
+
import type { Component } from '../../ui-dom/vnode.ts';
|
|
17
17
|
export interface AutoCompleteOption {
|
|
18
18
|
value: string;
|
|
19
19
|
label?: any;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* 用于群聊成员、协作人列表。
|
|
6
6
|
* 裁剪:不做 hover 展开 tooltip(见 roadmap)。
|
|
7
7
|
*/
|
|
8
|
-
import type { Component } from '../../
|
|
8
|
+
import type { Component } from '../../ui-dom/vnode.ts';
|
|
9
9
|
import { type AvatarProps } from '../Avatar/Avatar.ts';
|
|
10
10
|
export interface AvatarGroupItem {
|
|
11
11
|
name?: string;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
import type { Component } from '../../
|
|
1
|
+
import type { Component } from '../../ui-dom/vnode.ts';
|
|
2
2
|
export type BadgeVariant = 'default' | 'primary' | 'success' | 'warning' | 'danger' | 'info' | 'error';
|
|
3
3
|
export interface BadgeProps {
|
|
4
4
|
variant?: BadgeVariant;
|
|
5
5
|
dot?: boolean;
|
|
6
6
|
children?: any;
|
|
7
|
+
/** 数值角标(与 children 互斥;超出 overflowCount 显示 N+) */
|
|
8
|
+
count?: number;
|
|
9
|
+
/** 数值溢出阈值,默认 99(count > 阈值 → 阈值+) */
|
|
10
|
+
overflowCount?: number;
|
|
11
|
+
/** count=0 时是否显示(默认 false 隐藏,antd showZero=false 语义) */
|
|
12
|
+
showZero?: boolean;
|
|
7
13
|
}
|
|
8
14
|
export declare const Badge: Component<BadgeProps>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Component } from '../../
|
|
1
|
+
import type { Component } from '../../ui-dom/vnode.ts';
|
|
2
2
|
export interface CascaderOption {
|
|
3
3
|
value: string;
|
|
4
4
|
label: string;
|
|
@@ -14,8 +14,12 @@ export interface CascaderProps {
|
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
error?: string;
|
|
16
16
|
label?: string;
|
|
17
|
+
/** 显示搜索框(面板内,关键词时扁平过滤结果列表) */
|
|
18
|
+
showSearch?: boolean;
|
|
19
|
+
/** 搜索占位符 */
|
|
20
|
+
searchPlaceholder?: string;
|
|
17
21
|
'aria-label'?: string;
|
|
18
22
|
}
|
|
19
|
-
/** 级联选择(对应 antd/EP Cascader
|
|
20
|
-
* 裁剪:hover
|
|
23
|
+
/** 级联选择(对应 antd/EP Cascader):多列面板逐级选择,点击叶子完成 + 可选搜索。
|
|
24
|
+
* 裁剪:hover 展开、任意层级配置、异步加载。 */
|
|
21
25
|
export declare const Cascader: Component<CascaderProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* weifuwu/components — Chart
|
|
3
3
|
*/
|
|
4
|
-
import type { Component } from '../../
|
|
4
|
+
import type { Component } from '../../ui-dom/vnode.ts';
|
|
5
5
|
import type { DataPoint, ChartType, ChartOptions } from './chart-utils.ts';
|
|
6
6
|
export type { DataPoint, ChartType, ChartOptions };
|
|
7
7
|
export interface ChartProps {
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* 声明式:基于 Modal 封装,footer 自带「取消 / 确定」按钮。
|
|
5
5
|
* 命令式:confirm() 中间件注入 ctx.confirm(),返回 Promise<boolean>。
|
|
6
6
|
*/
|
|
7
|
-
import type { Component } from '../../
|
|
8
|
-
import type { AppMiddleware } from '../../
|
|
7
|
+
import type { Component } from '../../ui-dom/vnode.ts';
|
|
8
|
+
import type { AppMiddleware } from '../../ui-dom/types.ts';
|
|
9
9
|
export interface ConfirmProps {
|
|
10
10
|
open?: boolean;
|
|
11
11
|
title?: string;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* 状态管理:闭包变量 + ctx.ui.render()
|
|
8
8
|
*/
|
|
9
|
-
import type { Component } from '../../
|
|
9
|
+
import type { Component } from '../../ui-dom/vnode.ts';
|
|
10
10
|
export type DatePickerMode = 'date' | 'datetime' | 'time' | 'range';
|
|
11
11
|
export interface DatePickerProps {
|
|
12
12
|
mode?: DatePickerMode;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* 详情字段展示:label/value 栅格(<dl> 语义结构,屏幕阅读器友好)。
|
|
5
5
|
* 用于 Agent 配置展示、实体详情、订单信息等只读字段场景。
|
|
6
6
|
*/
|
|
7
|
-
import type { Component } from '../../
|
|
7
|
+
import type { Component } from '../../ui-dom/vnode.ts';
|
|
8
8
|
export interface DescriptionItem {
|
|
9
9
|
label: any;
|
|
10
10
|
value: any;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* usePopup 组合器:click 触发 + 受控 open + 外部点击/Escape(document 级,
|
|
5
5
|
* 弹层在 portal 中按 Escape 也能关)+ 定位/视口 clamp + portal。
|
|
6
6
|
*/
|
|
7
|
-
import type { Component } from '../../
|
|
7
|
+
import type { Component } from '../../ui-dom/vnode.ts';
|
|
8
8
|
export interface DropdownItem {
|
|
9
9
|
label: string;
|
|
10
10
|
value?: string;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* 使用两阶段模型 + VDOM innerHTML 支持。
|
|
8
8
|
* 状态管理:闭包变量 + ctx.ui.render()
|
|
9
9
|
*/
|
|
10
|
-
import type { Component } from '../../
|
|
10
|
+
import type { Component } from '../../ui-dom/vnode.ts';
|
|
11
11
|
import type { EditorProps } from './tools/types.ts';
|
|
12
12
|
export type { EditorProps, ToolbarItem } from './tools/types.ts';
|
|
13
13
|
export declare const Editor: Component<EditorProps>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* weifuwu/components/Editor/tools — 工具栏渲染
|
|
3
3
|
*/
|
|
4
|
-
import type { VNode } from '../../../
|
|
4
|
+
import type { VNode } from '../../../ui-dom/vnode.ts';
|
|
5
5
|
import type { FormatState, ToolbarItem } from './types.ts';
|
|
6
6
|
export declare const DEFAULT_TOOLBAR: ToolbarItem[];
|
|
7
7
|
export declare const TOOLBAR_LABELS: Record<ToolbarItem, string>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { Component } from '../../
|
|
1
|
+
import type { Component, VNode } from '../../ui-dom/vnode.ts';
|
|
2
2
|
export interface EmptyStateProps {
|
|
3
|
-
|
|
3
|
+
/** 图标——VNode(推荐 <Icon />)或字符串(emoji/字形);默认 Icon inbox(P3:组件内禁裸 emoji) */
|
|
4
|
+
icon?: string | VNode | null;
|
|
4
5
|
text?: string;
|
|
5
6
|
hint?: string;
|
|
6
7
|
children?: any;
|