39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import React from "react";
|
|
import { v0_8 } from "@a2ui/lit";
|
|
|
|
//#region src/A2UIViewer.d.ts
|
|
interface A2UIActionEvent {
|
|
actionName: string;
|
|
sourceComponentId: string;
|
|
timestamp: string;
|
|
context: Record<string, unknown>;
|
|
}
|
|
interface A2UIViewerProps {
|
|
/** ID of the root component to render */
|
|
root: string;
|
|
/** Component definitions - array of ComponentInstance */
|
|
components: v0_8.Types.ComponentInstance[];
|
|
/** Data model - nested object, e.g. { user: { name: "John" }, items: ["a", "b"] } */
|
|
data?: Record<string, unknown>;
|
|
/** Called when user triggers an action (button click, etc.) */
|
|
onAction?: (action: A2UIActionEvent) => void;
|
|
/** Surface styles (primaryColor, font, logoUrl) */
|
|
styles?: Record<string, string>;
|
|
/** Optional className for the container */
|
|
className?: string;
|
|
}
|
|
/**
|
|
* A2UIViewer renders an A2UI component tree from a JSON definition and data.
|
|
* It re-renders cleanly when props change, discarding previous state.
|
|
*/
|
|
declare function A2UIViewer({
|
|
root,
|
|
components,
|
|
data,
|
|
onAction,
|
|
styles,
|
|
className
|
|
}: A2UIViewerProps): React.JSX.Element;
|
|
//#endregion
|
|
export { A2UIViewer, A2UIViewerProps };
|
|
//# sourceMappingURL=A2UIViewer.d.mts.map
|