weifuwu 0.36.2 → 0.38.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.
Files changed (51) hide show
  1. package/README.md +141 -3
  2. package/dist/client/app.d.ts +4 -7
  3. package/dist/client/confirm.d.ts +26 -0
  4. package/dist/client/focus-trap.d.ts +4 -0
  5. package/dist/client/i18n.d.ts +27 -0
  6. package/dist/client/index.d.ts +8 -0
  7. package/dist/client/index.js +322 -60
  8. package/dist/client/locale/en_US.d.ts +34 -0
  9. package/dist/client/locale/zh_CN.d.ts +34 -0
  10. package/dist/client/scroll-lock.d.ts +5 -0
  11. package/dist/components/Accordion/Accordion.d.ts +11 -0
  12. package/dist/components/Alert/Alert.d.ts +9 -0
  13. package/dist/components/Avatar/Avatar.d.ts +7 -0
  14. package/dist/components/Badge/Badge.d.ts +8 -0
  15. package/dist/components/Breadcrumb/Breadcrumb.d.ts +9 -0
  16. package/dist/components/Button/Button.d.ts +12 -0
  17. package/dist/components/Card/Card.d.ts +9 -0
  18. package/dist/components/Checkbox/Checkbox.d.ts +8 -0
  19. package/dist/components/Divider/Divider.d.ts +6 -0
  20. package/dist/components/Drawer/Drawer.d.ts +14 -0
  21. package/dist/components/Dropdown/Dropdown.d.ts +14 -0
  22. package/dist/components/EmptyState/EmptyState.d.ts +8 -0
  23. package/dist/components/Field/Field.d.ts +9 -0
  24. package/dist/components/FileUpload/FileUpload.d.ts +13 -0
  25. package/dist/components/Form/Form.d.ts +6 -0
  26. package/dist/components/Img/Img.d.ts +17 -0
  27. package/dist/components/Input/Input.d.ts +14 -0
  28. package/dist/components/Loading/Loading.d.ts +5 -0
  29. package/dist/components/Modal/Modal.d.ts +12 -0
  30. package/dist/components/PageHeader/PageHeader.d.ts +7 -0
  31. package/dist/components/Pagination/Pagination.d.ts +8 -0
  32. package/dist/components/Popover/Popover.d.ts +26 -0
  33. package/dist/components/ProgressBar/ProgressBar.d.ts +8 -0
  34. package/dist/components/RadioGroup/RadioGroup.d.ts +14 -0
  35. package/dist/components/SearchInput/SearchInput.d.ts +8 -0
  36. package/dist/components/Select/Select.d.ts +18 -0
  37. package/dist/components/Skeleton/Skeleton.d.ts +21 -0
  38. package/dist/components/Slider/Slider.d.ts +10 -0
  39. package/dist/components/StatCard/StatCard.d.ts +9 -0
  40. package/dist/components/Steps/Steps.d.ts +12 -0
  41. package/dist/components/Switch/Switch.d.ts +8 -0
  42. package/dist/components/Table/Table.d.ts +13 -0
  43. package/dist/components/Tabs/Tabs.d.ts +12 -0
  44. package/dist/components/Tag/Tag.d.ts +8 -0
  45. package/dist/components/Textarea/Textarea.d.ts +13 -0
  46. package/dist/components/Toast/Toast.d.ts +12 -0
  47. package/dist/components/Tooltip/Tooltip.d.ts +9 -0
  48. package/dist/components/index.d.ts +81 -0
  49. package/dist/components/index.js +1064 -0
  50. package/dist/components/style.css +2005 -0
  51. package/package.json +7 -2
