aot-ui 0.2.8 → 0.2.24

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.
@@ -122,6 +122,7 @@ export * from './modules/radio';
122
122
  export * from './modules/range-picker';
123
123
  export * from './modules/rate';
124
124
  export * from './modules/result';
125
+ export * from './modules/rich-text-editor';
125
126
  export * from './modules/sand-dissolve';
126
127
  export * from './modules/score-celebrate';
127
128
  export * from './modules/scrollbar';
@@ -2,6 +2,10 @@ import { CSSProperties, ReactNode } from 'react';
2
2
  /** 项目约定 tone;兼容 Element type(含 info) */
3
3
  export type BadgeTone = "primary" | "success" | "warning" | "danger" | "info" | "neutral";
4
4
  export type BadgeType = BadgeTone;
5
+ /**
6
+ * Badge 属性。
7
+ * 徽标外圈描边:`--aot-color-badge-ring`(默认跟 surface;深色主题可覆盖)。
8
+ */
5
9
  export type BadgeProps = {
6
10
  children?: ReactNode;
7
11
  /**
@@ -15,6 +15,7 @@ export type DrawerProps = {
15
15
  title?: ReactNode;
16
16
  /** 自定义头部(覆盖 title 文案,不移除关闭按钮) */
17
17
  header?: ReactNode;
18
+ /** 主体内容;超出面板高度时由内部 Scrollbar 滚动 */
18
19
  children?: ReactNode;
19
20
  footer?: ReactNode;
20
21
  /**
@@ -0,0 +1,2 @@
1
+ import { RichTextEditorHandle, RichTextEditorProps } from '../types';
2
+ export declare const RichTextEditor: import('react').ForwardRefExoticComponent<RichTextEditorProps & import('react').RefAttributes<RichTextEditorHandle>>;
@@ -0,0 +1,2 @@
1
+ import { RichTextViewProps } from '../types';
2
+ export declare function RichTextView({ html, className, style, emptyFallback, plain, lineClamp, }: RichTextViewProps): import('react').JSX.Element | null;
@@ -0,0 +1,22 @@
1
+ export declare function IconBold(): import('react').JSX.Element;
2
+ export declare function IconItalic(): import('react').JSX.Element;
3
+ export declare function IconUnderline(): import('react').JSX.Element;
4
+ export declare function IconStrike(): import('react').JSX.Element;
5
+ export declare function IconHeading(): import('react').JSX.Element;
6
+ export declare function IconBulletList(): import('react').JSX.Element;
7
+ export declare function IconOrderedList(): import('react').JSX.Element;
8
+ export declare function IconAlignLeft(): import('react').JSX.Element;
9
+ export declare function IconAlignCenter(): import('react').JSX.Element;
10
+ export declare function IconAlignRight(): import('react').JSX.Element;
11
+ export declare function IconLink(): import('react').JSX.Element;
12
+ export declare function IconClearFormat(): import('react').JSX.Element;
13
+ export declare function IconUndo(): import('react').JSX.Element;
14
+ export declare function IconRedo(): import('react').JSX.Element;
15
+ export declare function IconQuote(): import('react').JSX.Element;
16
+ export declare function IconCode(): import('react').JSX.Element;
17
+ export declare function IconCodeBlock(): import('react').JSX.Element;
18
+ export declare function IconImage(): import('react').JSX.Element;
19
+ export declare function IconTable(): import('react').JSX.Element;
20
+ export declare function IconHr(): import('react').JSX.Element;
21
+ export declare function IconHighlight(): import('react').JSX.Element;
22
+ export declare function IconColor(): import('react').JSX.Element;
@@ -0,0 +1,11 @@
1
+ export type UrlInsertDialogMode = "link" | "image";
2
+ export type UrlInsertDialogProps = {
3
+ open: boolean;
4
+ mode: UrlInsertDialogMode;
5
+ initialUrl?: string;
6
+ onConfirm: (url: string) => void;
7
+ onCancel: () => void;
8
+ /** 图片模式:额外提供「选本地文件」 */
9
+ onPickFile?: () => void;
10
+ };
11
+ export declare function UrlInsertDialog({ open, mode, initialUrl, onConfirm, onCancel, onPickFile, }: UrlInsertDialogProps): import('react').JSX.Element;
@@ -0,0 +1,4 @@
1
+ export { RichTextEditor } from './components/RichTextEditor';
2
+ export { RichTextView } from './components/RichTextView';
3
+ export { isRichTextEmpty, looksLikeHtml, normalizeRichTextInput, plainTextFromHtml, } from './utils/text';
4
+ export type { RichTextEditorHandle, RichTextEditorProps, RichTextEditorSize, RichTextViewProps, } from './types';
@@ -0,0 +1,51 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ export type RichTextEditorSize = "sm" | "md" | "lg";
3
+ export type RichTextEditorProps = {
4
+ /** HTML 内容(受控) */
5
+ value?: string;
6
+ /** 非受控初始 HTML */
7
+ defaultValue?: string;
8
+ /** 内容变化(空内容会回传空字符串) */
9
+ onChange?: (html: string) => void;
10
+ /** 占位文案 */
11
+ placeholder?: string;
12
+ /** 编辑区最小高度(px) */
13
+ minHeight?: number;
14
+ /** 尺寸,影响工具栏与字号 */
15
+ size?: RichTextEditorSize;
16
+ /** 禁用编辑 */
17
+ disabled?: boolean;
18
+ /** 只读(可聚焦,不可改) */
19
+ readOnly?: boolean;
20
+ /** 是否显示工具栏 */
21
+ showToolbar?: boolean;
22
+ /** 自定义根节点 class */
23
+ className?: string;
24
+ style?: CSSProperties;
25
+ /** 无障碍名称 */
26
+ "aria-label"?: string;
27
+ };
28
+ export type RichTextEditorHandle = {
29
+ /** 聚焦编辑器 */
30
+ focus: () => void;
31
+ /** 清空内容 */
32
+ clear: () => void;
33
+ /** 取当前 HTML */
34
+ getHTML: () => string;
35
+ /** 取纯文本 */
36
+ getText: () => string;
37
+ /** 写入 HTML(默认不触发 onChange) */
38
+ setHTML: (html: string, emitUpdate?: boolean) => void;
39
+ };
40
+ export type RichTextViewProps = {
41
+ /** HTML 内容 */
42
+ html?: string | null;
43
+ className?: string;
44
+ style?: CSSProperties;
45
+ /** 空内容时的回退节点 / 文案 */
46
+ emptyFallback?: ReactNode;
47
+ /** 以纯文本渲染(去标签) */
48
+ plain?: boolean;
49
+ /** 纯文本行数截断 */
50
+ lineClamp?: 1 | 2 | 3 | 4;
51
+ };
@@ -0,0 +1,7 @@
1
+ /** Strip tags / decode entities for previews, search, and empty checks. */
2
+ export declare function plainTextFromHtml(html: string | null | undefined): string;
3
+ export declare function isRichTextEmpty(html: string | null | undefined): boolean;
4
+ /** Prefer HTML when present; otherwise wrap plain text with preserved newlines. */
5
+ export declare function normalizeRichTextInput(value: string | null | undefined): string;
6
+ /** True when string looks like HTML from rich editors. */
7
+ export declare function looksLikeHtml(value: string | null | undefined): boolean;
@@ -6,13 +6,23 @@ export type ScrollbarScrollState = {
6
6
  export type ScrollbarProps = {
7
7
  children?: ReactNode;
8
8
  /**
9
- * 滚动条高度;不设则随父容器高度自适应
9
+ * 滚动条高度;不设则随父容器高度自适应。
10
+ * `"100%"` 启用 `is-full-height`(百分比 + 内部 flex 滚动层),适合 grid / 有确定高度的父级。
11
+ * 与 `fill` 互斥语义:flex 列吃剩余高度请用 `fill`,不要用 `"100%"` 冒充 fill。
10
12
  */
11
13
  height?: number | string;
12
14
  /**
13
15
  * 最大高度;超出才出现纵向滚动
14
16
  */
15
17
  maxHeight?: number | string;
18
+ /**
19
+ * 在 flex 列布局中撑满剩余高度(`height:0` + `flex:1`);wrap 为 flex 滚动层(非 absolute)。
20
+ * 父级需为 `display:flex; flex-direction:column` 且自身高度受限(`min-height:0`)。
21
+ * fill 下 view 为 `width:100%`(非 `max-content`)。
22
+ * 外观请改 `--aot-scrollbar-*`;勿在宿主重写 `.aot-scrollbar` 结构样式。
23
+ * @default false
24
+ */
25
+ fill?: boolean;
16
26
  /**
17
27
  * 使用原生滚动条样式
18
28
  * @default false
@@ -1,7 +1,9 @@
1
- import { ReactNode } from 'react';
1
+ import { MouseEventHandler, ReactNode } from 'react';
2
2
  type AppShellProps = {
3
3
  title?: string;
4
+ /** Fired when the titlebar logo is clicked (e.g. secret gestures). */
5
+ onLogoClick?: MouseEventHandler<HTMLButtonElement>;
4
6
  children: ReactNode;
5
7
  };
6
- export declare function AppShell({ title, children }: AppShellProps): import('react').JSX.Element;
8
+ export declare function AppShell({ title, onLogoClick, children, }: AppShellProps): import('react').JSX.Element;
7
9
  export {};
@@ -1,6 +1,8 @@
1
+ import { MouseEventHandler } from 'react';
1
2
  type TitleBarProps = {
2
3
  title?: string;
3
4
  isMaximized: boolean;
5
+ onLogoClick?: MouseEventHandler<HTMLButtonElement>;
4
6
  };
5
- export declare function TitleBar({ title, isMaximized }: TitleBarProps): import('react').JSX.Element;
7
+ export declare function TitleBar({ title, isMaximized, onLogoClick, }: TitleBarProps): import('react').JSX.Element;
6
8
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aot-ui",
3
- "version": "0.2.8",
3
+ "version": "0.2.24",
4
4
  "description": "AOT React UI component kit",
5
5
  "type": "module",
6
6
  "main": "./dist-lib/aot-ui.js",
@@ -35,10 +35,10 @@
35
35
  "prepublishOnly": "npm run build:lib"
36
36
  },
