weifuwu 0.81.6 → 0.82.1
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 +7 -7
- package/dist/components/Slider/Slider.d.ts +8 -0
- package/dist/components/ThemeSwitch/ThemeSwitch.d.ts +7 -0
- package/dist/components/index.js +12 -12
- package/dist/components/style.css +367 -62
- package/dist/layout/weifuwu-layout.css +142 -7
- package/dist/ui-dom/index.js +8 -8
- package/dist/ui-dom/testing.js +1 -1
- package/docs/components.md +1 -1
- package/docs/frontend-ui-dom.md +2 -5
- package/docs/layout.md +12 -6
- package/docs/style-guide.md +58 -7
- package/docs/styling.md +81 -61
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ npm install weifuwu # 一个依赖,完整应用栈
|
|
|
25
25
|
| 后端 | `weifuwu` | Trie 路由 / 中间件链 / serve / 自研 PG+Redis / SSR / GraphQL / WebSocket |
|
|
26
26
|
| 前端 | `weifuwu/ui-dom` | **UIRouter(纯路由 + ctx 注入链)+ uiServe(渲染运行时)+ SSR/hydration**——handler=异步组件 / 中间件两阶段 / ctx.params 对齐后端;**weifuwu/components 直接复用**(VNode 契约唯一来源 ui-dom,见 `docs/frontend-ui-dom.md`) |
|
|
27
27
|
| 组件 | `weifuwu/components` | 115 个 HTML 原语组件(表单/表格/弹层/AiChat…),引用 `--wf-*` 主题变量 |
|
|
28
|
-
| 样式 | `weifuwu/layout` |
|
|
28
|
+
| 样式 | `weifuwu/layout` | 66 布局原语 + 156 工具类 + 177 主题 Token,零自定义 CSS 文件 |
|
|
29
29
|
| SaaS 地基 | 随包内置 | rateLimit / email / userSystem / messager / queue / ai → `ctx.*` 一行接入 |
|
|
30
30
|
|
|
31
31
|
> ⚠️ **注意:前后端都有 `ctx.ui`,但用途完全不同**
|
|
@@ -79,7 +79,7 @@ npm install weifuwu # 一个依赖,完整应用栈
|
|
|
79
79
|
| 样板 | 消灭方式 |
|
|
80
80
|
|---|---|
|
|
81
81
|
| 构建样板 | 动态编译(`ctx.ui.js` / `weifuwu/dev`),改代码即刷即用,零构建步骤 |
|
|
82
|
-
| 样式样板 | 语义原语 + 变量定制,零自定义 CSS 文件(`--wf-brand-
|
|
82
|
+
| 样式样板 | WUI 设计语言 + 语义原语 + 变量定制,零自定义 CSS 文件(`--wf-brand-seed` 改一个值全站换肤,暗色自动派生) |
|
|
83
83
|
| 数据样板 | `ctx.data.get` 一个 API 覆盖 SSR 预取 / hydration 命中 / SPA fetch,写数据像写同步代码 |
|
|
84
84
|
| 协议样板 | 自研 PG/Redis 客户端消灭双重编码、parseRow 样板、`'EX'` 参数顺序陷阱 |
|
|
85
85
|
|
|
@@ -107,7 +107,7 @@ npm install weifuwu # 一个依赖,完整应用栈
|
|
|
107
107
|
|
|
108
108
|
**机制与策略分离** — 框架管**机制**(token 怎么签、消息怎么送达、agent 循环怎么跑),开发者管**策略**(谁能建群、租户隔离 SQL、技能注册表)。这是「诚实裁剪」的积极面:**框架不越界,应用层不被绑架**——agent-platform 迁移验证了边界:多租户隔离(`WHERE tenant_id`)、技能编排、聊天产品模型留在应用层,框架守住通用能力(auth / ai / messager / UI / 数据管道)。
|
|
109
109
|
|
|
110
|
-
**零自定义 CSS 设计系统** — 一个 CSS 文件 = 双层 Token + 布局原语 + 工具类 + 组件样式。业务页面不写 style.css:组件 + `wf-*`
|
|
110
|
+
**零自定义 CSS 设计系统** — 一个 CSS 文件 = 双层 Token + 布局原语 + 工具类 + 组件样式。业务页面不写 style.css:组件 + `wf-*` 原语写业务,主题改一个值(`--wf-brand-seed` 换肤 / `data-preset` 预设 / `--wf-btn-radius` 钩子),暗色自动(详见[布局系统](docs/layout.md)与[主题配置](docs/styling.md))。
|
|
111
111
|
|
|
112
112
|
**自研数据层** — `ctx.sql`(PG v3 协议)与 `ctx.redis`(RESP2 协议)为**自研客户端**:确定性输出、行为可预测、统一错误模型。jsonb 自动解码、TTL 安全 API、schema 写前校验——高频痛点(双重编码/parseRow 样板/`'EX'` 参数顺序)从根上消除。
|
|
113
113
|
|
|
@@ -316,7 +316,7 @@ cd apps/agent-platform && npm run seed && npm run dev
|
|
|
316
316
|
|------|---------|------|
|
|
317
317
|
| `weifuwu/ui-dom` | `https://unpkg.com/weifuwu@latest/dist/ui-dom/index.js` | 前端运行时(UIRouter, uiServe, h, 状态管理等) |
|
|
318
318
|
| `weifuwu/components` | `https://unpkg.com/weifuwu@latest/dist/components/index.js` | 115 个 UI 组件(Button, Card, Table, Modal, Icon 等) |
|
|
319
|
-
| `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 + 177 个主题 Token + 66 个布局原语 + 156 个工具类 |
|
|
320
320
|
| 独立布局系统 | `https://unpkg.com/weifuwu@latest/dist/layout/weifuwu-layout.css` | 仅 CSS 布局,不依赖 JS |
|
|
321
321
|
|
|
322
322
|
|
|
@@ -359,7 +359,7 @@ cd apps/agent-platform && npm run seed && npm run dev
|
|
|
359
359
|
| `weifuwu/ui-dom` | **useChat / AiChat 原语** | AI 会话(流式/工具调用/HITL) | — |
|
|
360
360
|
| `weifuwu/ui-dom` | **事件原语** | `usePopup`(统一弹窗能力层)/ `usePresence` / `useInView` / `useScrollPosition` / `useGlobalKey` / `useDrag` / `useDragDrop` / `useAnimationEnd` / `useTween` / `useReducedMotion`(浏览器事件/动画统一入口,见 [docs/mobile.md](docs/mobile.md)) | — |
|
|
361
361
|
| `weifuwu/components` | **113 个组件** | Button/Table/Modal/Confirm/Toast/... + `confirm()` / `toast()` 命令式中间件 | weifuwu/ui-dom |
|
|
362
|
-
| `weifuwu/layout` | **CSS 布局** |
|
|
362
|
+
| `weifuwu/layout` | **CSS 布局** | 66 个布局原语 + 156 个工具类 + 177 个主题 Token(也支持 `weifuwu/layout/style.css`) | — |
|
|
363
363
|
|
|
364
364
|
---
|
|
365
365
|
|
|
@@ -382,7 +382,7 @@ cd apps/agent-platform && npm run seed && npm run dev
|
|
|
382
382
|
| AI 对话 / Agent / HITL 审批 | `ai()` → `ctx.ai` + `ctx.ui.useChat()` + `AiChat` | [docs/saas.md](docs/saas.md) |
|
|
383
383
|
| GraphQL / WebSocket | `app.graphql(handler)` · `app.ws(path, handler)` | [docs/realtime.md](docs/realtime.md) |
|
|
384
384
|
| 前端 UI 组件 | `weifuwu/components`(113 个:Button/Table/Modal/AiChat/...) | [docs/components.md](docs/components.md) |
|
|
385
|
-
| 布局/主题/暗色 | `weifuwu/layout`(58 原语 +
|
|
385
|
+
| 布局/主题/暗色 | `weifuwu/layout`(58 原语 + 156 工具类 + 177 Token) | [docs/layout.md](docs/layout.md) |
|
|
386
386
|
| 样式定制(零自定义 CSS) | `--wf-*` 变量覆盖 + 组件定制钩子 | [docs/styling.md](docs/styling.md) |
|
|
387
387
|
| 移动端适配(tap/长按/键盘/弹层) | `usePopup` / `useHoverCapable` / `useLongPress` / `useVisualViewport` | [docs/mobile.md](docs/mobile.md) |
|
|
388
388
|
| 前后端类型安全中间件 | `createMiddleware`(声明注入即类型化) | [docs/server.md](docs/server.md) |
|
|
@@ -513,7 +513,7 @@ README 只保留入门内容(设计理念 / 快速开始 / 核心概念 / 模
|
|
|
513
513
|
| [docs/frontend-ui-dom.md](docs/frontend-ui-dom.md) | **ui-dom**:UIRouter 纯路由 + uiServe 渲染运行时 + ctx 注入链 + components 复用 + SSR/hydration(前端唯一运行时——weifuwu/client 已删除) |
|
|
514
514
|
| [docs/frontend-middleware.md](docs/frontend-middleware.md) | 前端中间件:router / api / auth / ws / i18n / ErrorBoundary / confirm / toast / ScrollLock / extendCtx |
|
|
515
515
|
| [docs/components.md](docs/components.md) | 组件库(113 个组件 + 使用示例 + 组件列表) |
|
|
516
|
-
| [docs/layout.md](docs/layout.md) | 布局系统:
|
|
516
|
+
| [docs/layout.md](docs/layout.md) | 布局系统:66 个布局原语 + 156 个工具类 + 177 个主题 Token |
|
|
517
517
|
| [docs/style-guide.md](docs/style-guide.md) | 样式学习路径与命名规范:三档学习(组件 → 原语 → 速查)|
|
|
518
518
|
| [docs/styling.md](docs/styling.md) | 样式定制指南:零自定义 CSS 模式 / 暗色 / 组件级覆盖 / 作用域主题 |
|
|
519
519
|
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { Component } from '../../ui-dom/vnode.ts';
|
|
2
|
+
export interface SliderMark {
|
|
3
|
+
value: number;
|
|
4
|
+
label?: string;
|
|
5
|
+
}
|
|
2
6
|
export interface SliderProps {
|
|
3
7
|
label?: string;
|
|
4
8
|
value?: number | string;
|
|
@@ -6,6 +10,10 @@ export interface SliderProps {
|
|
|
6
10
|
max?: number;
|
|
7
11
|
step?: number;
|
|
8
12
|
disabled?: boolean;
|
|
13
|
+
/** 刻度标记(轨道下方刻度线 + 可选文字标签) */
|
|
14
|
+
marks?: SliderMark[];
|
|
15
|
+
/** 拖拽结束回调(pointerup) */
|
|
16
|
+
onChangeEnd?: (value: number) => void;
|
|
9
17
|
onChange?: (value: number) => void;
|
|
10
18
|
}
|
|
11
19
|
export declare const Slider: Component<SliderProps>;
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import type { Component } from '../../ui-dom/vnode.ts';
|
|
14
14
|
export type ThemeMode = 'auto' | 'light' | 'dark';
|
|
15
|
+
export type PresetName = 'default' | 'minimal' | 'compact' | 'rounded';
|
|
15
16
|
export interface ThemeSwitchProps {
|
|
16
17
|
/** 初始模式(默认从 localStorage 读取,无记录时为 auto) */
|
|
17
18
|
mode?: ThemeMode;
|
|
@@ -19,9 +20,15 @@ export interface ThemeSwitchProps {
|
|
|
19
20
|
onChange?: (mode: ThemeMode) => void;
|
|
20
21
|
/** localStorage 存储 key */
|
|
21
22
|
storageKey?: string;
|
|
23
|
+
/** 预设主题(可选——传了才渲染预设行;对应 layout `data-preset`) */
|
|
24
|
+
preset?: PresetName;
|
|
25
|
+
/** 预设切换回调 */
|
|
26
|
+
onPresetChange?: (preset: PresetName) => void;
|
|
22
27
|
}
|
|
23
28
|
/** 应用主题:auto 移除属性,light/dark 显式设置 */
|
|
24
29
|
export declare function applyTheme(mode: ThemeMode): void;
|
|
30
|
+
/** 应用预设主题:default 移除属性,其余显式设置 data-preset(与 data-theme 正交) */
|
|
31
|
+
export declare function applyPreset(preset: PresetName): void;
|
|
25
32
|
/** 读取当前生效主题(localStorage 优先,其次系统偏好) */
|
|
26
33
|
export declare function getTheme(): ThemeMode;
|
|
27
34
|
export declare const ThemeSwitch: Component<ThemeSwitchProps>;
|