@@ -0,0 +1,8 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface EmptyStateProps {
3
+ icon?: string;
4
+ text?: string;
5
+ hint?: string;
6
+ children?: any;
7
+ }
8
+ export declare const EmptyState: Component<EmptyStateProps>;
@@ -0,0 +1,9 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface FieldProps {
3
+ label?: string;
4
+ required?: boolean;
5
+ error?: string;
6
+ hint?: string;
7
+ children?: any;
8
+ }
9
+ export declare const Field: Component<FieldProps>;
@@ -0,0 +1,13 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface FileUploadProps {
3
+ accept?: string;
4
+ multiple?: boolean;
5
+ maxSize?: number;
6
+ disabled?: boolean;
7
+ error?: string;
8
+ hint?: string;
9
+ value?: File[];
10
+ onChange?: (files: File[]) => void;
11
+ children?: any;
12
+ }
13
+ export declare const FileUpload: Component<FileUploadProps>;
@@ -0,0 +1,6 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface FormProps {
3
+ onSubmit?: () => void | Promise<void>;
4
+ children?: any;
5
+ }
6
+ export declare const Form: Component<FormProps>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * weifuwu/components — Img
3
+ *
4
+ * `<img>` 增强组件。支持 fallback、loading="lazy"。
5
+ */
6
+ import type { Component } from '../../client/vnode.ts';
7
+ export interface ImgProps {
8
+ src?: string;
9
+ alt?: string;
10
+ fallback?: string;
11
+ loading?: 'lazy' | 'eager';
12
+ width?: number | string;
13
+ height?: number | string;
14
+ className?: string;
15
+ style?: Record<string, string>;
16
+ }
17
+ export declare const Img: Component<ImgProps>;
@@ -0,0 +1,14 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface InputProps {
3
+ label?: string;
4
+ type?: 'text' | 'email' | 'password' | 'number' | 'url' | 'date' | 'tel' | 'time' | 'color';
5
+ value?: string;
6
+ placeholder?: string;
7
+ required?: boolean;
8
+ disabled?: boolean;
9
+ error?: string;
10
+ hint?: string;
11
+ onInput?: (e: Event) => void;
12
+ onChange?: (e: Event) => void;
13
+ }
14
+ export declare const Input: Component<InputProps>;
@@ -0,0 +1,5 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface LoadingProps {
3
+ text?: string;
4
+ }
5
+ export declare const Loading: Component<LoadingProps>;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * weifuwu/components — Modal
3
+ */
4
+ import type { Component } from '../../client/vnode.ts';
5
+ export interface ModalProps {
6
+ open?: boolean;
7
+ title?: string;
8
+ onClose?: () => void;
9
+ children?: any;
10
+ footer?: any;
11
+ }
12
+ export declare const Modal: Component<ModalProps>;
@@ -0,0 +1,7 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface PageHeaderProps {
3
+ title: string;
4
+ sub?: string;
5
+ children?: any;
6
+ }
7
+ export declare const PageHeader: Component<PageHeaderProps>;
@@ -0,0 +1,8 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface PaginationProps {
3
+ total: number;
4
+ page?: number;
5
+ pageSize?: number;
6
+ onChange?: (page: number) => void;
7
+ }
8
+ export declare const Pagination: Component<PaginationProps>;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * weifuwu/components — Popover
3
+ *
4
+ * 通用弹出层组件。触发点击后在目标元素附近弹出浮动面板。
5
+ * 点击面板外部关闭。
6
+ *
7
+ * 触发方式:
8
+ * 'click' — 点击触发元素切换显示
9
+ * 'hover' — 悬停触发元素显示,移出关闭
10
+ *
11
+ * 受控模式:
12
+ * 传入 open + onOpenChange 可外部控制显示状态
13
+ * (Dropdown 使用此模式)
14
+ */
15
+ import type { Component } from '../../client/vnode.ts';
16
+ export type PopoverPosition = 'top' | 'bottom' | 'left' | 'right';
17
+ export interface PopoverProps {
18
+ content?: any;
19
+ trigger?: 'click' | 'hover';
20
+ position?: PopoverPosition;
21
+ open?: boolean;
22
+ onOpenChange?: (open: boolean) => void;
23
+ disabled?: boolean;
24
+ children?: any;
25
+ }
26
+ export declare const Popover: Component<PopoverProps>;
@@ -0,0 +1,8 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface ProgressBarProps {
3
+ value?: number;
4
+ max?: number;
5
+ label?: string;
6
+ showValue?: boolean;
7
+ }
8
+ export declare const ProgressBar: Component<ProgressBarProps>;
@@ -0,0 +1,14 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface RadioOption {
3
+ value: string;
4
+ label: string;
5
+ disabled?: boolean;
6
+ }
7
+ export interface RadioGroupProps {
8
+ name?: string;
9
+ value?: string;
10
+ options?: RadioOption[];
11
+ inline?: boolean;
12
+ onChange?: (value: string) => void;
13
+ }
14
+ export declare const RadioGroup: Component<RadioGroupProps>;
@@ -0,0 +1,8 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface SearchInputProps {
3
+ value?: string;
4
+ placeholder?: string;
5
+ onInput?: (e: Event) => void;
6
+ onClear?: () => void;
7
+ }
8
+ export declare const SearchInput: Component<SearchInputProps>;
@@ -0,0 +1,18 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface SelectOption {
3
+ value: string;
4
+ label: string;
5
+ disabled?: boolean;
6
+ }
7
+ export interface SelectProps {
8
+ label?: string;
9
+ value?: string;
10
+ options?: SelectOption[];
11
+ placeholder?: string;
12
+ required?: boolean;
13
+ disabled?: boolean;
14
+ error?: string;
15
+ onChange?: (e: Event) => void;
16
+ children?: any;
17
+ }
18
+ export declare const Select: Component<SelectProps>;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * weifuwu/components — Skeleton
3
+ *
4
+ * 骨架屏占位组件。纯 CSS,无交互,无状态。
5
+ *
6
+ * 用法:
7
+ * <Skeleton /> ← 单行文本
8
+ * <Skeleton lines={3} /> ← 多行段落
9
+ * <Skeleton variant="circle" /> ← 圆形头像
10
+ * <Skeleton variant="rect" w={200} h={120} /> ← 矩形区域
11
+ */
12
+ import type { Component } from '../../client/vnode.ts';
13
+ export type SkeletonVariant = 'text' | 'circle' | 'rect';
14
+ export interface SkeletonProps {
15
+ variant?: SkeletonVariant;
16
+ lines?: number;
17
+ width?: number | string;
18
+ height?: number | string;
19
+ className?: string;
20
+ }
21
+ export declare const Skeleton: Component<SkeletonProps>;
@@ -0,0 +1,10 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface SliderProps {
3
+ label?: string;
4
+ value?: number | string;
5
+ min?: number;
6
+ max?: number;
7
+ step?: number;
8
+ onChange?: (value: number) => void;
9
+ }
10
+ export declare const Slider: Component<SliderProps>;
@@ -0,0 +1,9 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface StatCardProps {
3
+ label: string;
4
+ value: string | number;
5
+ trend?: 'up' | 'down';
6
+ trendLabel?: string;
7
+ icon?: string;
8
+ }
9
+ export declare const StatCard: Component<StatCardProps>;
@@ -0,0 +1,12 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface StepItem {
3
+ key: string;
4
+ label: string;
5
+ description?: string;
6
+ }
7
+ export interface StepsProps {
8
+ items?: StepItem[];
9
+ active?: string;
10
+ current?: number;
11
+ }
12
+ export declare const Steps: Component<StepsProps>;
@@ -0,0 +1,8 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface SwitchProps {
3
+ label?: string;
4
+ checked?: boolean;
5
+ disabled?: boolean;
6
+ onChange?: (checked: boolean) => void;
7
+ }
8
+ export declare const Switch: Component<SwitchProps>;
@@ -0,0 +1,13 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface TableColumn {
3
+ key: string;
4
+ label: string;
5
+ width?: number | string;
6
+ render?: (value: any, row: any, index: number) => any;
7
+ }
8
+ export interface TableProps {
9
+ data?: any[];
10
+ columns: TableColumn[];
11
+ onRowClick?: (row: any, index: number) => void;
12
+ }
13
+ export declare const Table: Component<TableProps>;
@@ -0,0 +1,12 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface TabItem {
3
+ key: string;
4
+ label: string;
5
+ content?: any;
6
+ }
7
+ export interface TabsProps {
8
+ items?: TabItem[];
9
+ active?: string;
10
+ onChange?: (key: string) => void;
11
+ }
12
+ export declare const Tabs: Component<TabsProps>;
@@ -0,0 +1,8 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface TagProps {
3
+ closable?: boolean;
4
+ onClose?: () => void;
5
+ variant?: 'default' | 'primary' | 'success' | 'danger';
6
+ children?: any;
7
+ }
8
+ export declare const Tag: Component<TagProps>;
@@ -0,0 +1,13 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export interface TextareaProps {
3
+ label?: string;
4
+ value?: string;
5
+ placeholder?: string;
6
+ required?: boolean;
7
+ disabled?: boolean;
8
+ error?: string;
9
+ hint?: string;
10
+ rows?: number;
11
+ onInput?: (e: Event) => void;
12
+ }
13
+ export declare const Textarea: Component<TextareaProps>;
@@ -0,0 +1,12 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export type ToastType = 'success' | 'error' | 'info' | 'warning';
3
+ export interface ToastItem {
4
+ id: string;
5
+ type: ToastType;
6
+ message: string;
7
+ }
8
+ export interface ToastProps {
9
+ toasts?: ToastItem[];
10
+ onRemove?: (id: string) => void;
11
+ }
12
+ export declare const Toast: Component<ToastProps>;
@@ -0,0 +1,9 @@
1
+ import type { Component } from '../../client/vnode.ts';
2
+ export type TooltipPosition = 'top' | 'bottom' | 'left' | 'right';
3
+ export interface TooltipProps {
4
+ content: string;
5
+ position?: TooltipPosition;
6
+ children: any;
7
+ disabled?: boolean;
8
+ }
9
+ export declare const Tooltip: Component<TooltipProps>;
@@ -0,0 +1,81 @@
1
+ /**
2
+ * weifuwu/components — HTML 原语
3
+ *
4
+ * 使用方式:
5
+ * import { Button, Input } from 'weifuwu/components'
6
+ * import 'weifuwu/components/style.css'
7
+ */
8
+ export { Button } from './Button/Button.ts';
9
+ export type { ButtonProps } from './Button/Button.ts';
10
+ export { Input } from './Input/Input.ts';
11
+ export type { InputProps } from './Input/Input.ts';
12
+ export { Textarea } from './Textarea/Textarea.ts';
13
+ export type { TextareaProps } from './Textarea/Textarea.ts';
14
+ export { Select } from './Select/Select.ts';
15
+ export type { SelectProps, SelectOption } from './Select/Select.ts';
16
+ export { Checkbox } from './Checkbox/Checkbox.ts';
17
+ export type { CheckboxProps } from './Checkbox/Checkbox.ts';
18
+ export { Switch } from './Switch/Switch.ts';
19
+ export type { SwitchProps } from './Switch/Switch.ts';
20
+ export { RadioGroup } from './RadioGroup/RadioGroup.ts';
21
+ export type { RadioGroupProps, RadioOption } from './RadioGroup/RadioGroup.ts';
22
+ export { Table } from './Table/Table.ts';
23
+ export type { TableProps, TableColumn } from './Table/Table.ts';
24
+ export { Modal } from './Modal/Modal.ts';
25
+ export type { ModalProps } from './Modal/Modal.ts';
26
+ export { Toast } from './Toast/Toast.ts';
27
+ export type { ToastProps, ToastItem, ToastType } from './Toast/Toast.ts';
28
+ export { Alert } from './Alert/Alert.ts';
29
+ export type { AlertProps, AlertVariant } from './Alert/Alert.ts';
30
+ export { Loading } from './Loading/Loading.ts';
31
+ export type { LoadingProps } from './Loading/Loading.ts';
32
+ export { EmptyState } from './EmptyState/EmptyState.ts';
33
+ export type { EmptyStateProps } from './EmptyState/EmptyState.ts';
34
+ export { Tabs } from './Tabs/Tabs.ts';
35
+ export type { TabsProps, TabItem } from './Tabs/Tabs.ts';
36
+ export { Dropdown } from './Dropdown/Dropdown.ts';
37
+ export type { DropdownProps, DropdownItem } from './Dropdown/Dropdown.ts';
38
+ export { Pagination } from './Pagination/Pagination.ts';
39
+ export type { PaginationProps } from './Pagination/Pagination.ts';
40
+ export { Card } from './Card/Card.ts';
41
+ export type { CardProps } from './Card/Card.ts';
42
+ export { Badge } from './Badge/Badge.ts';
43
+ export type { BadgeProps, BadgeVariant } from './Badge/Badge.ts';
44
+ export { Avatar } from './Avatar/Avatar.ts';
45
+ export type { AvatarProps } from './Avatar/Avatar.ts';
46
+ export { Tag } from './Tag/Tag.ts';
47
+ export type { TagProps } from './Tag/Tag.ts';
48
+ export { StatCard } from './StatCard/StatCard.ts';
49
+ export type { StatCardProps } from './StatCard/StatCard.ts';
50
+ export { Steps } from './Steps/Steps.ts';
51
+ export type { StepsProps, StepItem } from './Steps/Steps.ts';
52
+ export { Form } from './Form/Form.ts';
53
+ export type { FormProps } from './Form/Form.ts';
54
+ export { Field } from './Field/Field.ts';
55
+ export type { FieldProps } from './Field/Field.ts';
56
+ export { Slider } from './Slider/Slider.ts';
57
+ export type { SliderProps } from './Slider/Slider.ts';
58
+ export { SearchInput } from './SearchInput/SearchInput.ts';
59
+ export type { SearchInputProps } from './SearchInput/SearchInput.ts';
60
+ export { ProgressBar } from './ProgressBar/ProgressBar.ts';
61
+ export type { ProgressBarProps } from './ProgressBar/ProgressBar.ts';
62
+ export { Accordion } from './Accordion/Accordion.ts';
63
+ export type { AccordionProps, AccordionItem } from './Accordion/Accordion.ts';
64
+ export { PageHeader } from './PageHeader/PageHeader.ts';
65
+ export type { PageHeaderProps } from './PageHeader/PageHeader.ts';
66
+ export { Breadcrumb } from './Breadcrumb/Breadcrumb.ts';
67
+ export type { BreadcrumbProps, BreadcrumbItem } from './Breadcrumb/Breadcrumb.ts';
68
+ export { Divider } from './Divider/Divider.ts';
69
+ export type { DividerProps } from './Divider/Divider.ts';
70
+ export { FileUpload } from './FileUpload/FileUpload.ts';
71
+ export type { FileUploadProps } from './FileUpload/FileUpload.ts';
72
+ export { Tooltip } from './Tooltip/Tooltip.ts';
73
+ export type { TooltipProps, TooltipPosition } from './Tooltip/Tooltip.ts';
74
+ export { Drawer } from './Drawer/Drawer.ts';
75
+ export type { DrawerProps, DrawerPosition } from './Drawer/Drawer.ts';
76
+ export { Popover } from './Popover/Popover.ts';
77
+ export type { PopoverProps, PopoverPosition } from './Popover/Popover.ts';
78
+ export { Skeleton } from './Skeleton/Skeleton.ts';
79
+ export type { SkeletonProps, SkeletonVariant } from './Skeleton/Skeleton.ts';
80
+ export { Img } from './Img/Img.ts';
81
+ export type { ImgProps } from './Img/Img.ts';