weifuwu 0.93.3 → 0.94.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 +5 -5
- package/dist/client/components/ActionSheet/ActionSheet.d.ts +1 -1
- package/dist/client/components/AlertGroup/AlertGroup.d.ts +1 -1
- package/dist/client/components/Anchor/Anchor.d.ts +1 -1
- package/dist/client/components/AppShell/AppShell.d.ts +2 -2
- package/dist/client/components/AuthPage/AuthPage.d.ts +1 -1
- package/dist/client/components/AutoComplete/AutoComplete.d.ts +1 -1
- package/dist/client/components/AvatarGroup/AvatarGroup.d.ts +1 -1
- package/dist/client/components/Button/Button.d.ts +8 -2
- package/dist/client/components/Chart/Chart.d.ts +1 -1
- package/dist/client/components/Chart/chart-utils.d.ts +1 -1
- package/dist/client/components/ChatInput/ChatInput.d.ts +3 -1
- package/dist/client/components/CodeBlock/CodeBlock.d.ts +1 -1
- package/dist/client/components/CodeBlock/highlight.d.ts +1 -1
- package/dist/client/components/Confirm/Confirm.d.ts +1 -1
- package/dist/client/components/CronPicker/CronPicker.d.ts +1 -1
- package/dist/client/components/DatePicker/DatePicker.d.ts +1 -1
- package/dist/client/components/DatePicker/calendar-utils.d.ts +1 -1
- package/dist/client/components/Descriptions/Descriptions.d.ts +1 -1
- package/dist/client/components/Drawer/Drawer.d.ts +4 -1
- package/dist/client/components/DropZone/DropZone.d.ts +1 -1
- package/dist/client/components/Dropdown/Dropdown.d.ts +1 -1
- package/dist/client/components/Editor/Editor.d.ts +1 -1
- package/dist/client/components/Editor/edit-events.d.ts +1 -1
- package/dist/client/components/Editor/model/apply.d.ts +1 -1
- package/dist/client/components/Editor/model/diff.d.ts +1 -1
- package/dist/client/components/Editor/model/dom.d.ts +1 -1
- package/dist/client/components/Editor/model/history.d.ts +1 -1
- package/dist/client/components/Editor/model/html.d.ts +1 -1
- package/dist/client/components/Editor/model/inverse.d.ts +1 -1
- package/dist/client/components/Editor/model/types.d.ts +1 -1
- package/dist/client/components/Editor/tools/table.d.ts +1 -1
- package/dist/client/components/Editor/tools/toolbar.d.ts +1 -1
- package/dist/client/components/Editor/tools/types.d.ts +1 -1
- package/dist/client/components/FilePreview/FilePreview.d.ts +1 -1
- package/dist/client/components/FilePreview/markdown.d.ts +1 -1
- package/dist/client/components/FileTree/FileTree.d.ts +1 -1
- package/dist/client/components/FileUpload/FileUpload.d.ts +1 -1
- package/dist/client/components/FloatButton/FloatButton.d.ts +1 -1
- package/dist/client/components/Grid/Grid.d.ts +1 -1
- package/dist/client/components/Highlight/Highlight.d.ts +1 -1
- package/dist/client/components/HoverCard/HoverCard.d.ts +1 -1
- package/dist/client/components/Icon/Icon.d.ts +1 -1
- package/dist/client/components/Img/Img.d.ts +1 -1
- package/dist/client/components/InView/InView.d.ts +1 -1
- package/dist/client/components/Input/Input.d.ts +6 -0
- package/dist/client/components/InputNumber/InputNumber.d.ts +1 -1
- package/dist/client/components/JSONViewer/JSONViewer.d.ts +1 -1
- package/dist/client/components/Layout/Layout.d.ts +1 -1
- package/dist/client/components/Link/Link.d.ts +1 -1
- package/dist/client/components/List/List.d.ts +1 -1
- package/dist/client/components/ListScaffold/ListScaffold.d.ts +2 -2
- package/dist/client/components/LogViewer/LogViewer.d.ts +1 -1
- package/dist/client/components/Markdown/Markdown.d.ts +1 -1
- package/dist/client/components/Markdown/parser.d.ts +1 -1
- package/dist/client/components/Menu/Menu.d.ts +1 -1
- package/dist/client/components/MessageBubble/MessageBubble.d.ts +1 -1
- package/dist/client/components/Modal/Modal.d.ts +5 -1
- package/dist/client/components/NavBar/NavBar.d.ts +1 -1
- package/dist/client/components/NavMenu/NavMenu.d.ts +1 -1
- package/dist/client/components/OfficeEditor/ai/ai-bridge.d.ts +1 -1
- package/dist/client/components/OfficeEditor/model/apply.d.ts +1 -1
- package/dist/client/components/OfficeEditor/model/types.d.ts +1 -1
- package/dist/client/components/PasswordInput/PasswordInput.d.ts +1 -1
- package/dist/client/components/Popconfirm/Popconfirm.d.ts +1 -1
- package/dist/client/components/Popover/Popover.d.ts +1 -1
- package/dist/client/components/PromptTemplate/PromptTemplate.d.ts +1 -1
- package/dist/client/components/RelationGraph/RelationGraph.d.ts +1 -1
- package/dist/client/components/Result/Result.d.ts +1 -1
- package/dist/client/components/Scrollbar/Scrollbar.d.ts +1 -1
- package/dist/client/components/SheetGrid/SheetGrid.d.ts +2 -2
- package/dist/client/components/Skeleton/Skeleton.d.ts +1 -1
- package/dist/client/components/SlideCanvas/SlideCanvas.d.ts +2 -2
- package/dist/client/components/Space/Space.d.ts +1 -1
- package/dist/client/components/StatusDot/StatusDot.d.ts +2 -2
- package/dist/client/components/TabBar/TabBar.d.ts +1 -1
- package/dist/client/components/TagsInput/TagsInput.d.ts +1 -1
- package/dist/client/components/Textarea/Textarea.d.ts +6 -0
- package/dist/client/components/ThemeSwitch/ThemeSwitch.d.ts +1 -1
- package/dist/client/components/Timeline/Timeline.d.ts +1 -1
- package/dist/client/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/client/components/VirtualTable/VirtualTable.d.ts +1 -1
- package/dist/client/components/WordCloud/WordCloud.d.ts +1 -1
- package/dist/client/components/index.d.ts +3 -3
- package/dist/client/components/index.js +38 -38
- package/dist/client/components/style.css +1 -1
- package/dist/client/layout/decl.d.ts +9 -0
- package/dist/client/layout/define.d.ts +41 -0
- package/dist/client/layout/index.d.ts +20 -0
- package/dist/client/layout/index.js +17 -0
- package/dist/client/layout/weifuwu-layout.css +1 -1
- package/dist/client/vdom/context/UIContext.d.ts +1 -1
- package/dist/client/vdom/core/create-component.d.ts +42 -0
- package/dist/client/vdom/core/create-item.d.ts +52 -0
- package/dist/client/vdom/core/vnode.d.ts +8 -2
- package/dist/client/vdom/hooks/env.d.ts +12 -0
- package/dist/client/vdom/hooks/field.d.ts +54 -0
- package/dist/client/vdom/hooks/overlay.d.ts +60 -0
- package/dist/client/vdom/hooks/signal.d.ts +25 -0
- package/dist/client/vdom/index.d.ts +9 -2
- package/dist/client/vdom/index.js +3 -3
- package/dist/client/vdom/jsx-runtime.d.ts +4 -4
- package/dist/client/vdom/jsx-runtime.js +1 -1
- package/dist/client/vdom/testing.js +2 -2
- package/dist/dev/index.js +7 -6
- package/dist/server/ai/index.js +7 -0
- package/dist/server/ai/types.d.ts +1 -1
- package/dist/server/email/index.js +1 -0
- package/dist/server/index.js +235 -5
- package/dist/server/messager/index.js +1 -0
- package/dist/server/postgres/index.js +56 -0
- package/dist/server/queue/index.js +1 -0
- package/dist/server/redis/index.js +3 -0
- package/dist/server/scheduler/index.js +1 -0
- package/dist/server/ui/index.d.ts +1 -1
- package/dist/server/ui/index.js +15 -0
- package/dist/server/user/index.js +1 -0
- package/dist/server/user/token.d.ts +1 -1
- package/dist/server/workflows/index.js +24 -0
- package/dist/shared/router/index.js +2 -0
- package/docs/client.md +123 -9
- package/docs/layout.md +14 -14
- package/docs/server.md +1 -1
- package/package.json +66 -12
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
```tsx
|
|
34
34
|
// routes.tsx —— 路由树(UIRouter——前后端同一棵树——单一实现源)
|
|
35
|
-
import { UIRouter, h } from 'weifuwu/vdom'
|
|
35
|
+
import { UIRouter, h } from 'weifuwu/client/vdom'
|
|
36
36
|
|
|
37
37
|
export function buildRouter() {
|
|
38
38
|
const router = new UIRouter()
|
|
@@ -57,7 +57,7 @@ serve(router, { port: 3000 })
|
|
|
57
57
|
|
|
58
58
|
```ts
|
|
59
59
|
// src/client.ts —— 浏览器 boot
|
|
60
|
-
import { uiServe } from 'weifuwu/vdom'
|
|
60
|
+
import { uiServe } from 'weifuwu/client/vdom'
|
|
61
61
|
import { buildRouter } from './routes.tsx'
|
|
62
62
|
uiServe(buildRouter(), { root: '#root' })
|
|
63
63
|
```
|
|
@@ -95,9 +95,9 @@ router.get('*', async (req, ctx) => {
|
|
|
95
95
|
| `weifuwu` | postgres / redis / Memory | 自研 PG v3 + RESP2 协议(`ctx.orm` / `ctx.redis`——数据面 = 声明式 ORM AST,业务零 SQL 文本);Memory 零数据库测试 |
|
|
96
96
|
| `weifuwu` | shape / bodyOf / listQuery / errorResponse | 数据样板收口:shape 声明 → `bodyOf`(body 校验·类型精确)/ `listQuery`(URL 参数)/ `errorResponse`(catch 映射)——手写 route 三件套(docs/server.md §5.3/§5.4.1) |
|
|
97
97
|
| `weifuwu` | ui | SSR 渲染 + esbuild JS/CSS 动态编译(`ctx.ui`) |
|
|
98
|
-
| `weifuwu/vdom` | UIRouter / uiServe / uiSsr | 前端路由唯一入口 + 浏览器 boot + SSR(结构吸收) |
|
|
99
|
-
| `weifuwu/vdom` | 命令流引擎 + hooks 全家 | 渲染周期/事件代理/三状态机 + useAsyncData/usePopup/useControlled/… |
|
|
100
|
-
| `weifuwu/components` | **134 个组件** | Button/Table/Modal/AiChat/… + `toast()`/`confirm()` 命令式中间件 |
|
|
98
|
+
| `weifuwu/client/vdom` | UIRouter / uiServe / uiSsr | 前端路由唯一入口 + 浏览器 boot + SSR(结构吸收) |
|
|
99
|
+
| `weifuwu/client/vdom` | 命令流引擎 + hooks 全家 | 渲染周期/事件代理/三状态机 + useAsyncData/usePopup/useControlled/… |
|
|
100
|
+
| `weifuwu/client/components` | **134 个组件** | Button/Table/Modal/AiChat/… + `toast()`/`confirm()` 命令式中间件 |
|
|
101
101
|
| `weifuwu/layout` | CSS 布局 | 50 个布局原语 + 98 个工具类 + 176 个主题 Token |
|
|
102
102
|
| `weifuwu` | rateLimit / email / userSystem / messager / queue / scheduler / ai / graphql | SaaS 地基中间件(ctx 注入) |
|
|
103
103
|
| `weifuwu/dev` | dev loader | `--import weifuwu/dev` 直接跑 `.ts/.tsx` |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** ActionSheet:动作面板——移动端底部滑出(命令列表 + 取消按钮,usePopup 会话级模态)(showcase /components/actionsheet) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — ActionSheet 动作面板(移动端底部滑出)
|
|
3
|
+
* weifuwu/client/components — ActionSheet 动作面板(移动端底部滑出)
|
|
4
4
|
*
|
|
5
5
|
* 命令列表 + 取消按钮(iOS 风格)——移动端 App 常用弹层(照片选择/分享/
|
|
6
6
|
* 更多操作)。与 Modal/Drawer 同款会话级模态(openPopup presence 退场状态机 +
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/** AppShell:应用壳——品牌 + 分组导航 + 用户区 + 主内容(受控——父层驱动)(showcase /components/appshell) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — AppShell
|
|
3
|
+
* weifuwu/client/components — AppShell
|
|
4
4
|
*
|
|
5
5
|
* 应用壳(SaaS 侧栏布局):品牌区 + 导航菜单 + 用户区 + 主内容区——
|
|
6
6
|
* 认证守卫/导航/用户数据由父层驱动(受控——组件零 fetch 零路由依赖)。
|
|
7
7
|
*
|
|
8
8
|
* 来源:agent-platform AppLayout(侧栏壳——Menu/Avatar/Button 组装样板)
|
|
9
9
|
* 沉淀——每个 SPA 应用的重复样板:品牌 + 分组菜单 + 用户信息 + 设置/
|
|
10
|
-
* 退出操作 + 守卫加载态。样式复用 weifuwu/layout 的 app-shell 原语
|
|
10
|
+
* 退出操作 + 守卫加载态。样式复用 weifuwu/client/layout 的 app-shell 原语
|
|
11
11
|
* (wf-app-shell + wf-sidebar 系列 + wf-main——grid 栅格 + 移动端降级),
|
|
12
12
|
* 组件只补品牌区/用户区细节(AppShell.css)。
|
|
13
13
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** AuthPage:认证页骨架:居中卡片 + logo + 表单插槽 + 错误条 + 提交 loading(登录/注册复用)(showcase /components/authpage) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — AuthPage
|
|
3
|
+
* weifuwu/client/components — AuthPage
|
|
4
4
|
*
|
|
5
5
|
* 认证页骨架(登录/注册复用——agent-platform Login/Register 抽取)。
|
|
6
6
|
* 布局:居中卡片 + logo + 标题/副标题 + 表单插槽 + 错误条 + 提交 loading + 底部链接。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** AutoComplete:输入联想:自由输入 + 过滤下拉 + 键盘流 + 选中回填(showcase /components/autocomplete) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — AutoComplete 输入联想
|
|
3
|
+
* weifuwu/client/components — AutoComplete 输入联想
|
|
4
4
|
*
|
|
5
5
|
* 三库等价:antd AutoComplete / EP Autocomplete / shadcn Combobox(输入侧)。
|
|
6
6
|
* 自由输入 + 实时联想下拉:包含匹配(不区分大小写)、键盘 ↓↑/Enter/Escape、
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
/** Button:4 variants × 3 sizes + loading + block + disabled(showcase /components/button) */
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* weifuwu/client/components — Button
|
|
4
|
+
*
|
|
5
|
+
* 2027-09 W3:状态类(variant/size/block/loading)+ aria-busy → createComponent
|
|
6
|
+
* 声明(BEM 直拼单源)——render 只写结构/内容/事件(皮)。
|
|
7
|
+
*/
|
|
8
|
+
import type { VNodeChild } from '../../vdom/index.ts';
|
|
3
9
|
export interface ButtonProps {
|
|
4
10
|
variant?: 'primary' | 'secondary' | 'ghost' | 'danger' | 'danger-ghost';
|
|
5
11
|
size?: 'sm' | 'md' | 'lg';
|
|
@@ -17,4 +23,4 @@ export interface ButtonProps {
|
|
|
17
23
|
onClick?: (e: MouseEvent) => void;
|
|
18
24
|
children?: VNodeChild;
|
|
19
25
|
}
|
|
20
|
-
export declare const Button: Component<ButtonProps>;
|
|
26
|
+
export declare const Button: import("../../vdom/index.ts").Component<ButtonProps>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Chart:SVG 图表:line/bar/pie/radar/gauge/scatter——零依赖自绘(showcase /components/chart) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — Chart
|
|
3
|
+
* weifuwu/client/components — Chart
|
|
4
4
|
*/
|
|
5
5
|
import type { Component } from '../../vdom/index.ts';
|
|
6
6
|
import type { DataPoint, ChartType, ChartOptions } from './chart-utils.ts';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** ChatInput:独立聊天输入条(AiChat 抽取):单行/多行 + streaming 停止 + IME 安全——不自带聊天逻辑(showcase /components/chatinput) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — ChatInput
|
|
3
|
+
* weifuwu/client/components — ChatInput
|
|
4
4
|
*
|
|
5
5
|
* 独立复用的聊天输入条(从 AiChat 抽取——消 AiChat 内置 + 消费方手搓双重复)。
|
|
6
6
|
* 纯输入层:不自带聊天逻辑(useChat 组合在消费方——AiChat 传入 chat handle,
|
|
@@ -44,6 +44,8 @@ export interface ChatInputProps {
|
|
|
44
44
|
multiline?: boolean;
|
|
45
45
|
/** 标签(i18n 覆盖) */
|
|
46
46
|
labels?: Partial<ChatInputLabels>;
|
|
47
|
+
/** 占位文案(缺省 labels.placeholder) */
|
|
48
|
+
placeholder?: string;
|
|
47
49
|
/** 扩展位(附件/知识库/模型选择等) */
|
|
48
50
|
actions?: VNode | null;
|
|
49
51
|
/** 外部程序化控制(@ 补全等场景)——mount 期回调上抛稳定 handle({ setKeyword, setValue })——
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** CronPicker:cron 表达式快捷输入(预置常见 + 自由编辑)(showcase /components/cronpicker) */
|
|
2
2
|
import type { Component } from '../../vdom/index.ts';
|
|
3
3
|
/**
|
|
4
|
-
* weifuwu/components — CronPicker
|
|
4
|
+
* weifuwu/client/components — CronPicker
|
|
5
5
|
*
|
|
6
6
|
* cron 表达式输入原语:预置语义 + 自由编辑双通道。
|
|
7
7
|
* - 预置面:常见档(每分钟/每 5 分钟/每小时/每天/工作日——单源 PRESETS)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** DatePicker:日期选择器,四种模式:date/datetime/time/range(showcase /components/datepicker) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — DatePicker
|
|
3
|
+
* weifuwu/client/components — DatePicker
|
|
4
4
|
*
|
|
5
5
|
* 四合一日期选择器,支持 mode: date | datetime | time | range
|
|
6
6
|
* 统一 openPopup 内核:focus 触发 + mask 遮罩 + 自由定位(left 对齐 + width 跟随 trigger)。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Descriptions:描述列表:label/value 栅格 + bordered + span(详情页)(showcase /components/descriptions) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — Descriptions
|
|
3
|
+
* weifuwu/client/components — Descriptions
|
|
4
4
|
*
|
|
5
5
|
* 详情字段展示:label/value 栅格(<dl> 语义结构,屏幕阅读器友好)。
|
|
6
6
|
* 用于 Agent 配置展示、实体详情、订单信息等只读字段场景。
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/** Drawer:侧边面板,左右滑入 + ESC 关闭(showcase /components/drawer) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — Drawer
|
|
3
|
+
* weifuwu/client/components — Drawer
|
|
4
|
+
*
|
|
5
|
+
* 2027-09 原语全面化 W1:行为面(openPopup 生命周期/焦点 trap/滚动锁/Esc/
|
|
6
|
+
* 遮罩点击)→ useOverlay 契约——组件只写皮(overlay/panel/关闭钮/header/footer)。
|
|
4
7
|
*/
|
|
5
8
|
import type { Component, VNodeChild } from '../../vdom/index.ts';
|
|
6
9
|
export type DrawerPosition = 'left' | 'right';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** DropZone:全区域拖放区——整容器拖入文件高亮 + onFiles 回调(现代 IM 标配——Chat 手搓证据)(showcase /components/dropzone) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — DropZone 全区域拖放区
|
|
3
|
+
* weifuwu/client/components — DropZone 全区域拖放区
|
|
4
4
|
*
|
|
5
5
|
* 整容器拖放目标:文件拖入指定区域任意位置(含悬停子元素)即高亮 + drop 回调
|
|
6
6
|
* ——「现代 IM 标配」手搓实证 agent-platform Chat
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Dropdown:下拉菜单,支持 danger variant(showcase /components/dropdown) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — Dropdown
|
|
3
|
+
* weifuwu/client/components — Dropdown
|
|
4
4
|
*
|
|
5
5
|
* openPopup 内核:click 触发 + 受控 open + 外部点击/Escape(document 级,
|
|
6
6
|
* 弹层在 portal 中按 Escape 也能关)+ 定位/视口 clamp + portal。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Editor:富文本编辑器,contentEditable + toolbar,零依赖(showcase /components/editor) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components/Editor — 富文本编辑器(事件流事务层,阶段 1)
|
|
3
|
+
* weifuwu/client/components/Editor — 富文本编辑器(事件流事务层,阶段 1)
|
|
4
4
|
*
|
|
5
5
|
* 架构():文档 = fold(edit 事件流)。
|
|
6
6
|
* - 模型真相:DocState(contentEditable DOM 是渲染)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Editor:富文本编辑器,contentEditable + toolbar,零依赖(showcase /components/editor) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components/Editor/edit-events — 编辑事件流(第四端)
|
|
3
|
+
* weifuwu/client/components/Editor/edit-events — 编辑事件流(第四端)
|
|
4
4
|
*
|
|
5
5
|
* 与 ai/sandbox 事件流同构( / sandbox-events-plan.md):
|
|
6
6
|
* 环形缓冲 + 查询(按动作过滤)+ 订阅 + 全局调试工具。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Editor:富文本编辑器,contentEditable + toolbar,零依赖(showcase /components/editor) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components/Editor/model/apply — 事件应用(文档 = fold(事件流))
|
|
3
|
+
* weifuwu/client/components/Editor/model/apply — 事件应用(文档 = fold(事件流))
|
|
4
4
|
*
|
|
5
5
|
* applyEdit(doc, ev) 纯函数:任意事件 → 新 DocState(不可变)。
|
|
6
6
|
* 所有 offset 平移在单一入口维护(marks/blockProps/embeds/caret 同步——
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Editor:富文本编辑器,contentEditable + toolbar,零依赖(showcase /components/editor) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components/Editor/model/diff — 文本 diff(AI 建议对比用)
|
|
3
|
+
* weifuwu/client/components/Editor/model/diff — 文本 diff(AI 建议对比用)
|
|
4
4
|
*
|
|
5
5
|
* 零依赖:公共前缀/后缀剪枝 + 中间 LCS(滚动数组 O(m) 空间)。
|
|
6
6
|
* 裁剪:总长度超 DIFF_MAX_LEN 退化为整体替换(诚实裁剪——大文本不追求
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Editor:富文本编辑器,contentEditable + toolbar,零依赖(showcase /components/editor) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components/Editor/model/dom — offset ↔ DOM 桥
|
|
3
|
+
* weifuwu/client/components/Editor/model/dom — offset ↔ DOM 桥
|
|
4
4
|
*
|
|
5
5
|
* doc.text 的 offset 与 contentEditable DOM 的双向映射:
|
|
6
6
|
* - 文本节点:按 nodeValue.length 累加
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Editor:富文本编辑器,contentEditable + toolbar,零依赖(showcase /components/editor) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components/Editor/model/history — undo/redo 栈(commit 粒度)
|
|
3
|
+
* weifuwu/client/components/Editor/model/history — undo/redo 栈(commit 粒度)
|
|
4
4
|
*
|
|
5
5
|
* 撤销粒度 = commit 粒度(AI 流式接受 = 1 个 commit = 1 个撤销步)。
|
|
6
6
|
* 栈本身只存事件——状态折叠由调用方(Editor 层)执行 applyEdit。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Editor:富文本编辑器,contentEditable + toolbar,零依赖(showcase /components/editor) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components/Editor/model/html — HTML ⇄ DocState 序列化
|
|
3
|
+
* weifuwu/client/components/Editor/model/html — HTML ⇄ DocState 序列化
|
|
4
4
|
*
|
|
5
5
|
* 只认 Editor 格式子集(诚实裁剪):p/div/h1-3/blockquote/ul/ol(块)、
|
|
6
6
|
* b/strong/i/em/u/a(内联)、img/table/hr(embed 快照——内部不解析)、
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Editor:富文本编辑器,contentEditable + toolbar,零依赖(showcase /components/editor) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components/Editor/model/inverse — 事件逆操作(undo 基元)
|
|
3
|
+
* weifuwu/client/components/Editor/model/inverse — 事件逆操作(undo 基元)
|
|
4
4
|
*
|
|
5
5
|
* 任意事件 → 逆事件(与 vdom3 events.ts inverse() 同构)。不变量:
|
|
6
6
|
* applyEdit(applyEdit(doc, ev), inverseEdit(ev)) === doc。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Editor:富文本编辑器,contentEditable + toolbar,零依赖(showcase /components/editor) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components/Editor/model — 文档模型(事件流底座)
|
|
3
|
+
* weifuwu/client/components/Editor/model — 文档模型(事件流底座)
|
|
4
4
|
*
|
|
5
5
|
* 核心不变量():文档状态 = fold(edit 事件流)。
|
|
6
6
|
* 本文档模型是纯 TS 数据结构 + 纯函数(无 DOM、无 UI)——阶段 0 验收:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Editor:富文本编辑器,contentEditable + toolbar,零依赖(showcase /components/editor) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components/Editor/tools — 工具栏渲染
|
|
3
|
+
* weifuwu/client/components/Editor/tools — 工具栏渲染
|
|
4
4
|
*/
|
|
5
5
|
import type { VNode } from '../../../vdom/index.ts';
|
|
6
6
|
import type { FormatState, ToolbarItem } from './types.ts';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Editor:富文本编辑器,contentEditable + toolbar,零依赖(showcase /components/editor) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components/Editor/tools — 类型定义
|
|
3
|
+
* weifuwu/client/components/Editor/tools — 类型定义
|
|
4
4
|
*/
|
|
5
5
|
export type ToolbarItem = 'bold' | 'italic' | 'underline' | 'h1' | 'h2' | 'h3' | 'ul' | 'ol' | 'blockquote' | 'alignLeft' | 'alignCenter' | 'alignRight' | 'hr' | 'image' | 'table' | 'link' | 'clear' | 'source';
|
|
6
6
|
export interface EditorProps {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** FilePreview:文件预览(md/html/pdf/office)——基于事件流,可编辑(showcase /components/filepreview) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components/FilePreview — 文件预览(office/pdf/md/html/text)
|
|
3
|
+
* weifuwu/client/components/FilePreview — 文件预览(office/pdf/md/html/text)
|
|
4
4
|
*
|
|
5
5
|
* 架构( —— ODES 事件流底座):
|
|
6
6
|
* - md 预览:复用 `<Markdown>` 组件(安全 token 渲染——表格/任务列表/URL 白名单)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** FilePreview:文件预览(md/html/pdf/office)——基于事件流,可编辑(showcase /components/filepreview) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components/FilePreview/markdown — Markdown 转换(编辑桥)
|
|
3
|
+
* weifuwu/client/components/FilePreview/markdown — Markdown 转换(编辑桥)
|
|
4
4
|
*
|
|
5
5
|
* 复用现有 Markdown 组件(src/components/Markdown/parser.ts——安全子集 token 树:
|
|
6
6
|
* 表格/任务列表/删除线/安全 URL 白名单——不重复造轮子)。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** FileUpload:文件上传,拖拽区 + 文件列表 + accept/maxSize(showcase /components/fileupload) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — FileUpload
|
|
3
|
+
* weifuwu/client/components — FileUpload
|
|
4
4
|
*/
|
|
5
5
|
import type { Component, VNodeChild } from '../../vdom/index.ts';
|
|
6
6
|
export interface FileUploadProps {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Grid:24 栅格 + gutter + flex 容器模式(Row/Col/Flex 等价)(showcase /components/grid) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — Grid 栅格 + Flex 容器
|
|
3
|
+
* weifuwu/client/components — Grid 栅格 + Flex 容器
|
|
4
4
|
*
|
|
5
5
|
* 三库等价:antd Row/Col/Flex、EP Row/Col。
|
|
6
6
|
* 24 栅格 + gutter + flex 容器模式(单行弹性布局 = antd Flex 场景):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** HoverCard:悬停富内容卡:openDelay 延迟 + 任意 VNode(shadcn)(showcase /components/hovercard) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — HoverCard
|
|
3
|
+
* weifuwu/client/components — HoverCard
|
|
4
4
|
*
|
|
5
5
|
* 命令式弹窗(一个形态——ctx.ui.openPopup——toast 心智):hover 触发
|
|
6
6
|
* (触屏自动降级 tap)+ openDelay/closeDelay + 定位/视口 clamp + Escape。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Icon:stroke SVG 图标集,currentColor 着色,随字号缩放(showcase /components/icon) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — Icon 内联 SVG 图标
|
|
3
|
+
* weifuwu/client/components — Icon 内联 SVG 图标
|
|
4
4
|
*
|
|
5
5
|
* 24px stroke 风格(feather-like),currentColor 着色随文字/上下文,
|
|
6
6
|
* 零外部依赖(FS-05)。组件内部图标统一走这里,替换文本字形/emoji。
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
/** Input:text/email/password/number,支持 label/error/hint/required(showcase /components/input) */
|
|
2
|
+
/**
|
|
3
|
+
* weifuwu/client/components — Input
|
|
4
|
+
*
|
|
5
|
+
* 2027-09 W5:label/required/error/hint 块 + aria 连接(aria-invalid/
|
|
6
|
+
* aria-describedby/aria-required/label for)→ useField 契约——组件只写输入面。
|
|
7
|
+
*/
|
|
2
8
|
import type { Component } from '../../vdom/index.ts';
|
|
3
9
|
export interface InputProps {
|
|
4
10
|
label?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** InputNumber:数字输入:min/max/step + 增减按钮 + precision(showcase /components/inputnumber) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — InputNumber
|
|
3
|
+
* weifuwu/client/components — InputNumber
|
|
4
4
|
*
|
|
5
5
|
* 数字输入:min/max/step + 增减按钮 + precision 格式化 + 长按连增。
|
|
6
6
|
* 受控 value: number | null;空值 → null;输入 clamp 到 min/max。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** JSONViewer:结构化 JSON:递归折叠 + 类型色 + 路径复制 + 懒展开(showcase /components/jsonviewer) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — JSONViewer
|
|
3
|
+
* weifuwu/client/components — JSONViewer
|
|
4
4
|
*
|
|
5
5
|
* 结构化 JSON 浏览(工具调用 args / API 响应):递归树 + 折叠 + 类型色 + 路径复制 + 懒展开。
|
|
6
6
|
* 零依赖(无 raw JSON.parse 展示——VNode 渲染天然转义)。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Layout:布局外壳:Sider 折叠 + Header/Content/Footer 骨架(antd Layout / shadcn Sidebar 等价)(showcase /components/layout) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — Layout 布局外壳
|
|
3
|
+
* weifuwu/client/components — Layout 布局外壳
|
|
4
4
|
*
|
|
5
5
|
* 三库等价:antd Layout / Element Plus Container / shadcn Sidebar。
|
|
6
6
|
* 复合子组件模式(无命名空间——独立导出):
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/** ListScaffold:列表页骨架(PageHeader + 工具栏 + loading/empty + 内容插槽)(showcase /components/
|
|
1
|
+
/** ListScaffold:列表页骨架(PageHeader + 工具栏 + loading/empty + 内容插槽)(showcase /components/listscaffold) */
|
|
2
2
|
import type { Component, VNodeChild } from '../../vdom/index.ts';
|
|
3
3
|
/**
|
|
4
|
-
* weifuwu/components — ListScaffold
|
|
4
|
+
* weifuwu/client/components — ListScaffold
|
|
5
5
|
*
|
|
6
6
|
* 列表页骨架原语:PageHeader + 搜索/工具区 + loading/empty 态 + 内容插槽。
|
|
7
7
|
* 各页面差异在内容循环(render 插槽)——头部/状态区单点一致。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** LogViewer:日志流:ANSI 着色 + 虚拟滚动 + 自动跟随 + 复制(showcase /components/logviewer) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — LogViewer
|
|
3
|
+
* weifuwu/client/components — LogViewer
|
|
4
4
|
*
|
|
5
5
|
* 日志流查看器(Agent 执行日志 / CI 输出):ANSI 着色 + 虚拟滚动 + 自动跟随。
|
|
6
6
|
* 复用 VirtualList 滚动基座(useScrollPosition + rAF 节流)。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Markdown:AI 回复渲染:安全子集 parser + 代码块 + 链接白名单(showcase /components/markdown) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — Markdown 安全子集 parser
|
|
3
|
+
* weifuwu/client/components — Markdown 安全子集 parser
|
|
4
4
|
*
|
|
5
5
|
* 零依赖自研解析器,输出结构化 token(非 HTML 字符串)——
|
|
6
6
|
* 组件层以 VNode 渲染,天然转义任何用户/AI 内容(无 innerHTML 注入面)。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** MessageBubble:消息气泡:user/assistant + streaming/error 状态 + actions(showcase /components/messagebubble) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — MessageBubble
|
|
3
|
+
* weifuwu/client/components — MessageBubble
|
|
4
4
|
*
|
|
5
5
|
* 独立消息气泡(从 AiChat 气泡层抽取,业务聊天页复用)。
|
|
6
6
|
* 复用 layout 的 wf-bubble 原语:user → --own,assistant → --ai。
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/** Modal:自定义宽度 + closable 控制关闭按钮(showcase /components/modal) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — Modal
|
|
3
|
+
* weifuwu/client/components — Modal
|
|
4
|
+
*
|
|
5
|
+
* 行为面(2027-09 分层抽象 W2):openPopup 生命周期/焦点 trap/滚动锁/Esc/
|
|
6
|
+
* 遮罩点击 → useOverlay 契约(手搓面消除——行为正确性结构性保证)。
|
|
7
|
+
* 组件只写皮:overlay(遮罩)+ content(面板)+ 关闭按钮/标题/footer。
|
|
4
8
|
*/
|
|
5
9
|
import type { Component, VNodeChild } from '../../vdom/index.ts';
|
|
6
10
|
export interface ModalProps {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** NavBar:移动端顶栏——left 槽(返回/菜单)+ 标题截断 + right 槽(antd-mobile NavBar 对位)(showcase /components/navbar) */
|
|
2
2
|
/**
|
|
3
|
-
* weifuwu/components — NavBar 移动端顶栏(antd-mobile NavBar / MUI AppBar 对位)
|
|
3
|
+
* weifuwu/client/components — NavBar 移动端顶栏(antd-mobile NavBar / MUI AppBar 对位)
|
|
4
4
|
*
|
|
5
5
|
* 移动端 App 应用外壳顶栏:left 槽(返回/菜单按钮)+ 标题(单行截断)+ right 槽
|
|
6
6
|
* (操作按钮)——消费侧手搓实证 agent-platform `ap-topbar`
|