glchat-a2ui-react-renderer 0.0.3 → 0.0.4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Surface.d.ts","sourceRoot":"","sources":["../../../src/rendering/Surface.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
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,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,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,SAAS,EACT,OAAO,EACP,SAAS,EACT,eAAe,EACf,OAAyB,EACzB,KAAK,GACN,EAAE,gBAAgB,GAAG,KAAK,CAAC,SAAS,CA6DpC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useCallback
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
4
|
import { resolveActionContext } from '../runtime/bindingResolver.js';
|
|
5
5
|
import { DEFAULT_CATALOG, renderComponentFromCatalog, } from './catalog.js';
|
|
6
6
|
/**
|
|
@@ -9,7 +9,6 @@ import { DEFAULT_CATALOG, renderComponentFromCatalog, } from './catalog.js';
|
|
|
9
9
|
* one A2UISurface per surface.
|
|
10
10
|
*/
|
|
11
11
|
export function A2UISurface({ surfaceId, surface, processor, refreshSurfaces, catalog = DEFAULT_CATALOG, theme, }) {
|
|
12
|
-
const surfaceRef = useRef(null);
|
|
13
12
|
const handleAction = useCallback((action, sourceComponentId) => {
|
|
14
13
|
const resolvedContext = action.context != null
|
|
15
14
|
? resolveActionContext(action.context, surface.dataModel)
|
|
@@ -25,9 +24,6 @@ export function A2UISurface({ surfaceId, surface, processor, refreshSurfaces, ca
|
|
|
25
24
|
if (processor) {
|
|
26
25
|
processor.dispatch(message);
|
|
27
26
|
}
|
|
28
|
-
if (surfaceRef.current) {
|
|
29
|
-
surfaceRef.current.dispatchEvent(new CustomEvent('a2uiaction', { detail: message, bubbles: true }));
|
|
30
|
-
}
|
|
31
27
|
}, [processor, surfaceId, surface.dataModel]);
|
|
32
28
|
const renderComponentById = useCallback((componentId) => {
|
|
33
29
|
const componentDef = surface.componentBuffer.get(componentId);
|
|
@@ -51,5 +47,5 @@ export function A2UISurface({ surfaceId, surface, processor, refreshSurfaces, ca
|
|
|
51
47
|
if (!surface.ready || !surface.rootId) {
|
|
52
48
|
return null;
|
|
53
49
|
}
|
|
54
|
-
return (_jsx("div", {
|
|
50
|
+
return (_jsx("div", { className: "a2ui-surface", "data-surface-id": surfaceId, children: renderComponentById(surface.rootId) }));
|
|
55
51
|
}
|
package/dist/styles.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Use: import 'glchat-a2ui-react-renderer/styles.css' in
|
|
2
|
+
* Use: import 'glchat-a2ui-react-renderer/styles.css' in client app.
|
|
3
3
|
* Variables use HSL format (H S% L%) — override via :root or .a2ui-surface.
|
|
4
4
|
* Colors aligned with glchat-ui default theme.
|
|
5
5
|
*/
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
.a2ui-row {
|
|
93
93
|
display: flex;
|
|
94
94
|
flex-direction: row;
|
|
95
|
+
flex-wrap: wrap;
|
|
95
96
|
gap: 8px;
|
|
96
97
|
}
|
|
97
98
|
|