weifuwu 0.61.2 → 0.63.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 +168 -11
- package/dist/client/diff.d.ts +13 -1
- package/dist/client/index.js +3 -3
- package/dist/client/popup.d.ts +22 -0
- package/dist/client/types.d.ts +63 -0
- package/dist/client/ui.d.ts +6 -0
- package/dist/components/Accordion/Accordion.d.ts +9 -0
- package/dist/components/Affix/Affix.d.ts +16 -0
- package/dist/components/AspectRatio/AspectRatio.d.ts +10 -0
- package/dist/components/AvatarGroup/AvatarGroup.d.ts +21 -0
- package/dist/components/BackTop/BackTop.d.ts +16 -0
- package/dist/components/Calendar/Calendar.d.ts +21 -0
- package/dist/components/Carousel/Carousel.d.ts +17 -0
- package/dist/components/Cascader/Cascader.d.ts +21 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +23 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +14 -0
- package/dist/components/Collapse/Collapse.d.ts +28 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +16 -0
- package/dist/components/Command/Command.d.ts +22 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +17 -0
- package/dist/components/CopyButton/CopyButton.d.ts +18 -0
- package/dist/components/Descriptions/Descriptions.d.ts +21 -0
- package/dist/components/Highlight/Highlight.d.ts +13 -0
- package/dist/components/HoverCard/HoverCard.d.ts +16 -0
- package/dist/components/Icon/Icon.d.ts +1 -1
- package/dist/components/Img/Img.d.ts +4 -0
- package/dist/components/InView/InView.d.ts +1 -1
- package/dist/components/InfiniteScroll/InfiniteScroll.d.ts +15 -0
- package/dist/components/InputNumber/InputNumber.d.ts +25 -0
- package/dist/components/Label/Label.d.ts +11 -0
- package/dist/components/List/List.d.ts +18 -0
- package/dist/components/Markdown/Markdown.d.ts +14 -0
- package/dist/components/Markdown/parser.d.ts +32 -0
- package/dist/components/Mentions/Mentions.d.ts +19 -0
- package/dist/components/Menu/Menu.d.ts +25 -0
- package/dist/components/Menubar/Menubar.d.ts +22 -0
- package/dist/components/MessageBubble/MessageBubble.d.ts +20 -0
- package/dist/components/Notification/Notification.d.ts +70 -0
- package/dist/components/PasswordInput/PasswordInput.d.ts +21 -0
- package/dist/components/PinInput/PinInput.d.ts +18 -0
- package/dist/components/QRCode/QRCode.d.ts +20 -0
- package/dist/components/QRCode/qr.d.ts +15 -0
- package/dist/components/Rate/Rate.d.ts +16 -0
- package/dist/components/Resizable/Resizable.d.ts +18 -0
- package/dist/components/Result/Result.d.ts +17 -0
- package/dist/components/Select/Select.d.ts +4 -2
- package/dist/components/Table/Table.d.ts +10 -0
- package/dist/components/TagsInput/TagsInput.d.ts +21 -0
- package/dist/components/Timeline/Timeline.d.ts +25 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +33 -0
- package/dist/components/Transfer/Transfer.d.ts +18 -0
- package/dist/components/Tree/Tree.d.ts +27 -0
- package/dist/components/Typography/Typography.d.ts +39 -0
- package/dist/components/VirtualList/VirtualList.d.ts +21 -0
- package/dist/components/Watermark/Watermark.d.ts +19 -0
- package/dist/components/index.d.ts +85 -0
- package/dist/components/index.js +14 -1
- package/dist/components/style.css +4824 -2211
- package/dist/db/postgres/connection.d.ts +24 -3
- package/dist/db/postgres/pool.d.ts +30 -8
- package/dist/db/redis/client.d.ts +43 -0
- package/dist/db/redis/connection.d.ts +12 -0
- package/dist/db/redis/pipeline.d.ts +26 -0
- package/dist/db/redis/pool.d.ts +27 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1055 -94
- package/dist/layout/weifuwu-layout.css +11 -1
- package/dist/postgres/types.d.ts +2 -1
- package/dist/redis/types.d.ts +6 -0
- package/dist/scheduler/cron.d.ts +26 -0
- package/dist/scheduler/index.d.ts +69 -0
- package/package.json +2 -4
package/dist/client/types.d.ts
CHANGED
|
@@ -14,6 +14,10 @@ export interface PopupPositionOptions {
|
|
|
14
14
|
left: number;
|
|
15
15
|
width?: number;
|
|
16
16
|
};
|
|
17
|
+
/** 弹层面板元素 getter(可选):提供后坐标自动夹紧到视口内(防超高/超宽时底部按钮不可点) */
|
|
18
|
+
panel?: () => HTMLElement | null;
|
|
19
|
+
/** 视口边缘安全边距(px,默认 8) */
|
|
20
|
+
margin?: number;
|
|
17
21
|
}
|
|
18
22
|
/** 异步取数工具返回值 — ctx.ui.useAsync()(data/loading/error 响应式,reload 重跑) */
|
|
19
23
|
export interface UseAsyncHandle<T = any> {
|
|
@@ -30,6 +34,42 @@ export interface PopupPosition {
|
|
|
30
34
|
/** 立即重算一次坐标(不触发渲染,调用方负责 render) */
|
|
31
35
|
refresh: () => void;
|
|
32
36
|
}
|
|
37
|
+
/** 可见性观察配置 — 供 ctx.ui.useInView 使用(IntersectionObserver 封装,替代 scroll 监听) */
|
|
38
|
+
export interface UseInViewOptions {
|
|
39
|
+
/** IO 根元素 getter(默认视口;滚动容器场景传 target) */
|
|
40
|
+
root?: () => Element | null;
|
|
41
|
+
/** IO rootMargin(支持函数——动态读最新 props,observe 时求值) */
|
|
42
|
+
rootMargin?: string | (() => string);
|
|
43
|
+
/** IO threshold(默认 0;支持函数——动态读最新 props) */
|
|
44
|
+
threshold?: number | number[] | (() => number | number[]);
|
|
45
|
+
/** IO 触发回调(entry.boundingClientRect 读取安全,非 scroll handler) */
|
|
46
|
+
onChange?: (entry: IntersectionObserverEntry, isIn: boolean) => void;
|
|
47
|
+
}
|
|
48
|
+
/** 可见性观察器 — useInView 的返回值 */
|
|
49
|
+
export interface UseInViewHandle {
|
|
50
|
+
/** 是否在可见区(响应式:变化自动 dirty 当前组件) */
|
|
51
|
+
isIn: boolean;
|
|
52
|
+
/** 是否已就绪(首次 IO 回调完成;未就绪时 isIn 为初始 false,组件应保守处理) */
|
|
53
|
+
ready: boolean;
|
|
54
|
+
/** 观察元素(ref 挂载时调用;传 null 断开) */
|
|
55
|
+
observe(el: HTMLElement | null): void;
|
|
56
|
+
/** 重建观察(rootMargin 等配置变化后调用) */
|
|
57
|
+
refresh(): void;
|
|
58
|
+
/** 手动断开观察 */
|
|
59
|
+
disconnect(): void;
|
|
60
|
+
}
|
|
61
|
+
/** 滚动位置跟踪配置 — 供 ctx.ui.useScrollPosition 使用 */
|
|
62
|
+
export interface UseScrollPositionOptions {
|
|
63
|
+
/** 滚动容器 getter(默认 window;内部滚动容器传 ref 元素) */
|
|
64
|
+
getScroller?: () => HTMLElement | Window;
|
|
65
|
+
}
|
|
66
|
+
/** 滚动位置跟踪器 — useScrollPosition 的返回值(y 响应式,变化自动 dirty 当前组件) */
|
|
67
|
+
export interface UseScrollPositionHandle {
|
|
68
|
+
/** 滚动位置(px,scrollY/scrollTop) */
|
|
69
|
+
y: number;
|
|
70
|
+
/** 手动重读一次滚动位置(不触发渲染) */
|
|
71
|
+
refresh(): void;
|
|
72
|
+
}
|
|
33
73
|
/** 应用上下文 */
|
|
34
74
|
export interface WfuiContext {
|
|
35
75
|
[key: string]: unknown;
|
|
@@ -57,6 +97,29 @@ export interface WfuiContext {
|
|
|
57
97
|
useBreakpoint: (bpsOrCallback: Record<string, string> | ((vp: string) => void), callback?: (vp: string) => void) => void;
|
|
58
98
|
/** 弹层位置跟踪:滚动/resize 时自动重算 fixed 坐标 */
|
|
59
99
|
usePopupPosition: (options: PopupPositionOptions) => PopupPosition;
|
|
100
|
+
/**
|
|
101
|
+
* 可见性观察(IntersectionObserver 封装):替代组件自建 scroll 监听。
|
|
102
|
+
* IO 在合成器线程评估,滚动/尺寸变化自动触发,无 scroll-linked 定位警告。
|
|
103
|
+
*
|
|
104
|
+
* ```tsx
|
|
105
|
+
* const inView = ctx.ui.useInView({
|
|
106
|
+
* rootMargin: () => `-${propsRef.offsetTop ?? 0}px 0px 0px 0px`,
|
|
107
|
+
* })
|
|
108
|
+
* const ref = (el) => inView.observe(el)
|
|
109
|
+
* return () => h('div', { ref }, fixed = !inView.isIn ...)
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
useInView: (options: UseInViewOptions) => UseInViewHandle;
|
|
113
|
+
/**
|
|
114
|
+
* 滚动位置跟踪(全局 scroll 监听 + rAF 节流,仿 usePopupPosition):
|
|
115
|
+
* 返回响应式 scrollY/scrollTop,变化自动 dirty 当前组件。替代组件自建 scroll 监听。
|
|
116
|
+
*
|
|
117
|
+
* ```tsx
|
|
118
|
+
* const scroll = ctx.ui.useScrollPosition({ getScroller: () => wrapEl })
|
|
119
|
+
* return () => h('div', { ref }, fixed = scroll.y >= threshold)
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
useScrollPosition: (options: UseScrollPositionOptions) => UseScrollPositionHandle;
|
|
60
123
|
/**
|
|
61
124
|
* 异步取数工具(mount 阶段调用):loading/error 自动管理 + 数据就绪自动渲染。
|
|
62
125
|
*
|
package/dist/client/ui.d.ts
CHANGED
|
@@ -46,6 +46,12 @@ export interface UiDeps {
|
|
|
46
46
|
width?: number;
|
|
47
47
|
};
|
|
48
48
|
}>;
|
|
49
|
+
scrollTrackers: Map<string, {
|
|
50
|
+
handle: {
|
|
51
|
+
y: number;
|
|
52
|
+
};
|
|
53
|
+
getScroller: () => HTMLElement | Window;
|
|
54
|
+
}>;
|
|
49
55
|
schedulePopupRecompute: () => void;
|
|
50
56
|
/** 惰性挂载全局 scroll/resize 监听(幂等) */
|
|
51
57
|
ensurePopupListeners: () => void;
|
|
@@ -3,9 +3,18 @@ export interface AccordionItem {
|
|
|
3
3
|
key: string;
|
|
4
4
|
title: string;
|
|
5
5
|
content?: any;
|
|
6
|
+
disabled?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export interface AccordionProps {
|
|
8
9
|
items?: AccordionItem[];
|
|
10
|
+
/** 受控展开 keys */
|
|
11
|
+
active?: string[];
|
|
12
|
+
onChange?: (keys: string[]) => void;
|
|
13
|
+
/** true = 多开;默认 false 手风琴互斥(antd 对齐) */
|
|
9
14
|
multiple?: boolean;
|
|
10
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* 手风琴折叠面板(对应 antd/EP Collapse 卡片面板语义):受控 active + 点击切换 +
|
|
18
|
+
* 方向键移动焦点 + aria-expanded 同步。与 Collapse 边界:Accordion = 整块卡片面板容器。
|
|
19
|
+
*/
|
|
11
20
|
export declare const Accordion: Component<AccordionProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Component } from '../../client/vnode.ts';
|
|
2
|
+
export interface AffixProps {
|
|
3
|
+
/** 距视口顶部偏移,滚动超过该值后固定(px),默认 0 */
|
|
4
|
+
offsetTop?: number;
|
|
5
|
+
/** 滚动容器(默认 window) */
|
|
6
|
+
target?: () => HTMLElement | Window;
|
|
7
|
+
children?: any;
|
|
8
|
+
className?: string;
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}
|
|
11
|
+
/** 固定定位(对应 antd/EP Affix):滚动超过阈值后固定元素,保持占位与宽度
|
|
12
|
+
* 实现:ctx.ui.useScrollPosition(全局 scroll 监听 + rAF 节流,内置方案)——
|
|
13
|
+
* mount 时算一次阈值(sentinel 文档位置 - offsetTop),滚动位置响应式驱动 fixed 判定。
|
|
14
|
+
* 不用 IO:IO 只在交叉状态变化时回调,瞬间滚动后 sentinel 从视口外下方到视口外上方
|
|
15
|
+
* isIntersecting 都是 false → 不回调(Affix 需要连续位置跟踪,IO 语义不匹配)。 */
|
|
16
|
+
export declare const Affix: Component<AffixProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Component } from '../../client/vnode.ts';
|
|
2
|
+
export interface AspectRatioProps {
|
|
3
|
+
/** 宽/高比,默认 16/9 */
|
|
4
|
+
ratio?: number;
|
|
5
|
+
children?: any;
|
|
6
|
+
className?: string;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
/** 宽高比容器(对应 shadcn AspectRatio):内容绝对定位填满,适合图片/视频/嵌入内容 */
|
|
10
|
+
export declare const AspectRatio: Component<AspectRatioProps>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* weifuwu/components — AvatarGroup
|
|
3
|
+
*
|
|
4
|
+
* 堆叠头像组(负 margin 重叠)+ max 溢出显示 +N。
|
|
5
|
+
* 用于群聊成员、协作人列表。
|
|
6
|
+
* 裁剪:不做 hover 展开 tooltip(见 roadmap)。
|
|
7
|
+
*/
|
|
8
|
+
import type { Component } from '../../client/vnode.ts';
|
|
9
|
+
import { type AvatarProps } from '../Avatar/Avatar.ts';
|
|
10
|
+
export interface AvatarGroupItem {
|
|
11
|
+
name?: string;
|
|
12
|
+
src?: string;
|
|
13
|
+
color?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface AvatarGroupProps {
|
|
16
|
+
items: AvatarGroupItem[];
|
|
17
|
+
max?: number;
|
|
18
|
+
size?: AvatarProps['size'];
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const AvatarGroup: Component<AvatarGroupProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Component } from '../../client/vnode.ts';
|
|
2
|
+
export interface BackTopProps {
|
|
3
|
+
/** 滚动超过此高度显示(px),默认 400 */
|
|
4
|
+
visibilityHeight?: number;
|
|
5
|
+
/** 滚动容器(默认 window) */
|
|
6
|
+
target?: () => HTMLElement | Window;
|
|
7
|
+
/** 平滑滚动,默认 true */
|
|
8
|
+
smooth?: boolean;
|
|
9
|
+
'aria-label'?: string;
|
|
10
|
+
children?: any;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/** 回到顶部(对应 EP Backtop / antd FloatButton.BackTop):滚动超阈值显示,点击回顶
|
|
14
|
+
* 实现:ctx.ui.useInView(IO 封装)观察文档顶部哨兵——rootMargin 顶部向外扩展
|
|
15
|
+
* visibilityHeight,哨兵离开扩展区(= 滚动超阈值)→ 显示。无 scroll 监听、无警告。 */
|
|
16
|
+
export declare const BackTop: Component<BackTopProps>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Component } from '../../client/vnode.ts';
|
|
2
|
+
export interface CalendarEvent {
|
|
3
|
+
key: string;
|
|
4
|
+
/** 日期 'YYYY-MM-DD' */
|
|
5
|
+
date: string;
|
|
6
|
+
title: string;
|
|
7
|
+
color?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CalendarProps {
|
|
10
|
+
events?: CalendarEvent[];
|
|
11
|
+
/** 受控年月:month 0-11,year 四位数 */
|
|
12
|
+
month?: number;
|
|
13
|
+
year?: number;
|
|
14
|
+
onMonthChange?: (month: number, year: number) => void;
|
|
15
|
+
onSelectDate?: (date: string) => void;
|
|
16
|
+
selectedDate?: string;
|
|
17
|
+
'aria-label'?: string;
|
|
18
|
+
}
|
|
19
|
+
/** 月历(对应 antd/EP Calendar):月视图网格 + 事件点 + 月切换 + 日期选择。
|
|
20
|
+
* 裁剪:周/日视图、拖拽创建事件、事件详情弹层。 */
|
|
21
|
+
export declare const Calendar: Component<CalendarProps>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Component } from '../../client/vnode.ts';
|
|
2
|
+
export interface CarouselProps {
|
|
3
|
+
children: any[];
|
|
4
|
+
/** 自动播放 */
|
|
5
|
+
autoplay?: boolean;
|
|
6
|
+
/** 自动播放间隔(ms),默认 3000 */
|
|
7
|
+
interval?: number;
|
|
8
|
+
showArrows?: boolean;
|
|
9
|
+
showDots?: boolean;
|
|
10
|
+
/** 循环播放(尾 → 头),默认 true */
|
|
11
|
+
loop?: boolean;
|
|
12
|
+
'aria-label'?: string;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/** 轮播(对应 antd/EP/shadcn Carousel):横向滑动 + 箭头/圆点 + 自动播放 + 触摸滑动。
|
|
16
|
+
* 裁剪:垂直模式、多图联动、淡入淡出(fade 用 CSS 可配)。 */
|
|
17
|
+
export declare const Carousel: Component<CarouselProps>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Component } from '../../client/vnode.ts';
|
|
2
|
+
export interface CascaderOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
children?: CascaderOption[];
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface CascaderProps {
|
|
9
|
+
options?: CascaderOption[];
|
|
10
|
+
/** 选中路径(数组,如 ['zj','hz','xh']) */
|
|
11
|
+
value?: string[];
|
|
12
|
+
onChange?: (value: string[]) => void;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
error?: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
'aria-label'?: string;
|
|
18
|
+
}
|
|
19
|
+
/** 级联选择(对应 antd/EP Cascader):多列面板逐级选择,点击叶子完成。
|
|
20
|
+
* 裁剪:hover 展开、搜索、任意层级配置、异步加载。 */
|
|
21
|
+
export declare const Cascader: Component<CascaderProps>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Component } from '../../client/vnode.ts';
|
|
2
|
+
export interface CheckboxGroupOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
desc?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface CheckboxGroupProps {
|
|
9
|
+
options?: CheckboxGroupOption[];
|
|
10
|
+
/** 受控选中值 */
|
|
11
|
+
value?: string[];
|
|
12
|
+
onChange?: (value: string[]) => void;
|
|
13
|
+
/** 栅格列数(1-4) */
|
|
14
|
+
columns?: 1 | 2 | 3 | 4;
|
|
15
|
+
size?: 'sm' | 'md' | 'lg';
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/** 组标题(可选) */
|
|
18
|
+
label?: string;
|
|
19
|
+
'aria-label'?: string;
|
|
20
|
+
className?: string;
|
|
21
|
+
}
|
|
22
|
+
/** 复选框组/多选列表(对应 antd Checkbox.Group):成员选择、多值字段 */
|
|
23
|
+
export declare const CheckboxGroup: Component<CheckboxGroupProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* weifuwu/components — CodeBlock
|
|
3
|
+
*
|
|
4
|
+
* 代码展示块:语言标签 + 复制按钮 + 横向滚动。
|
|
5
|
+
* 由 Markdown 代码围栏复用;也可独立使用。
|
|
6
|
+
* 裁剪:不做语法高亮(零依赖,语言标签仅展示)。
|
|
7
|
+
*/
|
|
8
|
+
import type { Component } from '../../client/vnode.ts';
|
|
9
|
+
export interface CodeBlockProps {
|
|
10
|
+
code: string;
|
|
11
|
+
lang?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const CodeBlock: Component<CodeBlockProps>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Component } from '../../client/vnode.ts';
|
|
2
|
+
export interface CollapseItem {
|
|
3
|
+
key: string;
|
|
4
|
+
title: string;
|
|
5
|
+
/** 标题图标 */
|
|
6
|
+
icon?: any;
|
|
7
|
+
/** 标题右侧操作区 */
|
|
8
|
+
extra?: any;
|
|
9
|
+
/** 展开内容(惰性渲染:未展开不渲染) */
|
|
10
|
+
content?: any;
|
|
11
|
+
/** 异步加载态:展开时显示 loading 指示 */
|
|
12
|
+
loading?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface CollapseProps {
|
|
15
|
+
items?: CollapseItem[];
|
|
16
|
+
/** 受控展开 keys */
|
|
17
|
+
active?: string[];
|
|
18
|
+
onChange?: (keys: string[]) => void;
|
|
19
|
+
/** false = 手风琴互斥(同一时间只开一个);默认 true 多开 */
|
|
20
|
+
multiple?: boolean;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* 行内折叠面板(对应 antd/EP Collapse + shadcn Collapsible):
|
|
25
|
+
* 标题行 + 行内展开区(无卡片边框,适配列表行内展开),支持异步 loading。
|
|
26
|
+
* 与 Accordion 边界:Accordion = 整块卡片面板;Collapse = 行内展开。
|
|
27
|
+
*/
|
|
28
|
+
export declare const Collapse: Component<CollapseProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Component } from '../../client/vnode.ts';
|
|
2
|
+
export interface ColorPickerProps {
|
|
3
|
+
/** 受控颜色值(hex,如 #4f6ef7) */
|
|
4
|
+
value?: string;
|
|
5
|
+
onChange?: (value: string) => void;
|
|
6
|
+
/** 预设色板(默认内置 10 色) */
|
|
7
|
+
colors?: string[];
|
|
8
|
+
size?: 'sm' | 'md' | 'lg';
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** 显示 hex 输入框(自由输入) */
|
|
11
|
+
showInput?: boolean;
|
|
12
|
+
'aria-label'?: string;
|
|
13
|
+
}
|
|
14
|
+
/** 颜色选择(对应 antd/EP ColorPicker 预设版):触发按钮 + 色板弹层 + hex 输入。
|
|
15
|
+
* 裁剪:不做吸管/自由取色/透明度(预设色板 + hex 输入覆盖 90% 场景)。 */
|
|
16
|
+
export declare const ColorPicker: Component<ColorPickerProps>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Component } from '../../client/vnode.ts';
|
|
2
|
+
export interface CommandItem {
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: any;
|
|
6
|
+
/** 显示快捷键(如 'G S') */
|
|
7
|
+
shortcut?: string;
|
|
8
|
+
group?: string;
|
|
9
|
+
keywords?: string[];
|
|
10
|
+
onSelect?: () => void;
|
|
11
|
+
}
|
|
12
|
+
export interface CommandProps {
|
|
13
|
+
open?: boolean;
|
|
14
|
+
onOpenChange?: (open: boolean) => void;
|
|
15
|
+
items?: CommandItem[];
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
emptyText?: string;
|
|
18
|
+
/** 全局快捷键,如 'mod+k'(cmd/ctrl + k);null 关闭全局监听 */
|
|
19
|
+
globalShortcut?: string | null;
|
|
20
|
+
}
|
|
21
|
+
/** 命令面板(对应 shadcn Command):全屏 overlay + 搜索 + 键盘流(↑↓ Enter Escape)+ Cmd+K 全局快捷键 */
|
|
22
|
+
export declare const Command: Component<CommandProps>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Component } from '../../client/vnode.ts';
|
|
2
|
+
export interface ContextMenuItem {
|
|
3
|
+
key: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: any;
|
|
6
|
+
variant?: 'default' | 'danger';
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface ContextMenuProps {
|
|
11
|
+
items?: ContextMenuItem[];
|
|
12
|
+
children: any;
|
|
13
|
+
'aria-label'?: string;
|
|
14
|
+
className?: string;
|
|
15
|
+
}
|
|
16
|
+
/** 右键菜单(对应 shadcn ContextMenu):右键在光标处弹出,点击外部/Escape 关闭,方向键导航 */
|
|
17
|
+
export declare const ContextMenu: Component<ContextMenuProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Component } from '../../client/vnode.ts';
|
|
2
|
+
export interface CopyButtonProps {
|
|
3
|
+
/** 要复制的文本 */
|
|
4
|
+
value: string;
|
|
5
|
+
/** 按钮文字(默认仅图标) */
|
|
6
|
+
label?: string;
|
|
7
|
+
size?: 'sm' | 'md' | 'lg';
|
|
8
|
+
variant?: 'ghost' | 'secondary' | 'default';
|
|
9
|
+
/** 仅图标(无文字) */
|
|
10
|
+
iconOnly?: boolean;
|
|
11
|
+
/** 成功提示文字(默认「已复制」) */
|
|
12
|
+
successText?: string;
|
|
13
|
+
onCopied?: () => void;
|
|
14
|
+
className?: string;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
17
|
+
/** 复制按钮(weifuwu 独有,Chat 消息复制/CodeBlock 抽取统一) */
|
|
18
|
+
export declare const CopyButton: Component<CopyButtonProps>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* weifuwu/components — Descriptions
|
|
3
|
+
*
|
|
4
|
+
* 详情字段展示:label/value 栅格(<dl> 语义结构,屏幕阅读器友好)。
|
|
5
|
+
* 用于 Agent 配置展示、实体详情、订单信息等只读字段场景。
|
|
6
|
+
*/
|
|
7
|
+
import type { Component } from '../../client/vnode.ts';
|
|
8
|
+
export interface DescriptionItem {
|
|
9
|
+
label: any;
|
|
10
|
+
value: any;
|
|
11
|
+
/** 跨列数(栅格列,默认 1) */
|
|
12
|
+
span?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface DescriptionsProps {
|
|
15
|
+
items: DescriptionItem[];
|
|
16
|
+
column?: 1 | 2 | 3 | 4;
|
|
17
|
+
bordered?: boolean;
|
|
18
|
+
size?: 'sm' | 'md' | 'lg';
|
|
19
|
+
className?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const Descriptions: Component<DescriptionsProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* weifuwu/components — Highlight
|
|
3
|
+
*
|
|
4
|
+
* 搜索词高亮:给定文本 + 高亮词数组 → 分词渲染 <mark>(零依赖,VNode 拼接)。
|
|
5
|
+
* 配合 SearchInput/Table 搜索结果命中展示。
|
|
6
|
+
*/
|
|
7
|
+
import type { Component } from '../../client/vnode.ts';
|
|
8
|
+
export interface HighlightProps {
|
|
9
|
+
text: string;
|
|
10
|
+
query?: string | string[];
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const Highlight: Component<HighlightProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Component } from '../../client/vnode.ts';
|
|
2
|
+
import type { Placement } from '../../client/popup.ts';
|
|
3
|
+
export type HoverCardPosition = Placement;
|
|
4
|
+
export interface HoverCardProps {
|
|
5
|
+
/** 富内容(任意 VNode,区别于 Tooltip 的 string) */
|
|
6
|
+
content: any;
|
|
7
|
+
position?: HoverCardPosition;
|
|
8
|
+
children: any;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** 悬停打开延迟(ms),默认 150 */
|
|
11
|
+
openDelay?: number;
|
|
12
|
+
/** 移出关闭延迟(ms),默认 0 */
|
|
13
|
+
closeDelay?: number;
|
|
14
|
+
}
|
|
15
|
+
/** 悬停富内容卡(对应 shadcn HoverCard):hover 延迟显隐,支持任意 VNode 内容 */
|
|
16
|
+
export declare const HoverCard: Component<HoverCardProps>;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* h(Icon, { name: 'check', size: 16 })
|
|
10
10
|
*/
|
|
11
11
|
import type { Component } from '../../client/vnode.ts';
|
|
12
|
-
export type IconName = 'chevron-down' | 'chevron-up' | 'chevron-left' | 'chevron-right' | 'arrow-left' | 'arrow-up' | 'arrow-down' | 'sort' | 'sort-asc' | 'sort-desc' | 'check' | 'close' | 'alert' | 'info' | 'warning' | 'pause' | 'settings' | 'search' | 'send' | 'stop' | 'retry' | 'upload' | 'trash' | 'edit' | 'plus';
|
|
12
|
+
export type IconName = 'chevron-down' | 'chevron-up' | 'chevron-left' | 'chevron-right' | 'arrow-left' | 'arrow-up' | 'arrow-down' | 'arrow-right' | 'sort' | 'sort-asc' | 'sort-desc' | 'check' | 'close' | 'alert' | 'info' | 'warning' | 'pause' | 'settings' | 'search' | 'send' | 'stop' | 'retry' | 'upload' | 'trash' | 'edit' | 'plus' | 'copy' | 'eye' | 'eye-off' | 'star';
|
|
13
13
|
export interface IconProps {
|
|
14
14
|
name: IconName;
|
|
15
15
|
/** 尺寸,默认 1em(随字号缩放) */
|
|
@@ -11,5 +11,9 @@ export interface ImgProps {
|
|
|
11
11
|
height?: number | string;
|
|
12
12
|
className?: string;
|
|
13
13
|
style?: Record<string, string>;
|
|
14
|
+
/** 点击放大预览(对应 antd/EP Image preview) */
|
|
15
|
+
preview?: boolean;
|
|
16
|
+
/** 预览缩放倍率,默认 1 */
|
|
17
|
+
previewScale?: number;
|
|
14
18
|
}
|
|
15
19
|
export declare const Img: Component<ImgProps>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* weifuwu/components — InView
|
|
3
3
|
*
|
|
4
|
-
* 组件挂载后用 ctx.ui.onmounted 获取根元素,设置 IntersectionObserver。
|
|
5
4
|
* 进入视窗后替换占位符为真实内容。
|
|
5
|
+
* 实现:ctx.ui.useInView(IO 封装)——滚动/尺寸变化由合成器线程评估,无 scroll 监听。
|
|
6
6
|
*/
|
|
7
7
|
import type { Component } from '../../client/vnode.ts';
|
|
8
8
|
export interface InViewProps {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Component } from '../../client/vnode.ts';
|
|
2
|
+
export interface InfiniteScrollProps {
|
|
3
|
+
hasMore?: boolean;
|
|
4
|
+
loading?: boolean;
|
|
5
|
+
/** 触底加载回调(sentinel 进入视口触发) */
|
|
6
|
+
onLoadMore?: () => void;
|
|
7
|
+
/** 提前触发距离(px) */
|
|
8
|
+
threshold?: number;
|
|
9
|
+
children?: any;
|
|
10
|
+
loadMoreText?: string;
|
|
11
|
+
endText?: string;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
/** 无限滚动(对应 EP InfiniteScroll):底部哨兵进入视口 → 加载更多。 */
|
|
15
|
+
export declare const InfiniteScroll: Component<InfiniteScrollProps>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* weifuwu/components — InputNumber
|
|
3
|
+
*
|
|
4
|
+
* 数字输入:min/max/step + 增减按钮 + precision 格式化。
|
|
5
|
+
* 受控 value: number | null;空值 → null;输入 clamp 到 min/max。
|
|
6
|
+
* 裁剪:不做长按连增/千分位货币(见 roadmap)。
|
|
7
|
+
*/
|
|
8
|
+
import type { Component } from '../../client/vnode.ts';
|
|
9
|
+
export interface InputNumberProps {
|
|
10
|
+
value?: number | null;
|
|
11
|
+
onChange?: (value: number | null) => void;
|
|
12
|
+
min?: number;
|
|
13
|
+
max?: number;
|
|
14
|
+
step?: number;
|
|
15
|
+
precision?: number;
|
|
16
|
+
label?: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
error?: string;
|
|
21
|
+
hint?: string;
|
|
22
|
+
required?: boolean;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const InputNumber: Component<InputNumberProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Component } from '../../client/vnode.ts';
|
|
2
|
+
export interface LabelProps {
|
|
3
|
+
htmlFor?: string;
|
|
4
|
+
/** 必填星号 */
|
|
5
|
+
required?: boolean;
|
|
6
|
+
children?: any;
|
|
7
|
+
className?: string;
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}
|
|
10
|
+
/** 独立标签(对应 shadcn Label;weifuwu Input/Field 已内嵌 label,独立组件用于自定义布局) */
|
|
11
|
+
export declare const Label: Component<LabelProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* weifuwu/components — List
|
|
3
|
+
*
|
|
4
|
+
* 通用列表:items + renderItem + header/footer/empty 占位。
|
|
5
|
+
* 定位:Table 大材小用的消息/文件/成员列表场景。
|
|
6
|
+
*/
|
|
7
|
+
import type { Component } from '../../client/vnode.ts';
|
|
8
|
+
export interface ListProps<T = any> {
|
|
9
|
+
items: T[];
|
|
10
|
+
renderItem: (item: T, index: number) => any;
|
|
11
|
+
divided?: boolean;
|
|
12
|
+
header?: any;
|
|
13
|
+
footer?: any;
|
|
14
|
+
emptyText?: string;
|
|
15
|
+
emptyIcon?: any;
|
|
16
|
+
className?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const List: Component<ListProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* weifuwu/components — Markdown
|
|
3
|
+
*
|
|
4
|
+
* AI 回复/富文本渲染。安全子集解析 → VNode 渲染(天然转义,无 innerHTML 注入面)。
|
|
5
|
+
* 与 CodeBlock 组合渲染代码围栏。
|
|
6
|
+
*/
|
|
7
|
+
import type { Component } from '../../client/vnode.ts';
|
|
8
|
+
import { type MdInline } from './parser.ts';
|
|
9
|
+
export interface MarkdownProps {
|
|
10
|
+
content: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const Markdown: Component<MarkdownProps>;
|
|
14
|
+
export declare function renderInline(nodes: MdInline[]): any[];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* weifuwu/components — Markdown 安全子集 parser
|
|
3
|
+
*
|
|
4
|
+
* 零依赖自研解析器,输出结构化 token(非 HTML 字符串)——
|
|
5
|
+
* 组件层以 VNode 渲染,天然转义任何用户/AI 内容(无 innerHTML 注入面)。
|
|
6
|
+
*
|
|
7
|
+
* 支持块级:标题(#~####) / 段落 / 列表(有序·无序) / 围栏代码块 / 引用 / 分割线
|
|
8
|
+
* 支持行内:**粗体** / *斜体* / `行内代码` / [文本](链接)
|
|
9
|
+
*
|
|
10
|
+
* 诚实裁剪:GFM 表格/任务列表/删除线/脚注/raw HTML/自动链接/语法高亮(见 roadmap)
|
|
11
|
+
*/
|
|
12
|
+
export interface MdInline {
|
|
13
|
+
type: 'text' | 'code' | 'bold' | 'italic' | 'link';
|
|
14
|
+
text?: string;
|
|
15
|
+
href?: string;
|
|
16
|
+
children?: MdInline[];
|
|
17
|
+
}
|
|
18
|
+
export interface MdBlock {
|
|
19
|
+
type: 'heading' | 'paragraph' | 'list' | 'code' | 'quote' | 'hr';
|
|
20
|
+
level?: number;
|
|
21
|
+
inline?: MdInline[];
|
|
22
|
+
ordered?: boolean;
|
|
23
|
+
items?: MdInline[][];
|
|
24
|
+
lang?: string;
|
|
25
|
+
code?: string;
|
|
26
|
+
}
|
|
27
|
+
/** 链接安全:仅 http/https;javascript:/data:/vbscript: 一律拒绝 */
|
|
28
|
+
export declare function safeUrl(href: string): string | null;
|
|
29
|
+
/** 行内解析:code / bold / italic / link,其余为 text(有序优先防嵌套误判) */
|
|
30
|
+
export declare function parseInline(src: string): MdInline[];
|
|
31
|
+
/** 块级解析:逐行状态机 */
|
|
32
|
+
export declare function parseMarkdown(content: string): MdBlock[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Component } from '../../client/vnode.ts';
|
|
2
|
+
export interface MentionsOption {
|
|
3
|
+
value: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface MentionsProps {
|
|
7
|
+
value?: string;
|
|
8
|
+
onChange?: (value: string) => void;
|
|
9
|
+
options?: MentionsOption[];
|
|
10
|
+
/** 触发字符,默认 '@' */
|
|
11
|
+
prefix?: string;
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
rows?: number;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
size?: 'sm' | 'md' | 'lg';
|
|
16
|
+
}
|
|
17
|
+
/** @提及输入(对应 antd Mentions):输入 prefix + 关键词弹出候选,点击/Enter 插入。
|
|
18
|
+
* 裁剪:不做多 prefix/自定义高亮渲染/远程搜索(options 静态传入)。 */
|
|
19
|
+
export declare const Mentions: Component<MentionsProps>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* weifuwu/components — Menu
|
|
3
|
+
*
|
|
4
|
+
* 导航菜单(侧栏导航):分组项 + 图标 + 选中态 + 方向键导航 + Enter 激活。
|
|
5
|
+
* 用于 SaaS 应用侧边导航(替代手写 nav-item 循环)。
|
|
6
|
+
* 裁剪:不做子菜单展开/水平菜单栏(见 roadmap)。
|
|
7
|
+
*/
|
|
8
|
+
import type { Component } from '../../client/vnode.ts';
|
|
9
|
+
export interface MenuItem {
|
|
10
|
+
key: string;
|
|
11
|
+
label: any;
|
|
12
|
+
icon?: any;
|
|
13
|
+
/** 分组标题(相邻同组项之间插分组头) */
|
|
14
|
+
group?: string;
|
|
15
|
+
active?: boolean;
|
|
16
|
+
danger?: boolean;
|
|
17
|
+
onClick?: () => void;
|
|
18
|
+
}
|
|
19
|
+
export interface MenuProps {
|
|
20
|
+
items: MenuItem[];
|
|
21
|
+
onSelect?: (key: string) => void;
|
|
22
|
+
activeKey?: string;
|
|
23
|
+
className?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const Menu: Component<MenuProps>;
|