@zhama/a2ui 0.10.2 → 0.10.3
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/dist/a2ui-CnaCcq4c.d.ts +36 -0
- package/dist/a2ui-vyxwZCoa.d.cts +36 -0
- package/dist/context/index.d.cts +27 -0
- package/dist/context/index.d.ts +27 -0
- package/dist/data/index.d.cts +2 -0
- package/dist/data/index.d.ts +2 -0
- package/dist/events/index.d.cts +2 -0
- package/dist/events/index.d.ts +2 -0
- package/dist/index-BJe-XUR4.d.ts +118 -0
- package/dist/index-BWAU7Xp2.d.ts +331 -0
- package/dist/index-Bgqafemj.d.ts +106 -0
- package/dist/index-BltkjFKi.d.ts +67 -0
- package/dist/index-Bzqwwd1k.d.cts +106 -0
- package/dist/index-CEWReOmS.d.ts +16 -0
- package/dist/index-CLn74O53.d.cts +67 -0
- package/dist/index-CfuPxsd1.d.cts +16 -0
- package/dist/index-DCv59E9u.d.cts +331 -0
- package/dist/index-DKh6MRhF.d.cts +118 -0
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/styles/index.d.cts +2 -0
- package/dist/styles/index.d.ts +2 -0
- package/dist/types/index.d.cts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types-CtrG7MJe.d.cts +475 -0
- package/dist/types-CtrG7MJe.d.ts +475 -0
- package/dist/ui/index.d.cts +5 -0
- package/dist/ui/index.d.ts +5 -0
- package/package.json +1 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { A as Action, E as AnyComponentNode } from './types-CtrG7MJe.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A2UI Base Event Types
|
|
5
|
+
*/
|
|
6
|
+
interface BaseEventDetail<EventType extends string> {
|
|
7
|
+
readonly eventType: EventType;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A2UI Action Event Types
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
type Namespace = 'a2ui';
|
|
15
|
+
interface A2UIAction extends BaseEventDetail<`${Namespace}.action`> {
|
|
16
|
+
readonly action: Action;
|
|
17
|
+
readonly dataContextPath: string;
|
|
18
|
+
readonly sourceComponentId: string;
|
|
19
|
+
readonly sourceComponent: AnyComponentNode | null;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A2UI 事件类型映射
|
|
23
|
+
*/
|
|
24
|
+
interface A2UIEventDetailMap {
|
|
25
|
+
'a2ui.action': A2UIAction;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A2UI 事件名称
|
|
29
|
+
*/
|
|
30
|
+
declare const A2UI_EVENT_NAME: "a2uiaction";
|
|
31
|
+
/**
|
|
32
|
+
* A2UI 事件类型
|
|
33
|
+
*/
|
|
34
|
+
type A2UIEventType = keyof A2UIEventDetailMap;
|
|
35
|
+
|
|
36
|
+
export { type A2UIAction as A, type BaseEventDetail as B, type A2UIEventDetailMap as a, type A2UIEventType as b, A2UI_EVENT_NAME as c };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { A as Action, E as AnyComponentNode } from './types-CtrG7MJe.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A2UI Base Event Types
|
|
5
|
+
*/
|
|
6
|
+
interface BaseEventDetail<EventType extends string> {
|
|
7
|
+
readonly eventType: EventType;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A2UI Action Event Types
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
type Namespace = 'a2ui';
|
|
15
|
+
interface A2UIAction extends BaseEventDetail<`${Namespace}.action`> {
|
|
16
|
+
readonly action: Action;
|
|
17
|
+
readonly dataContextPath: string;
|
|
18
|
+
readonly sourceComponentId: string;
|
|
19
|
+
readonly sourceComponent: AnyComponentNode | null;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A2UI 事件类型映射
|
|
23
|
+
*/
|
|
24
|
+
interface A2UIEventDetailMap {
|
|
25
|
+
'a2ui.action': A2UIAction;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A2UI 事件名称
|
|
29
|
+
*/
|
|
30
|
+
declare const A2UI_EVENT_NAME: "a2uiaction";
|
|
31
|
+
/**
|
|
32
|
+
* A2UI 事件类型
|
|
33
|
+
*/
|
|
34
|
+
type A2UIEventType = keyof A2UIEventDetailMap;
|
|
35
|
+
|
|
36
|
+
export { type A2UIAction as A, type BaseEventDetail as B, type A2UIEventDetailMap as a, type A2UIEventType as b, A2UI_EVENT_NAME as c };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { j as Theme, i as MessageProcessor, ao as SurfaceID } from '../types-CtrG7MJe.cjs';
|
|
5
|
+
|
|
6
|
+
declare const ThemeContext: react.Context<Theme>;
|
|
7
|
+
interface ThemeProviderProps {
|
|
8
|
+
theme?: Theme;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function ThemeProvider({ theme, children }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
12
|
+
declare function useTheme(): Theme;
|
|
13
|
+
|
|
14
|
+
interface ProcessorContextValue {
|
|
15
|
+
processor: MessageProcessor | null;
|
|
16
|
+
surfaceId: SurfaceID | null;
|
|
17
|
+
}
|
|
18
|
+
declare const ProcessorContext: react.Context<ProcessorContextValue>;
|
|
19
|
+
interface ProcessorProviderProps {
|
|
20
|
+
processor: MessageProcessor | null;
|
|
21
|
+
surfaceId?: SurfaceID;
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
declare function ProcessorProvider({ processor, surfaceId, children, }: ProcessorProviderProps): react_jsx_runtime.JSX.Element;
|
|
25
|
+
declare function useProcessor(): ProcessorContextValue;
|
|
26
|
+
|
|
27
|
+
export { ProcessorContext, ProcessorProvider, type ProcessorProviderProps, ThemeContext, ThemeProvider, type ThemeProviderProps, useProcessor, useTheme };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
import { j as Theme, i as MessageProcessor, ao as SurfaceID } from '../types-CtrG7MJe.js';
|
|
5
|
+
|
|
6
|
+
declare const ThemeContext: react.Context<Theme>;
|
|
7
|
+
interface ThemeProviderProps {
|
|
8
|
+
theme?: Theme;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function ThemeProvider({ theme, children }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
|
|
12
|
+
declare function useTheme(): Theme;
|
|
13
|
+
|
|
14
|
+
interface ProcessorContextValue {
|
|
15
|
+
processor: MessageProcessor | null;
|
|
16
|
+
surfaceId: SurfaceID | null;
|
|
17
|
+
}
|
|
18
|
+
declare const ProcessorContext: react.Context<ProcessorContextValue>;
|
|
19
|
+
interface ProcessorProviderProps {
|
|
20
|
+
processor: MessageProcessor | null;
|
|
21
|
+
surfaceId?: SurfaceID;
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
declare function ProcessorProvider({ processor, surfaceId, children, }: ProcessorProviderProps): react_jsx_runtime.JSX.Element;
|
|
25
|
+
declare function useProcessor(): ProcessorContextValue;
|
|
26
|
+
|
|
27
|
+
export { ProcessorContext, ProcessorProvider, type ProcessorProviderProps, ThemeContext, ThemeProvider, type ThemeProviderProps, useProcessor, useTheme };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { A as A2uiMessageProcessor, c as createMessageProcessor, j as isAnyComponentNode, h as isBooleanValue, e as isComponentArrayReference, g as isNumberValue, d as isObject, b as isPath, k as isResolvedAudioPlayer, l as isResolvedButton, m as isResolvedCard, n as isResolvedCheckbox, o as isResolvedColumn, p as isResolvedDateTimeInput, q as isResolvedDivider, s as isResolvedIcon, r as isResolvedImage, t as isResolvedList, u as isResolvedModal, v as isResolvedMultipleChoice, w as isResolvedRow, x as isResolvedSlider, y as isResolvedTabItem, z as isResolvedTabs, B as isResolvedText, C as isResolvedTextField, D as isResolvedVideo, f as isStringValue, a as isValueMap } from '../index-DKh6MRhF.cjs';
|
|
2
|
+
import '../types-CtrG7MJe.cjs';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { A as A2uiMessageProcessor, c as createMessageProcessor, j as isAnyComponentNode, h as isBooleanValue, e as isComponentArrayReference, g as isNumberValue, d as isObject, b as isPath, k as isResolvedAudioPlayer, l as isResolvedButton, m as isResolvedCard, n as isResolvedCheckbox, o as isResolvedColumn, p as isResolvedDateTimeInput, q as isResolvedDivider, s as isResolvedIcon, r as isResolvedImage, t as isResolvedList, u as isResolvedModal, v as isResolvedMultipleChoice, w as isResolvedRow, x as isResolvedSlider, y as isResolvedTabItem, z as isResolvedTabs, B as isResolvedText, C as isResolvedTextField, D as isResolvedVideo, f as isStringValue, a as isValueMap } from '../index-BJe-XUR4.js';
|
|
2
|
+
import '../types-CtrG7MJe.js';
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { v as ValueMap, p as ComponentArrayReference, S as StringValue, N as NumberValue, B as BooleanValue, E as AnyComponentNode, a8 as ResolvedAudioPlayer, ah as ResolvedButton, aj as ResolvedCard, aa as ResolvedCheckbox, ag as ResolvedColumn, ac as ResolvedDateTimeInput, a9 as ResolvedDivider, a6 as ResolvedImage, a5 as ResolvedIcon, ai as ResolvedList, am as ResolvedModal, ad as ResolvedMultipleChoice, af as ResolvedRow, ae as ResolvedSlider, ak as ResolvedTabItem, al as ResolvedTabs, a4 as ResolvedText, ab as ResolvedTextField, a7 as ResolvedVideo, i as MessageProcessor, ap as Surface, x as ServerToClientMessage, k as DataValue } from './types-CtrG7MJe.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A2UI Type Guards
|
|
5
|
+
* 类型守卫函数
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
declare function isValueMap(value: unknown): value is ValueMap;
|
|
9
|
+
declare function isPath(key: string, value: unknown): value is string;
|
|
10
|
+
declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
11
|
+
declare function isComponentArrayReference(value: unknown): value is ComponentArrayReference;
|
|
12
|
+
declare function isStringValue(value: unknown): value is StringValue;
|
|
13
|
+
declare function isNumberValue(value: unknown): value is NumberValue;
|
|
14
|
+
declare function isBooleanValue(value: unknown): value is BooleanValue;
|
|
15
|
+
declare function isAnyComponentNode(value: unknown): value is AnyComponentNode;
|
|
16
|
+
declare function isResolvedAudioPlayer(props: unknown): props is ResolvedAudioPlayer;
|
|
17
|
+
declare function isResolvedButton(props: unknown): props is ResolvedButton;
|
|
18
|
+
declare function isResolvedCard(props: unknown): props is ResolvedCard;
|
|
19
|
+
declare function isResolvedCheckbox(props: unknown): props is ResolvedCheckbox;
|
|
20
|
+
declare function isResolvedColumn(props: unknown): props is ResolvedColumn;
|
|
21
|
+
declare function isResolvedDateTimeInput(props: unknown): props is ResolvedDateTimeInput;
|
|
22
|
+
declare function isResolvedDivider(props: unknown): props is ResolvedDivider;
|
|
23
|
+
declare function isResolvedImage(props: unknown): props is ResolvedImage;
|
|
24
|
+
declare function isResolvedIcon(props: unknown): props is ResolvedIcon;
|
|
25
|
+
declare function isResolvedList(props: unknown): props is ResolvedList;
|
|
26
|
+
declare function isResolvedModal(props: unknown): props is ResolvedModal;
|
|
27
|
+
declare function isResolvedMultipleChoice(props: unknown): props is ResolvedMultipleChoice;
|
|
28
|
+
declare function isResolvedRow(props: unknown): props is ResolvedRow;
|
|
29
|
+
declare function isResolvedSlider(props: unknown): props is ResolvedSlider;
|
|
30
|
+
declare function isResolvedTabItem(item: unknown): item is ResolvedTabItem;
|
|
31
|
+
declare function isResolvedTabs(props: unknown): props is ResolvedTabs;
|
|
32
|
+
declare function isResolvedText(props: unknown): props is ResolvedText;
|
|
33
|
+
declare function isResolvedTextField(props: unknown): props is ResolvedTextField;
|
|
34
|
+
declare function isResolvedVideo(props: unknown): props is ResolvedVideo;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A2UI Message Processor
|
|
38
|
+
* 处理并整合服务器消息,构建 UI Surface 层级模型
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
declare class A2uiMessageProcessor implements MessageProcessor {
|
|
42
|
+
static readonly DEFAULT_SURFACE_ID = "@default";
|
|
43
|
+
private mapCtor;
|
|
44
|
+
private arrayCtor;
|
|
45
|
+
private setCtor;
|
|
46
|
+
private objCtor;
|
|
47
|
+
private surfaces;
|
|
48
|
+
constructor(opts?: {
|
|
49
|
+
mapCtor?: MapConstructor;
|
|
50
|
+
arrayCtor?: ArrayConstructor;
|
|
51
|
+
setCtor?: SetConstructor;
|
|
52
|
+
objCtor?: ObjectConstructor;
|
|
53
|
+
});
|
|
54
|
+
getSurfaces(): ReadonlyMap<string, Surface>;
|
|
55
|
+
clearSurfaces(): void;
|
|
56
|
+
processMessages(messages: ServerToClientMessage[]): void;
|
|
57
|
+
getData(node: AnyComponentNode, relativePath: string, surfaceId?: string): DataValue | null;
|
|
58
|
+
setData(node: AnyComponentNode | null, relativePath: string, value: DataValue, surfaceId?: string): void;
|
|
59
|
+
resolvePath(path: string, dataContextPath?: string): string;
|
|
60
|
+
private parseIfJsonString;
|
|
61
|
+
private convertKeyValueArrayToMap;
|
|
62
|
+
private setDataByPath;
|
|
63
|
+
private normalizePath;
|
|
64
|
+
private getDataByPath;
|
|
65
|
+
private getOrCreateSurface;
|
|
66
|
+
private handleBeginRendering;
|
|
67
|
+
private handleSurfaceUpdate;
|
|
68
|
+
private handleDataModelUpdate;
|
|
69
|
+
private handleDeleteSurface;
|
|
70
|
+
private rebuildComponentTree;
|
|
71
|
+
private findValueKey;
|
|
72
|
+
private buildNodeRecursive;
|
|
73
|
+
private resolvePropertyValue;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* 创建默认的消息处理器
|
|
77
|
+
*/
|
|
78
|
+
declare function createMessageProcessor(): A2uiMessageProcessor;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* A2UI Data Module
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
type index_A2uiMessageProcessor = A2uiMessageProcessor;
|
|
85
|
+
declare const index_A2uiMessageProcessor: typeof A2uiMessageProcessor;
|
|
86
|
+
declare const index_createMessageProcessor: typeof createMessageProcessor;
|
|
87
|
+
declare const index_isAnyComponentNode: typeof isAnyComponentNode;
|
|
88
|
+
declare const index_isBooleanValue: typeof isBooleanValue;
|
|
89
|
+
declare const index_isComponentArrayReference: typeof isComponentArrayReference;
|
|
90
|
+
declare const index_isNumberValue: typeof isNumberValue;
|
|
91
|
+
declare const index_isObject: typeof isObject;
|
|
92
|
+
declare const index_isPath: typeof isPath;
|
|
93
|
+
declare const index_isResolvedAudioPlayer: typeof isResolvedAudioPlayer;
|
|
94
|
+
declare const index_isResolvedButton: typeof isResolvedButton;
|
|
95
|
+
declare const index_isResolvedCard: typeof isResolvedCard;
|
|
96
|
+
declare const index_isResolvedCheckbox: typeof isResolvedCheckbox;
|
|
97
|
+
declare const index_isResolvedColumn: typeof isResolvedColumn;
|
|
98
|
+
declare const index_isResolvedDateTimeInput: typeof isResolvedDateTimeInput;
|
|
99
|
+
declare const index_isResolvedDivider: typeof isResolvedDivider;
|
|
100
|
+
declare const index_isResolvedIcon: typeof isResolvedIcon;
|
|
101
|
+
declare const index_isResolvedImage: typeof isResolvedImage;
|
|
102
|
+
declare const index_isResolvedList: typeof isResolvedList;
|
|
103
|
+
declare const index_isResolvedModal: typeof isResolvedModal;
|
|
104
|
+
declare const index_isResolvedMultipleChoice: typeof isResolvedMultipleChoice;
|
|
105
|
+
declare const index_isResolvedRow: typeof isResolvedRow;
|
|
106
|
+
declare const index_isResolvedSlider: typeof isResolvedSlider;
|
|
107
|
+
declare const index_isResolvedTabItem: typeof isResolvedTabItem;
|
|
108
|
+
declare const index_isResolvedTabs: typeof isResolvedTabs;
|
|
109
|
+
declare const index_isResolvedText: typeof isResolvedText;
|
|
110
|
+
declare const index_isResolvedTextField: typeof isResolvedTextField;
|
|
111
|
+
declare const index_isResolvedVideo: typeof isResolvedVideo;
|
|
112
|
+
declare const index_isStringValue: typeof isStringValue;
|
|
113
|
+
declare const index_isValueMap: typeof isValueMap;
|
|
114
|
+
declare namespace index {
|
|
115
|
+
export { index_A2uiMessageProcessor as A2uiMessageProcessor, index_createMessageProcessor as createMessageProcessor, index_isAnyComponentNode as isAnyComponentNode, index_isBooleanValue as isBooleanValue, index_isComponentArrayReference as isComponentArrayReference, index_isNumberValue as isNumberValue, index_isObject as isObject, index_isPath as isPath, index_isResolvedAudioPlayer as isResolvedAudioPlayer, index_isResolvedButton as isResolvedButton, index_isResolvedCard as isResolvedCard, index_isResolvedCheckbox as isResolvedCheckbox, index_isResolvedColumn as isResolvedColumn, index_isResolvedDateTimeInput as isResolvedDateTimeInput, index_isResolvedDivider as isResolvedDivider, index_isResolvedIcon as isResolvedIcon, index_isResolvedImage as isResolvedImage, index_isResolvedList as isResolvedList, index_isResolvedModal as isResolvedModal, index_isResolvedMultipleChoice as isResolvedMultipleChoice, index_isResolvedRow as isResolvedRow, index_isResolvedSlider as isResolvedSlider, index_isResolvedTabItem as isResolvedTabItem, index_isResolvedTabs as isResolvedTabs, index_isResolvedText as isResolvedText, index_isResolvedTextField as isResolvedTextField, index_isResolvedVideo as isResolvedVideo, index_isStringValue as isStringValue, index_isValueMap as isValueMap };
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { A2uiMessageProcessor as A, isResolvedText as B, isResolvedTextField as C, isResolvedVideo as D, isValueMap as a, isPath as b, createMessageProcessor as c, isObject as d, isComponentArrayReference as e, isStringValue as f, isNumberValue as g, isBooleanValue as h, index as i, isAnyComponentNode as j, isResolvedAudioPlayer as k, isResolvedButton as l, isResolvedCard as m, isResolvedCheckbox as n, isResolvedColumn as o, isResolvedDateTimeInput as p, isResolvedDivider as q, isResolvedImage as r, isResolvedIcon as s, isResolvedList as t, isResolvedModal as u, isResolvedMultipleChoice as v, isResolvedRow as w, isResolvedSlider as x, isResolvedTabItem as y, isResolvedTabs as z };
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { E as AnyComponentNode, i as MessageProcessor, ao as SurfaceID, a4 as ResolvedText, a6 as ResolvedImage, a5 as ResolvedIcon, a7 as ResolvedVideo, a8 as ResolvedAudioPlayer, ah as ResolvedButton, af as ResolvedRow, ag as ResolvedColumn, ai as ResolvedList, S as StringValue, a9 as ResolvedDivider, aa as ResolvedCheckbox, ab as ResolvedTextField, ac as ResolvedDateTimeInput, ad as ResolvedMultipleChoice, ae as ResolvedSlider, ap as Surface$1, N as NumberValue } from './types-CtrG7MJe.js';
|
|
3
|
+
import { ReactNode, ComponentType } from 'react';
|
|
4
|
+
import { A as A2UIAction } from './a2ui-CnaCcq4c.js';
|
|
5
|
+
|
|
6
|
+
interface TextProps {
|
|
7
|
+
component: AnyComponentNode;
|
|
8
|
+
processor: MessageProcessor | null;
|
|
9
|
+
surfaceId: SurfaceID | null;
|
|
10
|
+
text: ResolvedText['text'];
|
|
11
|
+
usageHint?: ResolvedText['usageHint'];
|
|
12
|
+
/**
|
|
13
|
+
* 是否使用 markdown 渲染
|
|
14
|
+
* @default true
|
|
15
|
+
*/
|
|
16
|
+
markdown?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare function Text({ component, processor, surfaceId, text, usageHint, markdown, }: TextProps): react_jsx_runtime.JSX.Element;
|
|
19
|
+
|
|
20
|
+
interface ImageProps {
|
|
21
|
+
component: AnyComponentNode;
|
|
22
|
+
processor: MessageProcessor | null;
|
|
23
|
+
surfaceId: SurfaceID | null;
|
|
24
|
+
url: ResolvedImage['url'];
|
|
25
|
+
usageHint?: ResolvedImage['usageHint'];
|
|
26
|
+
fit?: ResolvedImage['fit'];
|
|
27
|
+
}
|
|
28
|
+
declare function Image({ component, processor, surfaceId, url, usageHint, fit, }: ImageProps): react_jsx_runtime.JSX.Element;
|
|
29
|
+
|
|
30
|
+
interface IconProps {
|
|
31
|
+
component: AnyComponentNode;
|
|
32
|
+
processor: MessageProcessor | null;
|
|
33
|
+
surfaceId: SurfaceID | null;
|
|
34
|
+
name: ResolvedIcon['name'];
|
|
35
|
+
size?: number | string;
|
|
36
|
+
className?: string;
|
|
37
|
+
/**
|
|
38
|
+
* 是否使用容器包裹 (类似首页风格)
|
|
39
|
+
*/
|
|
40
|
+
container?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* 容器颜色变体: blue, green, purple, orange, primary, etc.
|
|
43
|
+
*/
|
|
44
|
+
variant?: string;
|
|
45
|
+
}
|
|
46
|
+
declare function Icon({ component, processor, surfaceId, name, size, className, container, variant, }: IconProps): react_jsx_runtime.JSX.Element | null;
|
|
47
|
+
|
|
48
|
+
interface VideoProps {
|
|
49
|
+
component: AnyComponentNode;
|
|
50
|
+
processor: MessageProcessor | null;
|
|
51
|
+
surfaceId: SurfaceID | null;
|
|
52
|
+
url: ResolvedVideo['url'];
|
|
53
|
+
}
|
|
54
|
+
declare function Video({ component, processor, surfaceId, url }: VideoProps): react_jsx_runtime.JSX.Element;
|
|
55
|
+
|
|
56
|
+
interface AudioProps {
|
|
57
|
+
component: AnyComponentNode;
|
|
58
|
+
processor: MessageProcessor | null;
|
|
59
|
+
surfaceId: SurfaceID | null;
|
|
60
|
+
url: ResolvedAudioPlayer['url'];
|
|
61
|
+
description?: ResolvedAudioPlayer['description'];
|
|
62
|
+
}
|
|
63
|
+
declare function Audio({ component, processor, surfaceId, url, description }: AudioProps): react_jsx_runtime.JSX.Element;
|
|
64
|
+
|
|
65
|
+
interface ButtonProps {
|
|
66
|
+
component: AnyComponentNode;
|
|
67
|
+
processor: MessageProcessor | null;
|
|
68
|
+
surfaceId: SurfaceID | null;
|
|
69
|
+
action: ResolvedButton['action'];
|
|
70
|
+
children?: ReactNode;
|
|
71
|
+
onAction?: (event: A2UIAction) => void;
|
|
72
|
+
}
|
|
73
|
+
declare function Button({ component, action, children, onAction }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
74
|
+
|
|
75
|
+
interface RowProps {
|
|
76
|
+
component: AnyComponentNode;
|
|
77
|
+
processor: MessageProcessor | null;
|
|
78
|
+
surfaceId: SurfaceID | null;
|
|
79
|
+
alignment?: ResolvedRow['alignment'];
|
|
80
|
+
distribution?: ResolvedRow['distribution'];
|
|
81
|
+
children?: ReactNode;
|
|
82
|
+
}
|
|
83
|
+
declare function Row({ component, alignment, distribution, children, }: RowProps): react_jsx_runtime.JSX.Element;
|
|
84
|
+
|
|
85
|
+
interface ColumnProps {
|
|
86
|
+
component: AnyComponentNode;
|
|
87
|
+
processor: MessageProcessor | null;
|
|
88
|
+
surfaceId: SurfaceID | null;
|
|
89
|
+
alignment?: ResolvedColumn['alignment'];
|
|
90
|
+
distribution?: ResolvedColumn['distribution'];
|
|
91
|
+
children?: ReactNode;
|
|
92
|
+
}
|
|
93
|
+
declare function Column({ component, alignment, distribution, children, }: ColumnProps): react_jsx_runtime.JSX.Element;
|
|
94
|
+
|
|
95
|
+
interface ListProps {
|
|
96
|
+
component: AnyComponentNode;
|
|
97
|
+
processor: MessageProcessor | null;
|
|
98
|
+
surfaceId: SurfaceID | null;
|
|
99
|
+
direction?: ResolvedList['direction'];
|
|
100
|
+
children?: ReactNode;
|
|
101
|
+
}
|
|
102
|
+
declare function List({ direction, children }: ListProps): react_jsx_runtime.JSX.Element;
|
|
103
|
+
|
|
104
|
+
interface CardProps {
|
|
105
|
+
component: AnyComponentNode;
|
|
106
|
+
processor: MessageProcessor | null;
|
|
107
|
+
surfaceId: SurfaceID | null;
|
|
108
|
+
children?: ReactNode;
|
|
109
|
+
}
|
|
110
|
+
declare function Card({ children }: CardProps): react_jsx_runtime.JSX.Element;
|
|
111
|
+
|
|
112
|
+
interface TabsProps {
|
|
113
|
+
component: AnyComponentNode;
|
|
114
|
+
processor: MessageProcessor | null;
|
|
115
|
+
surfaceId: SurfaceID | null;
|
|
116
|
+
titles: StringValue[];
|
|
117
|
+
children?: ReactNode[];
|
|
118
|
+
}
|
|
119
|
+
declare function Tabs({ component, processor, surfaceId, titles, children }: TabsProps): react_jsx_runtime.JSX.Element;
|
|
120
|
+
|
|
121
|
+
interface DividerProps {
|
|
122
|
+
component: AnyComponentNode;
|
|
123
|
+
processor: MessageProcessor | null;
|
|
124
|
+
surfaceId: SurfaceID | null;
|
|
125
|
+
axis?: ResolvedDivider['axis'];
|
|
126
|
+
thickness?: ResolvedDivider['thickness'];
|
|
127
|
+
color?: ResolvedDivider['color'];
|
|
128
|
+
}
|
|
129
|
+
declare function Divider({ axis, thickness, color }: DividerProps): react_jsx_runtime.JSX.Element;
|
|
130
|
+
|
|
131
|
+
interface ModalProps {
|
|
132
|
+
component: AnyComponentNode;
|
|
133
|
+
processor: MessageProcessor | null;
|
|
134
|
+
surfaceId: SurfaceID | null;
|
|
135
|
+
entryPoint?: ReactNode;
|
|
136
|
+
content?: ReactNode;
|
|
137
|
+
}
|
|
138
|
+
declare function Modal({ entryPoint, content }: ModalProps): react_jsx_runtime.JSX.Element;
|
|
139
|
+
|
|
140
|
+
interface CheckboxProps {
|
|
141
|
+
component: AnyComponentNode;
|
|
142
|
+
processor: MessageProcessor | null;
|
|
143
|
+
surfaceId: SurfaceID | null;
|
|
144
|
+
label: ResolvedCheckbox['label'];
|
|
145
|
+
value: ResolvedCheckbox['value'];
|
|
146
|
+
}
|
|
147
|
+
declare function Checkbox({ component, processor, surfaceId, label, value }: CheckboxProps): react_jsx_runtime.JSX.Element;
|
|
148
|
+
|
|
149
|
+
interface TextFieldProps {
|
|
150
|
+
component: AnyComponentNode;
|
|
151
|
+
processor: MessageProcessor | null;
|
|
152
|
+
surfaceId: SurfaceID | null;
|
|
153
|
+
label: ResolvedTextField['label'];
|
|
154
|
+
text?: ResolvedTextField['text'];
|
|
155
|
+
type?: ResolvedTextField['type'];
|
|
156
|
+
validationRegexp?: ResolvedTextField['validationRegexp'];
|
|
157
|
+
}
|
|
158
|
+
declare function TextField({ component, processor, surfaceId, label, text, type, }: TextFieldProps): react_jsx_runtime.JSX.Element;
|
|
159
|
+
|
|
160
|
+
interface DateTimeInputProps {
|
|
161
|
+
component: AnyComponentNode;
|
|
162
|
+
processor: MessageProcessor | null;
|
|
163
|
+
surfaceId: SurfaceID | null;
|
|
164
|
+
value: ResolvedDateTimeInput['value'];
|
|
165
|
+
enableDate?: ResolvedDateTimeInput['enableDate'];
|
|
166
|
+
enableTime?: ResolvedDateTimeInput['enableTime'];
|
|
167
|
+
}
|
|
168
|
+
declare function DateTimeInput({ component, processor, surfaceId, value, enableDate, enableTime, }: DateTimeInputProps): react_jsx_runtime.JSX.Element;
|
|
169
|
+
|
|
170
|
+
interface MultipleChoiceProps {
|
|
171
|
+
component: AnyComponentNode;
|
|
172
|
+
processor: MessageProcessor | null;
|
|
173
|
+
surfaceId: SurfaceID | null;
|
|
174
|
+
selections: ResolvedMultipleChoice['selections'];
|
|
175
|
+
options?: ResolvedMultipleChoice['options'];
|
|
176
|
+
maxAllowedSelections?: ResolvedMultipleChoice['maxAllowedSelections'];
|
|
177
|
+
}
|
|
178
|
+
declare function MultipleChoice({ component, processor, surfaceId, selections, options, }: MultipleChoiceProps): react_jsx_runtime.JSX.Element;
|
|
179
|
+
|
|
180
|
+
interface SliderProps {
|
|
181
|
+
component: AnyComponentNode;
|
|
182
|
+
processor: MessageProcessor | null;
|
|
183
|
+
surfaceId: SurfaceID | null;
|
|
184
|
+
value: ResolvedSlider['value'];
|
|
185
|
+
minValue?: ResolvedSlider['minValue'];
|
|
186
|
+
maxValue?: ResolvedSlider['maxValue'];
|
|
187
|
+
}
|
|
188
|
+
declare function Slider({ component, processor, surfaceId, value, minValue, maxValue, }: SliderProps): react_jsx_runtime.JSX.Element;
|
|
189
|
+
|
|
190
|
+
interface RootProps {
|
|
191
|
+
processor: MessageProcessor | null;
|
|
192
|
+
surfaceId: SurfaceID | null;
|
|
193
|
+
childComponents: AnyComponentNode[] | null;
|
|
194
|
+
enableCustomElements?: boolean;
|
|
195
|
+
onAction?: (event: A2UIAction) => void;
|
|
196
|
+
}
|
|
197
|
+
declare function Root({ processor, surfaceId, childComponents, enableCustomElements, onAction, }: RootProps): react_jsx_runtime.JSX.Element | null;
|
|
198
|
+
interface ComponentRendererProps {
|
|
199
|
+
component: AnyComponentNode;
|
|
200
|
+
processor: MessageProcessor | null;
|
|
201
|
+
surfaceId: SurfaceID | null;
|
|
202
|
+
enableCustomElements: boolean;
|
|
203
|
+
onAction?: (event: A2UIAction) => void;
|
|
204
|
+
}
|
|
205
|
+
declare function ComponentRenderer({ component, processor, surfaceId, enableCustomElements, onAction, }: ComponentRendererProps): ReactNode;
|
|
206
|
+
|
|
207
|
+
interface SurfaceProps {
|
|
208
|
+
surfaceId: SurfaceID;
|
|
209
|
+
surface: Surface$1 | null;
|
|
210
|
+
processor: MessageProcessor | null;
|
|
211
|
+
enableCustomElements?: boolean;
|
|
212
|
+
onAction?: (event: A2UIAction) => void;
|
|
213
|
+
}
|
|
214
|
+
declare function Surface({ surfaceId, surface, processor, enableCustomElements, onAction, }: SurfaceProps): react_jsx_runtime.JSX.Element | null;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* A2UI Component Registry
|
|
218
|
+
*/
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* 组件 Props 基础接口
|
|
222
|
+
*/
|
|
223
|
+
interface A2UIComponentProps {
|
|
224
|
+
component: AnyComponentNode;
|
|
225
|
+
processor: MessageProcessor | null;
|
|
226
|
+
surfaceId: SurfaceID | null;
|
|
227
|
+
childComponents?: AnyComponentNode[] | null;
|
|
228
|
+
enableCustomElements?: boolean;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* 组件注册项
|
|
232
|
+
*/
|
|
233
|
+
type RegisteredComponent = ComponentType<A2UIComponentProps & Record<string, unknown>>;
|
|
234
|
+
/**
|
|
235
|
+
* 组件注册表
|
|
236
|
+
*/
|
|
237
|
+
declare class ComponentRegistry {
|
|
238
|
+
private registry;
|
|
239
|
+
/**
|
|
240
|
+
* 注册组件
|
|
241
|
+
*/
|
|
242
|
+
register(typeName: string, component: RegisteredComponent): void;
|
|
243
|
+
/**
|
|
244
|
+
* 获取组件
|
|
245
|
+
*/
|
|
246
|
+
get(typeName: string): RegisteredComponent | undefined;
|
|
247
|
+
/**
|
|
248
|
+
* 检查组件是否已注册
|
|
249
|
+
*/
|
|
250
|
+
has(typeName: string): boolean;
|
|
251
|
+
/**
|
|
252
|
+
* 注销组件
|
|
253
|
+
*/
|
|
254
|
+
unregister(typeName: string): boolean;
|
|
255
|
+
/**
|
|
256
|
+
* 获取所有已注册的组件类型
|
|
257
|
+
*/
|
|
258
|
+
getRegisteredTypes(): string[];
|
|
259
|
+
}
|
|
260
|
+
declare const componentRegistry: ComponentRegistry;
|
|
261
|
+
|
|
262
|
+
interface MarkdownProps {
|
|
263
|
+
children: string;
|
|
264
|
+
className?: string;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Markdown 渲染组件
|
|
268
|
+
*/
|
|
269
|
+
declare function Markdown({ children, className }: MarkdownProps): react_jsx_runtime.JSX.Element;
|
|
270
|
+
/**
|
|
271
|
+
* 简单的 markdown 到 HTML 转换
|
|
272
|
+
* 注意:这个函数返回一个 React 元素,不是原始 HTML 字符串
|
|
273
|
+
*/
|
|
274
|
+
declare function renderMarkdown(value: string): ReactNode;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* A2UI UI Utilities
|
|
278
|
+
*/
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* 从 StringValue 提取实际字符串值
|
|
282
|
+
*/
|
|
283
|
+
declare function extractStringValue(val: StringValue | null, component: AnyComponentNode | null, processor: MessageProcessor | null, surfaceId: string | null): string;
|
|
284
|
+
/**
|
|
285
|
+
* 从 NumberValue 提取实际数字值
|
|
286
|
+
*/
|
|
287
|
+
declare function extractNumberValue(val: NumberValue | null, component: AnyComponentNode | null, processor: MessageProcessor | null, surfaceId: string | null): number;
|
|
288
|
+
/**
|
|
289
|
+
* 合并 className
|
|
290
|
+
*/
|
|
291
|
+
declare function cn(...classes: (string | Record<string, boolean> | undefined | null | false)[]): string;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* A2UI UI Module
|
|
295
|
+
*/
|
|
296
|
+
|
|
297
|
+
type index_A2UIComponentProps = A2UIComponentProps;
|
|
298
|
+
declare const index_Audio: typeof Audio;
|
|
299
|
+
declare const index_Button: typeof Button;
|
|
300
|
+
declare const index_Card: typeof Card;
|
|
301
|
+
declare const index_Checkbox: typeof Checkbox;
|
|
302
|
+
declare const index_Column: typeof Column;
|
|
303
|
+
type index_ComponentRegistry = ComponentRegistry;
|
|
304
|
+
declare const index_ComponentRegistry: typeof ComponentRegistry;
|
|
305
|
+
declare const index_ComponentRenderer: typeof ComponentRenderer;
|
|
306
|
+
declare const index_DateTimeInput: typeof DateTimeInput;
|
|
307
|
+
declare const index_Divider: typeof Divider;
|
|
308
|
+
declare const index_Icon: typeof Icon;
|
|
309
|
+
declare const index_Image: typeof Image;
|
|
310
|
+
declare const index_List: typeof List;
|
|
311
|
+
declare const index_Markdown: typeof Markdown;
|
|
312
|
+
declare const index_Modal: typeof Modal;
|
|
313
|
+
declare const index_MultipleChoice: typeof MultipleChoice;
|
|
314
|
+
declare const index_Root: typeof Root;
|
|
315
|
+
declare const index_Row: typeof Row;
|
|
316
|
+
declare const index_Slider: typeof Slider;
|
|
317
|
+
declare const index_Surface: typeof Surface;
|
|
318
|
+
declare const index_Tabs: typeof Tabs;
|
|
319
|
+
declare const index_Text: typeof Text;
|
|
320
|
+
declare const index_TextField: typeof TextField;
|
|
321
|
+
declare const index_Video: typeof Video;
|
|
322
|
+
declare const index_cn: typeof cn;
|
|
323
|
+
declare const index_componentRegistry: typeof componentRegistry;
|
|
324
|
+
declare const index_extractNumberValue: typeof extractNumberValue;
|
|
325
|
+
declare const index_extractStringValue: typeof extractStringValue;
|
|
326
|
+
declare const index_renderMarkdown: typeof renderMarkdown;
|
|
327
|
+
declare namespace index {
|
|
328
|
+
export { type index_A2UIComponentProps as A2UIComponentProps, index_Audio as Audio, index_Button as Button, index_Card as Card, index_Checkbox as Checkbox, index_Column as Column, index_ComponentRegistry as ComponentRegistry, index_ComponentRenderer as ComponentRenderer, index_DateTimeInput as DateTimeInput, index_Divider as Divider, index_Icon as Icon, index_Image as Image, index_List as List, index_Markdown as Markdown, index_Modal as Modal, index_MultipleChoice as MultipleChoice, index_Root as Root, index_Row as Row, index_Slider as Slider, index_Surface as Surface, index_Tabs as Tabs, index_Text as Text, index_TextField as TextField, index_Video as Video, index_cn as cn, index_componentRegistry as componentRegistry, index_extractNumberValue as extractNumberValue, index_extractStringValue as extractStringValue, index_renderMarkdown as renderMarkdown };
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export { Audio as A, Button as B, Column as C, Divider as D, Image as I, List as L, MultipleChoice as M, Row as R, Slider as S, Text as T, Video as V, Icon as a, Card as b, Checkbox as c, TextField as d, DateTimeInput as e, Tabs as f, Modal as g, Root as h, index as i, Surface as j, ComponentRenderer as k, Markdown as l, ComponentRegistry as m, componentRegistry as n, type A2UIComponentProps as o, extractStringValue as p, extractNumberValue as q, renderMarkdown as r, cn as s };
|