weifuwu 0.78.0 → 0.79.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/components/AlertGroup/AlertGroup.d.ts +1 -1
- package/dist/components/Anchor/Anchor.d.ts +1 -1
- package/dist/components/AuthPage/AuthPage.d.ts +36 -0
- package/dist/components/AutoComplete/AutoComplete.d.ts +3 -1
- package/dist/components/AvatarGroup/AvatarGroup.d.ts +1 -1
- package/dist/components/Calendar/Calendar.d.ts +1 -1
- package/dist/components/Carousel/Carousel.d.ts +1 -1
- package/dist/components/Cascader/Cascader.d.ts +1 -1
- package/dist/components/ChatInput/ChatInput.d.ts +51 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +2 -0
- package/dist/components/FloatButton/FloatButton.d.ts +1 -1
- package/dist/components/Grid/Grid.d.ts +1 -1
- package/dist/components/InputNumber/InputNumber.d.ts +1 -1
- package/dist/components/JSONViewer/JSONViewer.d.ts +1 -1
- package/dist/components/Link/Link.d.ts +1 -1
- package/dist/components/LogViewer/LogViewer.d.ts +1 -1
- package/dist/components/Markdown/parser.d.ts +1 -1
- package/dist/components/Mentions/Mentions.d.ts +1 -1
- package/dist/components/Menu/Menu.d.ts +1 -1
- package/dist/components/Menubar/Menubar.d.ts +1 -1
- package/dist/components/MessageBubble/MessageBubble.d.ts +1 -1
- package/dist/components/NavMenu/NavMenu.d.ts +1 -1
- package/dist/components/Popconfirm/Popconfirm.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 -0
- package/dist/components/Slider/Slider.d.ts +1 -0
- package/dist/components/TagsInput/TagsInput.d.ts +1 -1
- package/dist/components/Timeline/Timeline.d.ts +1 -1
- package/dist/components/Transfer/Transfer.d.ts +1 -1
- package/dist/components/TreeSelect/TreeSelect.d.ts +2 -0
- package/dist/components/VirtualList/VirtualList.d.ts +3 -1
- package/dist/components/VirtualTable/VirtualTable.d.ts +1 -1
- package/dist/components/Watermark/Watermark.d.ts +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.js +12 -12
- package/dist/components/style.css +77 -23
- package/dist/index.js +21 -3
- package/dist/ui-dom/index.js +11 -11
- package/dist/ui-dom/jsx-runtime.js +1 -1
- package/dist/ui-dom/testing.js +1 -1
- package/dist/ui-dom/vdom/diff.d.ts +2 -6
- package/dist/ui-dom/vdom/render.d.ts +2 -2
- package/dist/ui-dom/vdom/transform.d.ts +16 -1
- package/dist/ui-dom/vnode.d.ts +5 -1
- package/docs/components-map.md +3 -1
- package/docs/components.md +6 -3
- package/package.json +1 -1
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* 三态 skip:props 同 + 无 dirty + ctx 版本同 → 复用旧 _child(renderFn 不重跑)。
|
|
9
9
|
*/
|
|
10
10
|
import type { VNodeChild } from '../vnode.ts';
|
|
11
|
-
import {
|
|
12
|
-
export {
|
|
11
|
+
import { arrayChildren } from '../vnode.ts';
|
|
12
|
+
export { arrayChildren };
|
|
13
13
|
export interface PatchCtx {
|
|
14
14
|
browser: any;
|
|
15
15
|
registry: import('./registry.ts').Registry;
|
|
@@ -26,8 +26,4 @@ export interface PatchCtx {
|
|
|
26
26
|
export declare function patchValue(parent: Node, oldNode: Node | null, oldInput: VNodeChild, newInput: VNodeChild, ctx: PatchCtx): Node | null;
|
|
27
27
|
/** 属性 patch(只设不删语义保持简单;差异删除由 diff 上层处理) */
|
|
28
28
|
export declare function patchProps(el: Element, oldProps: Record<string, any>, newProps: Record<string, any>): void;
|
|
29
|
-
/**
|
|
30
|
-
* patchChildren — 数组 diff。
|
|
31
|
-
* @returns 每个新子项的 DOM 范围(Fragment 展开对齐)
|
|
32
|
-
*/
|
|
33
29
|
export declare function patchChildren(parent: Node, oldInput: VNodeChild | null | undefined, newInput: VNodeChild | null | undefined, ctx: PatchCtx, oldRange?: Node[], oldAnchors?: (Node | null)[], anchorOut?: (Node | null)[]): (Node | null)[];
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { VNodeChild } from '../vnode.ts';
|
|
9
9
|
import type { BrowserEnv } from '../types.ts';
|
|
10
|
-
export { EVENT_RE, eventTarget, ENUMERATED_VALUE_BASED, holeDetail } from './transform.ts';
|
|
10
|
+
export { EVENT_RE, eventTarget, ENUMERATED_VALUE_BASED, holeDetail, holeMarkup } from './transform.ts';
|
|
11
11
|
export declare const SVG_TAGS: Set<string>;
|
|
12
12
|
export declare function setProp(el: Element, key: string, value: any): void;
|
|
13
13
|
/** 占位内容(规则表 §1——wf-hole 内容可见可审计:false/null/undefined/true/对象摘要/bad-vnode) */
|
|
14
14
|
/** 创建占位节点(数组上下文的无渲染值 → 注释节点,childNodes 与数组同构——规则表 §1) */
|
|
15
15
|
export declare function createHole(browser: BrowserEnv, v: unknown): Node | null;
|
|
16
16
|
/** 递归渲染(同步——组件必须已构建) */
|
|
17
|
-
export declare function renderValue(v: VNodeChild, ctx: any, browser?: BrowserEnv): Node | null;
|
|
17
|
+
export declare function renderValue(v: VNodeChild, ctx: any, browser?: BrowserEnv, key?: string | null, id?: string | null, fid?: string | null): Node | null;
|
|
@@ -6,8 +6,23 @@
|
|
|
6
6
|
* hydrateVNode 全部调用,禁止各路径各自实现形态判定(同一语义多套实现 = 漂移 = 转化分叉)。
|
|
7
7
|
*/
|
|
8
8
|
import type { VNodeChild } from '../vnode.ts';
|
|
9
|
-
/**
|
|
9
|
+
/** wf-hole 值摘要(占位内容可见可审计:false/null/undefined/true/对象摘要/bad-vnode) */
|
|
10
10
|
export declare function holeDetail(v: unknown): string;
|
|
11
|
+
/** 统一 wf-hole 标记(规则表 §1——全部 wf-hole 同一格式,用户直接读 DOM 注释可懂):
|
|
12
|
+
* - 占位 `wf-hole: type=hole value=false key=0 id=_wf_5`
|
|
13
|
+
* - 边界 `wf-hole: type=fragment-start key="0" id="_wf_5"` / `wf-hole: type=fragment-end key="0"`
|
|
14
|
+
* - 诊断 `wf-hole: type=hole value="object {...}"`(value 承载内容)
|
|
15
|
+
* 字段:type 必写(hole/fragment-start/fragment-end);value/key/id 有则写。
|
|
16
|
+
* 前缀恒为 `wf-hole:`——diff/audit/hydrate 的占位判断(startsWith)不随格式演进变化 */
|
|
17
|
+
export declare function holeMarkup(opts: {
|
|
18
|
+
type: string;
|
|
19
|
+
value?: unknown;
|
|
20
|
+
key?: string | null;
|
|
21
|
+
id?: string | null;
|
|
22
|
+
fid?: string;
|
|
23
|
+
}): string;
|
|
24
|
+
/** 解析 wf-hole 注释字段(type/key/depth/id/value——统一格式,单一解析点) */
|
|
25
|
+
export declare function parseHoleMarkup(nodeValue: string): Record<string, string>;
|
|
11
26
|
/** children 项分类(规则表 §1)——唯一判定,消费方只调函数不写判定 */
|
|
12
27
|
export type ChildKind = 'text' | 'hole' | 'native' | 'component' | 'fragment' | 'portal' | 'array' | 'invalid';
|
|
13
28
|
export declare function classifyChild(c: VNodeChild): ChildKind;
|
package/dist/ui-dom/vnode.d.ts
CHANGED
|
@@ -70,7 +70,11 @@ export declare function h(type: VNodeType, props: Record<string, any> | null, ..
|
|
|
70
70
|
export declare function isNative(vnode: VNode): boolean;
|
|
71
71
|
/** 递归文本/数组归一化(children 数组展开——嵌套数组扁平化,DOM 范围对齐)。
|
|
72
72
|
* 栈展开(索引遍历替代 shift/unshift 头部操作——长数组 O(n) 而非 O(n²));逆序入栈 + pop 保持原顺序 */
|
|
73
|
-
|
|
73
|
+
/** children 数组视图(保真用户结构——vnode 任何阶段以用户 JSX 为标准,规则表 §1-20)。
|
|
74
|
+
* 数组原样返回(零拷贝——嵌套数组不展开:数组项 ≡ 隐式 Fragment,渲染/diff 按嵌套递归,
|
|
75
|
+
* key 层级独立 §3-46);非数组包装成单元素数组。替代 v1 normalizeChildren(平铺展开——
|
|
76
|
+
* 消灭层级信息 → 内层/外层下标 key 撞车 → auth 切换字段残留)。 */
|
|
77
|
+
export declare function arrayChildren(c: VNodeChild | undefined | null): VNodeChild[];
|
|
74
78
|
export declare function isComponent(vnode: VNode): boolean;
|
|
75
79
|
export declare function isFragment(vnode: VNode): boolean;
|
|
76
80
|
export declare function isPortal(vnode: VNode): boolean;
|
package/docs/components-map.md
CHANGED
|
@@ -111,6 +111,8 @@
|
|
|
111
111
|
| 组件 | 说明 |
|
|
112
112
|
|------|------|
|
|
113
113
|
| `<AiChat>` | 完整 AI 对话界面(流式 token/工具卡/审批卡/自动滚动),配 `ctx.ui.useChat()`;移动端 `raiseOnKeyboard` |
|
|
114
|
+
| `<ChatInput>` | 独立聊天输入条(AiChat 抽取):单行/多行 + streaming 停止 + IME 安全——纯输入层(useChat 组合在消费方) |
|
|
115
|
+
| `<AuthPage>` | 认证页骨架:居中卡片 + logo + 表单插槽 + 错误条 + 提交 loading(登录/注册复用) |
|
|
114
116
|
| `<Markdown content>` | 零依赖安全子集 parser(无 raw HTML 注入,VNode 渲染天然转义) |
|
|
115
117
|
| `<CodeBlock code lang>` | 代码块 + 语言标签 + 复制按钮 |
|
|
116
118
|
| `<MessageBubble role status>` | 聊天气泡(独立复用,AiChat 抽取) |
|
|
@@ -199,7 +201,7 @@
|
|
|
199
201
|
|------|------|---------|------|
|
|
200
202
|
| **Layout**(+LayoutHeader/Sider/Content/Footer) | 新增 | antd Layout / EP Container / shadcn Sidebar | 复合子组件双模式;含 Sider → row 布局;Sider 折叠受控/非受控 + trigger |
|
|
201
203
|
| **Popconfirm** | 新增 | antd / EP Popconfirm | 复用 usePopup 基座(弹层组合性);danger 危险色;确认后自动关闭 |
|
|
202
|
-
| **AutoComplete** | 新增 | antd+EP Autocomplete / shadcn Combobox | 自由输入联想;包含过滤(纯函数);键盘 ↓↑/Enter/Escape
|
|
204
|
+
| **AutoComplete** | 新增 | antd+EP Autocomplete / shadcn Combobox | 自由输入联想;包含过滤(纯函数);键盘 ↓↑/Enter/Escape;选中回填;error 错误态 |
|
|
203
205
|
| **Link** | 新增 | EP Link / antd Typography.Link | 语义色/下划线/disabled/new window/icon |
|
|
204
206
|
| **FloatButton** | 新增 | antd FloatButton(特有) | fixed 定位 + badge + 组展开状态机 |
|
|
205
207
|
| **NavMenu** | 新增 | shadcn NavigationMenu(特有) | 顶部多级 hover 弹出 + 键盘 →/Escape |
|
package/docs/components.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> 本页为 weifuwu 官方文档拆分页 · [返回 README](../README.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
115 个 HTML 原语组件。每个是 `async (initProps, ctx) => (props) => Promise<VNode>`(两阶段组件,与前端框架同一模型——外层工厂 + 内层 renderFn 强制异步),引用 `--wf-*` CSS 变量做主题。另含 `confirm()` / `toast()` 命令式中间件。
|
|
6
6
|
|
|
7
7
|
> **组件速查(weifuwu 组件 ↔ antd / Element Plus / shadcn-ui 对应 + 迁移示例)**:见 [`docs/components-map.md`](components-map.md)——从其他组件库迁来的开发者按功能直接找对应组件。
|
|
8
8
|
> **自定义组件开发**:见 [docs/custom-components.md](custom-components.md)——usePopup/useControlled/对话框/AI 组件/类型纪律逐步指南。
|
|
@@ -301,6 +301,7 @@ props 变化 ──────────────────────
|
|
|
301
301
|
| `onChange` | `(value: string) => void` | — |
|
|
302
302
|
| `placeholder` | `string` | — |
|
|
303
303
|
| `disabled` | `boolean` | — |
|
|
304
|
+
| `error` | `string` | 错误态——输入框错误样式 + aria-invalid(F2 状态矩阵) |
|
|
304
305
|
|
|
305
306
|
### Form(表单增强)
|
|
306
307
|
| Prop | 类型 | 说明 |
|
|
@@ -614,7 +615,7 @@ props 变化 ──────────────────────
|
|
|
614
615
|
| ContextMenu | `ContextMenu` | `items: ContextMenuItem[]`(`{ label, onClick, variant: 'danger' }`) | 右键菜单(光标定位 + 方向键) |
|
|
615
616
|
| Mentions | `Mentions` | `options: { value, label }[]`, `value`, `onChange`, `prefix` | @提及(composition 抑制) |
|
|
616
617
|
| Collapse | `Collapse` | `items: CollapseItem[]`(`{ key, title, content, loading }`), `active`, `multiple` | 行内折叠(异步 loading) |
|
|
617
|
-
| Tree | `Tree` | `data: TreeNode[]`, `expandedKeys`, `checkedKeys`, `checkable`, `selectedKeys`, `onCheck/onExpand/onSelect` | 树(递归 + 勾选父子联动 +
|
|
618
|
+
| Tree | `Tree` | `data: TreeNode[]`, `expandedKeys`, `checkedKeys`, `checkable`, `selectedKeys`, `onCheck/onExpand/onSelect` | 树(递归 + 勾选父子联动 + 半选传播;空数据「暂无数据」) |
|
|
618
619
|
| Cascader | `Cascader` | `options: CascaderOption[]`, `value: string[]`, `onChange` | 级联选择(多列推进) |
|
|
619
620
|
| Transfer | `Transfer` | `data: { key, label }[]`, `targetKeys`, `onChange`, `titles` | 穿梭框(选中 + 批量移动) |
|
|
620
621
|
| Command | `Command` | `items: CommandItem[]`, `open`, `onOpenChange`, `shortcut` | 命令面板(⌘K 全局 + 键盘流) |
|
|
@@ -623,7 +624,7 @@ props 变化 ──────────────────────
|
|
|
623
624
|
| Resizable | `Resizable` | `direction`, `defaultSize`, `min/maxSize` | 拖拽分割面板(pointer + 键盘方向键) |
|
|
624
625
|
| Calendar | `Calendar` | `month`, `year`, `events`, `selectedDate`, `onMonthChange/onSelectDate` | 月历(事件点 + 月切换 + 选日) |
|
|
625
626
|
| Watermark | `Watermark` | `text`, `fontSize`, `rotate`, `zIndex` | 水印(canvas 平铺) |
|
|
626
|
-
| VirtualList | `VirtualList` | `items`, `height`, `itemHeight`, `renderItem`, `overscan` | 虚拟列表(spacer + 可见窗口,1000+
|
|
627
|
+
| VirtualList | `VirtualList` | `items`, `height`, `itemHeight`, `renderItem`, `overscan`, `emptyText` | 虚拟列表(spacer + 可见窗口,1000+ 条;空态占位) |
|
|
627
628
|
| InfiniteScroll | `InfiniteScroll` | `hasMore`, `loadMore`, `children`, `loader` | 触底加载(IntersectionObserver) |
|
|
628
629
|
| QRCode | `QRCode` | `value`, `ecLevel`, `size`, `color`, `bgColor` | 二维码(自研 Reed-Solomon,版本 1-6) |
|
|
629
630
|
|
|
@@ -640,12 +641,14 @@ props 变化 ──────────────────────
|
|
|
640
641
|
| 组件 | 导入名 | 关键 Props | 说明 |
|
|
641
642
|
|-----|--------|-----------|------|
|
|
642
643
|
| Divider | `Divider` | `vertical` | 分割线(水平带文字放 children,`vertical` 垂直) |
|
|
644
|
+
| AuthPage | `AuthPage` | `title`, `subtitle?`, `logo?`, `children`, `footer?`, `submitLabel`, `loading?`, `error?`, `onSubmit?` | 认证页骨架:居中卡片 + logo + 标题/副标题 + 表单插槽 + 错误条 + 提交 loading + 底部链接(登录/注册复用;认证流程/跳转由消费方提供) |
|
|
643
645
|
|
|
644
646
|
### AI 交互原语(wf: 协议配套)
|
|
645
647
|
|
|
646
648
|
| 组件 | 导入名 | 关键 Props | 说明 |
|
|
647
649
|
|-----|--------|-----------|------|
|
|
648
650
|
| AiChat | `AiChat` | `chat`, `maxHeight?`, `labels?`, `renderMessage?`, `renderToolArgs?` | 标准 AI 对话界面:气泡 + 工具卡 + 审批卡 + 自动滚动 + 错误重试(接收 `ctx.ui.useChat()` handle) |
|
|
651
|
+
| ChatInput | `ChatInput` | `value`, `onChange`, `onSend`, `streaming?`, `onStop?`, `error?`, `onRetry?`, `multiline?`, `actions?` | 独立聊天输入条(AiChat 抽取):单行/多行(Enter 发送/Shift+Enter 换行)+ streaming 停止切换 + §5.3 IME 受控输入纪律——纯输入层,聊天逻辑(useChat)由消费方组合 |
|
|
649
652
|
| MessageBubble | `MessageBubble` | `content`, `role`, `status`, `actions` | 独立消息气泡(业务聊天页复用) |
|
|
650
653
|
| ToolCallCard | `ToolCallCard` | `call`, `progress?`, `result?`, `renderArgs?` | 工具调用卡片:running(进度条)/ ok / error 三态(协议 §4) |
|
|
651
654
|
| JsonSchemaForm | `JsonSchemaForm` | `schema`, `value?`, `onChange?`, `onSubmit?`, `submitLabel?` | JSON Schema(对象子集)→ 参数输入表单:类型映射 + required/范围校验 + 嵌套/数组(工具参数输入面;不支持项告警降级) |
|