glchat-a2ui-react-renderer 0.0.5 → 0.1.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 +221 -93
- package/dist/index.d.ts +4 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -17
- package/dist/src/a2ui/GlchatA2UIProvider.d.ts +4 -0
- package/dist/src/a2ui/GlchatA2UIProvider.d.ts.map +1 -0
- package/dist/src/a2ui/GlchatA2UIProvider.js +8 -0
- package/dist/src/a2ui/GlchatA2UIRenderer.d.ts +4 -0
- package/dist/src/a2ui/GlchatA2UIRenderer.d.ts.map +1 -0
- package/dist/src/a2ui/GlchatA2UIRenderer.js +6 -0
- package/dist/src/a2ui/adapter.d.ts +3 -0
- package/dist/src/a2ui/adapter.d.ts.map +1 -0
- package/dist/src/a2ui/adapter.js +12 -0
- package/dist/src/a2ui/glchatStandardCatalog.d.ts +10 -0
- package/dist/src/a2ui/glchatStandardCatalog.d.ts.map +1 -0
- package/dist/src/a2ui/glchatStandardCatalog.js +14 -0
- package/dist/src/components/custom/Button.d.ts +3 -0
- package/dist/src/components/custom/Button.d.ts.map +1 -0
- package/dist/src/components/custom/Button.js +14 -0
- package/dist/src/components/custom/Card.d.ts +3 -0
- package/dist/src/components/custom/Card.d.ts.map +1 -0
- package/dist/src/components/custom/Card.js +7 -0
- package/dist/src/components/custom/Timeout.d.ts +3 -0
- package/dist/src/components/custom/Timeout.d.ts.map +1 -0
- package/dist/src/components/custom/Timeout.js +6 -0
- package/dist/src/components/{Button.d.ts → ui/Button.d.ts} +4 -4
- package/dist/src/components/ui/Button.d.ts.map +1 -0
- package/dist/src/components/ui/Button.js +38 -0
- package/dist/src/components/{Card.d.ts → ui/Card.d.ts} +1 -1
- package/dist/src/components/ui/Card.d.ts.map +1 -0
- package/dist/src/components/ui/Card.js +16 -0
- package/dist/src/components/ui/Timeout.d.ts +6 -0
- package/dist/src/components/ui/Timeout.d.ts.map +1 -0
- package/dist/src/components/{Timeout.js → ui/Timeout.js} +3 -4
- package/package.json +9 -5
- package/styles/globals.css +103 -0
- package/styles/theme-v4.css +86 -0
- package/tailwind.config.cjs +111 -0
- package/dist/src/components/Button.d.ts.map +0 -1
- package/dist/src/components/Button.js +0 -43
- package/dist/src/components/Card.d.ts.map +0 -1
- package/dist/src/components/Card.js +0 -16
- package/dist/src/components/Checkbox.d.ts +0 -5
- package/dist/src/components/Checkbox.d.ts.map +0 -1
- package/dist/src/components/Checkbox.js +0 -9
- package/dist/src/components/Column.d.ts +0 -13
- package/dist/src/components/Column.d.ts.map +0 -1
- package/dist/src/components/Column.js +0 -20
- package/dist/src/components/Image.d.ts +0 -9
- package/dist/src/components/Image.d.ts.map +0 -1
- package/dist/src/components/Image.js +0 -21
- package/dist/src/components/Input.d.ts +0 -8
- package/dist/src/components/Input.d.ts.map +0 -1
- package/dist/src/components/Input.js +0 -9
- package/dist/src/components/Label.d.ts +0 -5
- package/dist/src/components/Label.d.ts.map +0 -1
- package/dist/src/components/Label.js +0 -8
- package/dist/src/components/Row.d.ts +0 -13
- package/dist/src/components/Row.d.ts.map +0 -1
- package/dist/src/components/Row.js +0 -20
- package/dist/src/components/Separator.d.ts +0 -5
- package/dist/src/components/Separator.d.ts.map +0 -1
- package/dist/src/components/Separator.js +0 -11
- package/dist/src/components/Text.d.ts +0 -8
- package/dist/src/components/Text.d.ts.map +0 -1
- package/dist/src/components/Text.js +0 -19
- package/dist/src/components/TextField.d.ts +0 -13
- package/dist/src/components/TextField.d.ts.map +0 -1
- package/dist/src/components/TextField.js +0 -31
- package/dist/src/components/Timeout.d.ts +0 -8
- package/dist/src/components/Timeout.d.ts.map +0 -1
- package/dist/src/helpers/messageParser.d.ts +0 -10
- package/dist/src/helpers/messageParser.d.ts.map +0 -1
- package/dist/src/helpers/messageParser.js +0 -40
- package/dist/src/hooks/useA2UIProcessor.d.ts +0 -17
- package/dist/src/hooks/useA2UIProcessor.d.ts.map +0 -1
- package/dist/src/hooks/useA2UIProcessor.js +0 -16
- package/dist/src/rendering/Surface.d.ts +0 -26
- package/dist/src/rendering/Surface.d.ts.map +0 -1
- package/dist/src/rendering/Surface.js +0 -51
- package/dist/src/rendering/catalog.d.ts +0 -41
- package/dist/src/rendering/catalog.d.ts.map +0 -1
- package/dist/src/rendering/catalog.js +0 -160
- package/dist/src/rendering/componentRegistry.d.ts +0 -9
- package/dist/src/rendering/componentRegistry.d.ts.map +0 -1
- package/dist/src/rendering/componentRegistry.js +0 -10
- package/dist/src/runtime/bindingResolver.d.ts +0 -30
- package/dist/src/runtime/bindingResolver.d.ts.map +0 -1
- package/dist/src/runtime/bindingResolver.js +0 -129
- package/dist/src/runtime/dispatcher.d.ts +0 -15
- package/dist/src/runtime/dispatcher.d.ts.map +0 -1
- package/dist/src/runtime/dispatcher.js +0 -29
- package/dist/src/runtime/messageProcessor.d.ts +0 -54
- package/dist/src/runtime/messageProcessor.d.ts.map +0 -1
- package/dist/src/runtime/messageProcessor.js +0 -85
- package/dist/src/runtime/surfaceManager.d.ts +0 -48
- package/dist/src/runtime/surfaceManager.d.ts.map +0 -1
- package/dist/src/runtime/surfaceManager.js +0 -90
- package/dist/src/types.d.ts +0 -340
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -3
- package/dist/styles.css +0 -395
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from '../helpers/css.js';
|
|
4
|
-
const distributionClasses = {
|
|
5
|
-
start: 'a2ui-row--justify-start',
|
|
6
|
-
end: 'a2ui-row--justify-end',
|
|
7
|
-
center: 'a2ui-row--justify-center',
|
|
8
|
-
spaceBetween: 'a2ui-row--justify-between',
|
|
9
|
-
spaceAround: 'a2ui-row--justify-around',
|
|
10
|
-
spaceEvenly: 'a2ui-row--justify-evenly',
|
|
11
|
-
};
|
|
12
|
-
const alignmentClasses = {
|
|
13
|
-
start: 'a2ui-row--items-start',
|
|
14
|
-
end: 'a2ui-row--items-end',
|
|
15
|
-
center: 'a2ui-row--items-center',
|
|
16
|
-
stretch: 'a2ui-row--items-stretch',
|
|
17
|
-
};
|
|
18
|
-
export function A2UIRow({ children, distribution = 'start', alignment = 'stretch', className, }) {
|
|
19
|
-
return (_jsx("div", { className: cn('a2ui-row', distributionClasses[distribution], alignmentClasses[alignment], className), children: children }));
|
|
20
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
declare const Separator: React.ForwardRefExoticComponent<Omit<SeparatorPrimitive.SeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
-
export { Separator };
|
|
5
|
-
//# sourceMappingURL=Separator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Separator.d.ts","sourceRoot":"","sources":["../../../src/components/Separator.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,SAAS,6JAuBd,CAAC;AAGF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { cn } from '../helpers/css.js';
|
|
6
|
-
const Separator = React.forwardRef(({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (_jsx(SeparatorPrimitive.Root, { ref: ref, decorative: decorative, orientation: orientation, className: cn('a2ui-separator', {
|
|
7
|
-
'a2ui-separator--horizontal': orientation === 'horizontal',
|
|
8
|
-
'a2ui-separator--vertical': orientation === 'vertical',
|
|
9
|
-
}, className), ...props })));
|
|
10
|
-
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
11
|
-
export { Separator };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
interface TextProps {
|
|
2
|
-
text: string;
|
|
3
|
-
usageHint?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'body' | 'caption';
|
|
4
|
-
className?: string;
|
|
5
|
-
}
|
|
6
|
-
export declare function A2UIText({ text, usageHint, className }: TextProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
|
8
|
-
//# sourceMappingURL=Text.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/components/Text.tsx"],"names":[],"mappings":"AAOA,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAYD,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAkB,EAAE,SAAS,EAAE,EAAE,SAAS,2CAM1E"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
/**
|
|
4
|
-
* A2UI Text component
|
|
5
|
-
*/
|
|
6
|
-
import { cn } from '../helpers/css.js';
|
|
7
|
-
const baseClasses = {
|
|
8
|
-
h1: 'a2ui-text-h1',
|
|
9
|
-
h2: 'a2ui-text-h2',
|
|
10
|
-
h3: 'a2ui-text-h3',
|
|
11
|
-
h4: 'a2ui-text-h4',
|
|
12
|
-
h5: 'a2ui-text-h5',
|
|
13
|
-
body: 'a2ui-text-body',
|
|
14
|
-
caption: 'a2ui-text-caption',
|
|
15
|
-
};
|
|
16
|
-
export function A2UIText({ text, usageHint = 'body', className }) {
|
|
17
|
-
const Component = ['body', 'caption'].includes(usageHint) ? 'p' : usageHint;
|
|
18
|
-
return (_jsx(Component, { className: cn(baseClasses[usageHint], className), children: text }));
|
|
19
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
interface A2UITextFieldProps {
|
|
2
|
-
label?: string;
|
|
3
|
-
value: string | number;
|
|
4
|
-
onChange?: (value: string | number) => void;
|
|
5
|
-
textFieldType?: 'shortText' | 'longText' | 'number' | 'obscured' | 'date';
|
|
6
|
-
validationRegexp?: string;
|
|
7
|
-
className?: string;
|
|
8
|
-
labelClassName?: string;
|
|
9
|
-
elementClassName?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare function A2UITextField({ label, value, onChange, textFieldType, validationRegexp, className, labelClassName, elementClassName, }: A2UITextFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=TextField.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../src/components/TextField.tsx"],"names":[],"mappings":"AAWA,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC5C,aAAa,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;IAC1E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,KAAK,EACL,QAAQ,EACR,aAA2B,EAC3B,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,gBAAgB,GACjB,EAAE,kBAAkB,2CA2DpB"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cn } from '../helpers/css.js';
|
|
4
|
-
import { Input } from './Input.js';
|
|
5
|
-
import { Label } from './Label.js';
|
|
6
|
-
export function A2UITextField({ label, value, onChange, textFieldType = 'shortText', validationRegexp, className, labelClassName, elementClassName, }) {
|
|
7
|
-
function handleChange(e) {
|
|
8
|
-
if (!onChange)
|
|
9
|
-
return;
|
|
10
|
-
const newValue = e.target.value;
|
|
11
|
-
if (textFieldType === 'number') {
|
|
12
|
-
const numValue = parseFloat(newValue);
|
|
13
|
-
onChange(isNaN(numValue) ? 0 : numValue);
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
onChange(newValue);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
const inputType = textFieldType === 'obscured'
|
|
20
|
-
? 'password'
|
|
21
|
-
: textFieldType === 'number'
|
|
22
|
-
? 'number'
|
|
23
|
-
: textFieldType === 'date'
|
|
24
|
-
? 'date'
|
|
25
|
-
: 'text';
|
|
26
|
-
const inputClasses = cn('a2ui-input a2ui-textfield-input', elementClassName);
|
|
27
|
-
if (textFieldType === 'longText') {
|
|
28
|
-
return (_jsxs("div", { className: cn('a2ui-textfield', className), children: [label && (_jsx(Label, { className: cn('a2ui-textfield-label', labelClassName), children: label })), _jsx("textarea", { value: value, onChange: handleChange, className: cn(inputClasses, 'a2ui-textarea') })] }));
|
|
29
|
-
}
|
|
30
|
-
return (_jsxs("div", { className: cn('a2ui-textfield', className), children: [label && (_jsx(Label, { className: cn('a2ui-textfield-label', labelClassName), children: label })), _jsx(Input, { type: inputType, value: value, onChange: handleChange, pattern: validationRegexp, className: cn('a2ui-textfield-input', elementClassName) })] }));
|
|
31
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type TimeoutUsageHint = 'body' | 'caption' | 'h3' | 'h4' | 'h5';
|
|
2
|
-
export interface A2UITimeoutProps {
|
|
3
|
-
targetTimeUtc: string;
|
|
4
|
-
usageHint?: TimeoutUsageHint;
|
|
5
|
-
className?: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function A2UITimeout({ targetTimeUtc, usageHint, className, }: A2UITimeoutProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
//# sourceMappingURL=Timeout.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Timeout.d.ts","sourceRoot":"","sources":["../../../src/components/Timeout.tsx"],"names":[],"mappings":"AAQA,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEvE,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAiBD,wBAAgB,WAAW,CAAC,EAC1B,aAAa,EACb,SAAkB,EAClB,SAAS,GACV,EAAE,gBAAgB,2CAyBlB"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { A2UIMessage } from '../types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Parses a JSONL stream (newline-delimited JSON)
|
|
4
|
-
*/
|
|
5
|
-
export declare function parseJSONLStream(jsonl: string): A2UIMessage[];
|
|
6
|
-
/**
|
|
7
|
-
* Checks if a message is a valid A2UI message
|
|
8
|
-
*/
|
|
9
|
-
export declare function isValidMessage(message: any): message is A2UIMessage;
|
|
10
|
-
//# sourceMappingURL=messageParser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messageParser.d.ts","sourceRoot":"","sources":["../../../src/helpers/messageParser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE,CAY7D;AAeD;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,IAAI,WAAW,CASnE"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Parses a JSONL stream (newline-delimited JSON)
|
|
3
|
-
*/
|
|
4
|
-
export function parseJSONLStream(jsonl) {
|
|
5
|
-
const lines = jsonl.split('\n').filter((line) => line.trim());
|
|
6
|
-
const messages = [];
|
|
7
|
-
for (const line of lines) {
|
|
8
|
-
const message = parseMessage(line);
|
|
9
|
-
if (message) {
|
|
10
|
-
messages.push(message);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return messages;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Parses a single JSON line into an A2UI message
|
|
17
|
-
*/
|
|
18
|
-
function parseMessage(line) {
|
|
19
|
-
try {
|
|
20
|
-
const parsed = JSON.parse(line);
|
|
21
|
-
return parsed;
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
console.error('Failed to parse A2UI message:', error, line);
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Checks if a message is a valid A2UI message
|
|
30
|
-
*/
|
|
31
|
-
export function isValidMessage(message) {
|
|
32
|
-
if (!message || typeof message !== 'object')
|
|
33
|
-
return false;
|
|
34
|
-
return [
|
|
35
|
-
'beginRendering',
|
|
36
|
-
'surfaceUpdate',
|
|
37
|
-
'dataModelUpdate',
|
|
38
|
-
'deleteSurface',
|
|
39
|
-
].some((key) => key in message);
|
|
40
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { MessageProcessor } from '../runtime/messageProcessor.js';
|
|
2
|
-
import type { SurfaceState } from '../types.js';
|
|
3
|
-
export interface UseA2UIProcessorResult {
|
|
4
|
-
/** Processor with getSurfaces(), processMessages(), clearSurfaces(). Same API as Lit/Angular. */
|
|
5
|
-
processor: MessageProcessor;
|
|
6
|
-
/** Current surfaces (reactive). Update by calling refreshSurfaces() after processMessages() or client data model updates. */
|
|
7
|
-
surfaces: Map<string, SurfaceState>;
|
|
8
|
-
/** Call after processMessages() or after updating data model from client to re-render. */
|
|
9
|
-
refreshSurfaces: () => void;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Hook that provides a MessageProcessor and reactive surfaces state.
|
|
13
|
-
* Aligns with how Lit/Angular apps own the processor and read getSurfaces().
|
|
14
|
-
* After calling processor.processMessages(messages), call refreshSurfaces() so surfaces state updates and the UI re-renders.
|
|
15
|
-
*/
|
|
16
|
-
export declare function useA2UIProcessor(): UseA2UIProcessorResult;
|
|
17
|
-
//# sourceMappingURL=useA2UIProcessor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useA2UIProcessor.d.ts","sourceRoot":"","sources":["../../../src/hooks/useA2UIProcessor.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,sBAAsB;IACrC,iGAAiG;IACjG,SAAS,EAAE,gBAAgB,CAAC;IAC5B,6HAA6H;IAC7H,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACpC,0FAA0F;IAC1F,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,IAAI,sBAAsB,CAWzD"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { useCallback, useState } from 'react';
|
|
3
|
-
import { MessageProcessor } from '../runtime/messageProcessor.js';
|
|
4
|
-
/**
|
|
5
|
-
* Hook that provides a MessageProcessor and reactive surfaces state.
|
|
6
|
-
* Aligns with how Lit/Angular apps own the processor and read getSurfaces().
|
|
7
|
-
* After calling processor.processMessages(messages), call refreshSurfaces() so surfaces state updates and the UI re-renders.
|
|
8
|
-
*/
|
|
9
|
-
export function useA2UIProcessor() {
|
|
10
|
-
const [processor] = useState(() => new MessageProcessor());
|
|
11
|
-
const [surfaces, setSurfaces] = useState(() => new Map());
|
|
12
|
-
const refreshSurfaces = useCallback(() => {
|
|
13
|
-
setSurfaces(new Map(processor.getSurfaces()));
|
|
14
|
-
}, [processor]);
|
|
15
|
-
return { processor, surfaces, refreshSurfaces };
|
|
16
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { MessageProcessor } from '../runtime/messageProcessor.js';
|
|
3
|
-
import type { SurfaceState, Theme } from '../types.js';
|
|
4
|
-
import { type ComponentCatalog } from './catalog.js';
|
|
5
|
-
export interface A2UISurfaceProps {
|
|
6
|
-
/** Surface state (from processor.getSurfaces()) */
|
|
7
|
-
surface: SurfaceState;
|
|
8
|
-
/**
|
|
9
|
-
* Optional: pass with refreshSurfaces so TextField/CheckBox update the data model
|
|
10
|
-
* via processor.setData() and refresh. Same as Lit/Angular; required for two-way binding.
|
|
11
|
-
*/
|
|
12
|
-
processor?: MessageProcessor;
|
|
13
|
-
/** Call after processor.setData() so the UI re-renders. Pass with processor. */
|
|
14
|
-
refreshSurfaces?: () => void;
|
|
15
|
-
/** Optional: custom catalog. Defaults to DEFAULT_CATALOG. */
|
|
16
|
-
catalog?: ComponentCatalog;
|
|
17
|
-
/** Optional: theme for styling built-in components (className strings per component/part). */
|
|
18
|
-
theme?: Theme;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Renders a single A2UI surface. Aligned with official Lit/Angular Surface:
|
|
22
|
-
* app passes surfaceId and surface from processor.getSurfaces(), and renders
|
|
23
|
-
* one A2UISurface per surface.
|
|
24
|
-
*/
|
|
25
|
-
export declare function A2UISurface({ surface, processor, refreshSurfaces, catalog, theme, }: Readonly<A2UISurfaceProps>): React.ReactNode;
|
|
26
|
-
//# sourceMappingURL=Surface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Surface.d.ts","sourceRoot":"","sources":["../../../src/rendering/Surface.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAG3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EAGV,YAAY,EACZ,KAAK,EAEN,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,KAAK,gBAAgB,EAItB,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,gBAAgB;IAC/B,mDAAmD;IACnD,OAAO,EAAE,YAAY,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,gFAAgF;IAChF,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,6DAA6D;IAC7D,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAC3B,8FAA8F;IAC9F,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,SAAS,EACT,eAAe,EACf,OAAyB,EACzB,KAAK,GACN,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC,SAAS,CA6D9C"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback } from 'react';
|
|
4
|
-
import { resolveActionContext } from '../runtime/bindingResolver.js';
|
|
5
|
-
import { DEFAULT_CATALOG, renderComponentFromCatalog, } from './catalog.js';
|
|
6
|
-
/**
|
|
7
|
-
* Renders a single A2UI surface. Aligned with official Lit/Angular Surface:
|
|
8
|
-
* app passes surfaceId and surface from processor.getSurfaces(), and renders
|
|
9
|
-
* one A2UISurface per surface.
|
|
10
|
-
*/
|
|
11
|
-
export function A2UISurface({ surface, processor, refreshSurfaces, catalog = DEFAULT_CATALOG, theme, }) {
|
|
12
|
-
const handleAction = useCallback((action, sourceComponentId) => {
|
|
13
|
-
const resolvedContext = action.context != null
|
|
14
|
-
? resolveActionContext(action.context, surface.dataModel)
|
|
15
|
-
: undefined;
|
|
16
|
-
const userAction = {
|
|
17
|
-
name: action.name,
|
|
18
|
-
surfaceId: surface.surfaceId,
|
|
19
|
-
sourceComponentId,
|
|
20
|
-
context: resolvedContext,
|
|
21
|
-
timestamp: new Date().toISOString(),
|
|
22
|
-
};
|
|
23
|
-
const message = { userAction };
|
|
24
|
-
if (processor) {
|
|
25
|
-
processor.dispatch(message);
|
|
26
|
-
}
|
|
27
|
-
}, [processor, surface]);
|
|
28
|
-
const renderComponentById = useCallback((componentId) => {
|
|
29
|
-
const componentDef = surface.componentBuffer.get(componentId);
|
|
30
|
-
if (!componentDef) {
|
|
31
|
-
console.warn(`Component not found: ${componentId}`);
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
const props = {
|
|
35
|
-
component: componentDef.component,
|
|
36
|
-
dataModel: surface.dataModel,
|
|
37
|
-
sourceComponentId: componentId,
|
|
38
|
-
onAction: handleAction,
|
|
39
|
-
renderChild: (childId) => renderComponentById(childId),
|
|
40
|
-
processor,
|
|
41
|
-
surfaceId: surface.surfaceId,
|
|
42
|
-
refreshSurfaces,
|
|
43
|
-
theme,
|
|
44
|
-
};
|
|
45
|
-
return renderComponentFromCatalog(catalog, componentDef.component, props);
|
|
46
|
-
}, [surface.componentBuffer, surface.dataModel, handleAction, catalog, processor, surface, refreshSurfaces, theme]);
|
|
47
|
-
if (!surface.ready || !surface.rootId) {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
return (_jsx("div", { className: "a2ui-surface", children: renderComponentById(surface.rootId) }));
|
|
51
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { MessageProcessor } from '../runtime/messageProcessor.js';
|
|
3
|
-
import type { ActionDefinition, Component, ComponentDataMap, ComponentType, Theme } from '../types.js';
|
|
4
|
-
/**
|
|
5
|
-
* Props passed to each catalog renderer when rendering a component.
|
|
6
|
-
* Same contract as Lit/Angular: dataModel, callbacks, and renderChild for recursion.
|
|
7
|
-
* When processor + surfaceId + refreshSurfaces are provided, TextField/CheckBox
|
|
8
|
-
* call processor.setData() and refreshSurfaces() on value change (no app callback).
|
|
9
|
-
*/
|
|
10
|
-
export interface ComponentRenderProps {
|
|
11
|
-
component: Component;
|
|
12
|
-
dataModel: Record<string, unknown>;
|
|
13
|
-
sourceComponentId?: string;
|
|
14
|
-
onAction?: (action: ActionDefinition, sourceComponentId: string) => void;
|
|
15
|
-
renderChild?: (componentId: string) => React.ReactNode;
|
|
16
|
-
processor?: MessageProcessor;
|
|
17
|
-
surfaceId?: string;
|
|
18
|
-
refreshSurfaces?: () => void;
|
|
19
|
-
theme?: Theme;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* A typed component renderer for a specific component type K.
|
|
23
|
-
*/
|
|
24
|
-
export type ComponentRenderer<K extends ComponentType = ComponentType> = (data: ComponentDataMap[K], props: ComponentRenderProps) => React.ReactNode;
|
|
25
|
-
/**
|
|
26
|
-
* Catalog map: each standard component type maps to its typed renderer.
|
|
27
|
-
*/
|
|
28
|
-
export type ComponentCatalog = {
|
|
29
|
-
[K in ComponentType]?: ComponentRenderer<K>;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Default catalog: type → typed renderer.
|
|
33
|
-
* Same pattern as Lit componentRegistry / Angular Catalog.
|
|
34
|
-
*/
|
|
35
|
-
export declare const DEFAULT_CATALOG: ComponentCatalog;
|
|
36
|
-
/**
|
|
37
|
-
* Renders one A2UI component using the given catalog (no recursion).
|
|
38
|
-
* The caller supplies renderChild for children. Used by the tree renderer inside A2UISurface.
|
|
39
|
-
*/
|
|
40
|
-
export declare function renderComponentFromCatalog(catalog: ComponentCatalog, component: Component, props: ComponentRenderProps): React.ReactNode;
|
|
41
|
-
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/rendering/catalog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAkBxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EACV,gBAAgB,EAMhB,SAAS,EACT,gBAAgB,EAChB,aAAa,EAQb,KAAK,EACN,MAAM,aAAa,CAAC;AAIrB;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,KAAK,IAAI,CAAC;IACzE,WAAW,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IACvD,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,aAAa,GAAG,aAAa,IAAI,CACvE,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,EACzB,KAAK,EAAE,oBAAoB,KACxB,KAAK,CAAC,SAAS,CAAC;AAErB;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;KAC5B,CAAC,IAAI,aAAa,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC;CAC5C,CAAC;AA0QF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,gBAY7B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,gBAAgB,EACzB,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,oBAAoB,GAC1B,KAAK,CAAC,SAAS,CASjB"}
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { Fragment } from 'react';
|
|
4
|
-
import { A2UIColumn } from '../components/Column.js';
|
|
5
|
-
import { A2UIImage } from '../components/Image.js';
|
|
6
|
-
import { A2UIRow } from '../components/Row.js';
|
|
7
|
-
import { A2UIText } from '../components/Text.js';
|
|
8
|
-
import { A2UITextField } from '../components/TextField.js';
|
|
9
|
-
import { A2UITimeout } from '../components/Timeout.js';
|
|
10
|
-
import { Button } from '../components/Button.js';
|
|
11
|
-
import { Card, CardContent } from '../components/Card.js';
|
|
12
|
-
import { Checkbox } from '../components/Checkbox.js';
|
|
13
|
-
import { Label } from '../components/Label.js';
|
|
14
|
-
import { Separator } from '../components/Separator.js';
|
|
15
|
-
import { getPathFromBoundValue, resolveBoundValue, } from '../runtime/bindingResolver.js';
|
|
16
|
-
import { cn } from '../helpers/css.js';
|
|
17
|
-
/**
|
|
18
|
-
* Resolves child component IDs from a ChildrenDef.
|
|
19
|
-
* Handles both explicitList (fixed children) and template (data-driven children).
|
|
20
|
-
*/
|
|
21
|
-
function resolveChildIds(childrenDef, dataModel) {
|
|
22
|
-
if (childrenDef.explicitList) {
|
|
23
|
-
return childrenDef.explicitList;
|
|
24
|
-
}
|
|
25
|
-
if (childrenDef.template?.dataBinding) {
|
|
26
|
-
const bound = resolveBoundValue({ path: childrenDef.template.dataBinding }, dataModel);
|
|
27
|
-
if (bound && typeof bound === 'object' && !Array.isArray(bound)) {
|
|
28
|
-
return Object.keys(bound);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return [];
|
|
32
|
-
}
|
|
33
|
-
function renderText(data, props) {
|
|
34
|
-
const usageHint = data.usageHint ?? 'body';
|
|
35
|
-
const textTheme = props.theme?.components?.Text;
|
|
36
|
-
const className = textTheme
|
|
37
|
-
? (textTheme[usageHint] ?? textTheme.className)
|
|
38
|
-
: undefined;
|
|
39
|
-
return (_jsx(A2UIText, { text: String(resolveBoundValue(data.text, props.dataModel) ?? ''), usageHint: usageHint, className: className }));
|
|
40
|
-
}
|
|
41
|
-
function renderButton(data, props) {
|
|
42
|
-
let variant = 'outline';
|
|
43
|
-
if (data.destructive) {
|
|
44
|
-
variant = 'destructive';
|
|
45
|
-
}
|
|
46
|
-
else if (data.primary) {
|
|
47
|
-
variant = 'primary';
|
|
48
|
-
}
|
|
49
|
-
const buttonClassName = props.theme?.components?.Button;
|
|
50
|
-
return (_jsx(Button, { variant: variant, className: buttonClassName, onClick: () => {
|
|
51
|
-
if (!props.sourceComponentId) {
|
|
52
|
-
console.warn('renderButton: sourceComponentId is required for interactive components; action dispatch skipped.', { action: data.action });
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
props.onAction?.(data.action, props.sourceComponentId);
|
|
56
|
-
}, children: props.renderChild?.(data.child) }));
|
|
57
|
-
}
|
|
58
|
-
function renderCard(data, props) {
|
|
59
|
-
const cardClassName = props.theme?.components?.Card;
|
|
60
|
-
return (_jsx(Card, { className: cardClassName, children: _jsx(CardContent, { children: props.renderChild?.(data.child) }) }));
|
|
61
|
-
}
|
|
62
|
-
function renderRow(data, props) {
|
|
63
|
-
const children = resolveChildIds(data.children, props.dataModel);
|
|
64
|
-
const className = props.theme?.components?.Row;
|
|
65
|
-
return (_jsx(A2UIRow, { distribution: data.distribution, alignment: data.alignment, className: className, children: children.map((childId) => (_jsx(Fragment, { children: props.renderChild?.(childId) }, childId))) }));
|
|
66
|
-
}
|
|
67
|
-
function renderColumn(data, props) {
|
|
68
|
-
const children = resolveChildIds(data.children, props.dataModel);
|
|
69
|
-
const className = props.theme?.components?.Column;
|
|
70
|
-
return (_jsx(A2UIColumn, { distribution: data.distribution, alignment: data.alignment, className: className, children: children.map((childId) => (_jsx(Fragment, { children: props.renderChild?.(childId) }, childId))) }));
|
|
71
|
-
}
|
|
72
|
-
const listAlignmentClasses = {
|
|
73
|
-
start: 'a2ui-list--items-start',
|
|
74
|
-
center: 'a2ui-list--items-center',
|
|
75
|
-
end: 'a2ui-list--items-end',
|
|
76
|
-
stretch: 'a2ui-list--items-stretch',
|
|
77
|
-
};
|
|
78
|
-
function renderList(data, props) {
|
|
79
|
-
const children = resolveChildIds(data.children, props.dataModel);
|
|
80
|
-
const direction = data.direction ?? 'vertical';
|
|
81
|
-
const alignment = data.alignment ?? 'stretch';
|
|
82
|
-
return (_jsx("div", { className: cn('a2ui-list', direction === 'horizontal' ? 'a2ui-list--horizontal' : 'a2ui-list--vertical', listAlignmentClasses[alignment]), children: children.map((childId) => (_jsx(Fragment, { children: props.renderChild?.(childId) }, childId))) }));
|
|
83
|
-
}
|
|
84
|
-
function renderTextField(data, props) {
|
|
85
|
-
const label = resolveBoundValue(data.label, props.dataModel);
|
|
86
|
-
const textPath = data.text ? getPathFromBoundValue(data.text) : undefined;
|
|
87
|
-
const handleChange = (value) => {
|
|
88
|
-
if (!textPath)
|
|
89
|
-
return;
|
|
90
|
-
if (props.processor && props.surfaceId != null && props.refreshSurfaces) {
|
|
91
|
-
props.processor.setData(props.surfaceId, textPath, value);
|
|
92
|
-
props.refreshSurfaces();
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
const tfTheme = props.theme?.components?.TextField;
|
|
96
|
-
return (_jsx(A2UITextField, { label: label != null ? String(label) : undefined, value: data.text ? String(resolveBoundValue(data.text, props.dataModel) ?? '') : '', textFieldType: data.textFieldType, validationRegexp: data.validationRegexp, onChange: handleChange, className: tfTheme?.container, labelClassName: tfTheme?.label, elementClassName: tfTheme?.element }));
|
|
97
|
-
}
|
|
98
|
-
function renderCheckBox(data, props) {
|
|
99
|
-
const label = resolveBoundValue(data.label, props.dataModel);
|
|
100
|
-
const checked = resolveBoundValue(data.value, props.dataModel);
|
|
101
|
-
const checkedPath = getPathFromBoundValue(data.value);
|
|
102
|
-
const handleChange = (checkedValue) => {
|
|
103
|
-
if (!checkedPath)
|
|
104
|
-
return;
|
|
105
|
-
const normalizedChecked = checkedValue === 'indeterminate' ? false : checkedValue;
|
|
106
|
-
if (props.processor && props.surfaceId != null && props.refreshSurfaces) {
|
|
107
|
-
props.processor.setData(props.surfaceId, checkedPath, normalizedChecked);
|
|
108
|
-
props.refreshSurfaces();
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
const checkboxId = props.sourceComponentId ? `${props.sourceComponentId}-checkbox` : undefined;
|
|
112
|
-
const cbTheme = props.theme?.components?.CheckBox;
|
|
113
|
-
return (_jsxs("div", { className: cn('a2ui-checkbox-group', cbTheme?.container), children: [_jsx(Checkbox, { id: checkboxId, checked: Boolean(checked), onCheckedChange: handleChange, className: cbTheme?.element }), label != null && (_jsx(Label, { htmlFor: checkboxId, className: cn(cbTheme?.label), children: String(label) }))] }));
|
|
114
|
-
}
|
|
115
|
-
function renderImage(data, props) {
|
|
116
|
-
const imageClassName = props.theme?.components?.Image;
|
|
117
|
-
return (_jsx(A2UIImage, { url: String(resolveBoundValue(data.url, props.dataModel) ?? ''), fit: data.fit, usageHint: data.usageHint, className: imageClassName }));
|
|
118
|
-
}
|
|
119
|
-
function renderDivider(data, props) {
|
|
120
|
-
const axis = data.axis ?? 'horizontal';
|
|
121
|
-
const dividerTheme = props.theme?.components?.Divider;
|
|
122
|
-
return (_jsx(Separator, { orientation: axis, className: dividerTheme }));
|
|
123
|
-
}
|
|
124
|
-
function renderTimeout(data, props) {
|
|
125
|
-
const targetValue = resolveBoundValue(data.targetTimeUtc, props.dataModel);
|
|
126
|
-
const target = typeof targetValue === 'string' ? targetValue : '';
|
|
127
|
-
const timeoutTheme = props.theme?.components?.Timeout;
|
|
128
|
-
return (_jsx(A2UITimeout, { targetTimeUtc: target, usageHint: data.usageHint, className: timeoutTheme }));
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Default catalog: type → typed renderer.
|
|
132
|
-
* Same pattern as Lit componentRegistry / Angular Catalog.
|
|
133
|
-
*/
|
|
134
|
-
export const DEFAULT_CATALOG = {
|
|
135
|
-
Text: renderText,
|
|
136
|
-
Button: renderButton,
|
|
137
|
-
Card: renderCard,
|
|
138
|
-
Row: renderRow,
|
|
139
|
-
Column: renderColumn,
|
|
140
|
-
List: renderList,
|
|
141
|
-
TextField: renderTextField,
|
|
142
|
-
CheckBox: renderCheckBox,
|
|
143
|
-
Image: renderImage,
|
|
144
|
-
Divider: renderDivider,
|
|
145
|
-
Timeout: renderTimeout,
|
|
146
|
-
};
|
|
147
|
-
/**
|
|
148
|
-
* Renders one A2UI component using the given catalog (no recursion).
|
|
149
|
-
* The caller supplies renderChild for children. Used by the tree renderer inside A2UISurface.
|
|
150
|
-
*/
|
|
151
|
-
export function renderComponentFromCatalog(catalog, component, props) {
|
|
152
|
-
const componentType = Object.keys(component)[0];
|
|
153
|
-
const data = component[componentType];
|
|
154
|
-
const renderer = catalog[componentType];
|
|
155
|
-
if (renderer) {
|
|
156
|
-
return renderer(data, props);
|
|
157
|
-
}
|
|
158
|
-
console.warn('Unsupported component type:', componentType);
|
|
159
|
-
return _jsxs("div", { children: ["Unsupported component: ", componentType] });
|
|
160
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type ComponentRenderProps } from './catalog.js';
|
|
2
|
-
/**
|
|
3
|
-
* Renders an A2UI component based on its type using the default catalog.
|
|
4
|
-
* For custom types, use renderComponentFromCatalog with a custom catalog.
|
|
5
|
-
*/
|
|
6
|
-
export declare function renderComponent(props: ComponentRenderProps): React.ReactNode;
|
|
7
|
-
export type { ComponentRenderProps, ComponentCatalog, ComponentRenderer } from './catalog.js';
|
|
8
|
-
export { DEFAULT_CATALOG, renderComponentFromCatalog } from './catalog.js';
|
|
9
|
-
//# sourceMappingURL=componentRegistry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"componentRegistry.d.ts","sourceRoot":"","sources":["../../../src/rendering/componentRegistry.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,cAAc,CAAC;AAEtB;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,KAAK,CAAC,SAAS,CAE5E;AAED,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAC9F,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { DEFAULT_CATALOG, renderComponentFromCatalog, } from './catalog.js';
|
|
3
|
-
/**
|
|
4
|
-
* Renders an A2UI component based on its type using the default catalog.
|
|
5
|
-
* For custom types, use renderComponentFromCatalog with a custom catalog.
|
|
6
|
-
*/
|
|
7
|
-
export function renderComponent(props) {
|
|
8
|
-
return renderComponentFromCatalog(DEFAULT_CATALOG, props.component, props);
|
|
9
|
-
}
|
|
10
|
-
export { DEFAULT_CATALOG, renderComponentFromCatalog } from './catalog.js';
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { ActionDefinition, DataModelContent, ResolvableValue } from '../types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Returns the binding path from a bound value if it has one (writable binding).
|
|
4
|
-
* Literal-only bindings have no path and cannot be updated from the UI.
|
|
5
|
-
*/
|
|
6
|
-
export declare function getPathFromBoundValue(boundValue: ResolvableValue | null | undefined): string | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* Sets a value at a path in the data model (immutable update).
|
|
9
|
-
* Path format: slash-separated only (e.g. "user/name" or "/user/name").
|
|
10
|
-
* Creates nested objects as needed.
|
|
11
|
-
*/
|
|
12
|
-
export declare function setPathValue(dataModel: Record<string, any>, path: string, value: unknown): Record<string, any>;
|
|
13
|
-
/**
|
|
14
|
-
* Resolves action context against the data model for user action payload.
|
|
15
|
-
* Per spec, context is an array of { key, value } entries.
|
|
16
|
-
* Returns a plain object with resolved values (used when sending UserAction).
|
|
17
|
-
*/
|
|
18
|
-
export declare function resolveActionContext(context: ActionDefinition['context'], dataModel: Record<string, any>): Record<string, any>;
|
|
19
|
-
/**
|
|
20
|
-
* Resolves a bound value against a data model.
|
|
21
|
-
* Returns the resolved value (string, number, boolean, or undefined).
|
|
22
|
-
* Accepts any bound value shape (StringOrPathValue, BooleanOrPathValue, BoundValue, etc.).
|
|
23
|
-
* Safe against malformed input: returns undefined if boundValue is not a non-null object.
|
|
24
|
-
*/
|
|
25
|
-
export declare function resolveBoundValue(boundValue: ResolvableValue, dataModel: Record<string, any>): any;
|
|
26
|
-
/**
|
|
27
|
-
* Updates the data model with new content
|
|
28
|
-
*/
|
|
29
|
-
export declare function updateDataModel(currentModel: Record<string, any>, contents: DataModelContent[]): Record<string, any>;
|
|
30
|
-
//# sourceMappingURL=bindingResolver.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bindingResolver.d.ts","sourceRoot":"","sources":["../../../src/runtime/bindingResolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EAEhB,MAAM,aAAa,CAAC;AAErB;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,eAAe,GAAG,IAAI,GAAG,SAAS,GAC7C,MAAM,GAAG,SAAS,CAEpB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,GACb,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAyBrB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,EACpC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC7B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAWrB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC7B,GAAG,CAqBL;AA8BD;;GAEG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACjC,QAAQ,EAAE,gBAAgB,EAAE,GAC3B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAWrB"}
|