37
37
  "peerDependencies": {
38
+ "@tauri-apps/api": ">=2",
38
39
  "react": ">=18",
39
40
  "react-dom": ">=18",
40
- "react-router-dom": ">=6",
41
- "@tauri-apps/api": ">=2"
41
+ "react-router-dom": ">=6"
42
42
  },
43
43
  "peerDependenciesMeta": {
44
44
  "react-router-dom": {
@@ -49,15 +49,32 @@
49
49
  }
50
50
  },
51
51
  "dependencies": {
52
+ "@tiptap/extension-color": "^3.32.2",
53
+ "@tiptap/extension-highlight": "^3.32.2",
54
+ "@tiptap/extension-image": "^3.32.2",
55
+ "@tiptap/extension-link": "^3.32.2",
56
+ "@tiptap/extension-placeholder": "^3.32.2",
57
+ "@tiptap/extension-table": "^3.32.2",
58
+ "@tiptap/extension-table-cell": "^3.32.2",
59
+ "@tiptap/extension-table-header": "^3.32.2",
60
+ "@tiptap/extension-table-row": "^3.32.2",
61
+ "@tiptap/extension-text-align": "^3.32.2",
62
+ "@tiptap/extension-text-style": "^3.32.2",
63
+ "@tiptap/extension-underline": "^3.32.2",
64
+ "@tiptap/pm": "^3.32.2",
65
+ "@tiptap/react": "^3.32.2",
66
+ "@tiptap/starter-kit": "^3.32.2",
67
+ "dompurify": "^3.4.17",
52
68
  "html-to-image": "^1.11.13",
53
69
  "qrcode": "^1.5.4",
54
- "react-router-dom": "^7.18.5"
70
+ "react-router-dom": ">=6"
55
71
  },
56
72
  "devDependencies": {
57
73
  "@tailwindcss/vite": "^4.3.3",
58
74
  "@tauri-apps/api": "^2.12.4",
59
75
  "@tauri-apps/cli": "^2",
60
76
  "@tauri-apps/plugin-opener": "^2",
77
+ "@types/dompurify": "^3.0.5",
61
78
  "@types/qrcode": "^1.5.6",
62
79
  "@types/react": "^19.1.8",
63
80
  "@types/react-dom": "^19.1.6",