@a2ui-sdk/react 0.0.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.
Files changed (174) hide show
  1. package/dist/0.8/A2UIRenderer.d.ts +31 -0
  2. package/dist/0.8/A2UIRenderer.js +19 -0
  3. package/dist/0.8/components/ComponentRenderer.d.ts +39 -0
  4. package/dist/0.8/components/ComponentRenderer.js +76 -0
  5. package/dist/0.8/components/UnknownComponent.d.ts +18 -0
  6. package/dist/0.8/components/display/AudioPlayerComponent.d.ts +5 -0
  7. package/dist/0.8/components/display/AudioPlayerComponent.js +19 -0
  8. package/dist/0.8/components/display/DividerComponent.d.ts +5 -0
  9. package/dist/0.8/components/display/DividerComponent.js +18 -0
  10. package/dist/0.8/components/display/IconComponent.d.ts +5 -0
  11. package/dist/0.8/components/display/IconComponent.js +68 -0
  12. package/dist/0.8/components/display/ImageComponent.d.ts +6 -0
  13. package/dist/0.8/components/display/ImageComponent.js +36 -0
  14. package/dist/0.8/components/display/TextComponent.d.ts +6 -0
  15. package/dist/0.8/components/display/TextComponent.js +32 -0
  16. package/dist/0.8/components/display/VideoComponent.d.ts +5 -0
  17. package/dist/0.8/components/display/VideoComponent.js +18 -0
  18. package/dist/0.8/components/display/index.d.ts +9 -0
  19. package/dist/0.8/components/index.d.ts +7 -0
  20. package/dist/0.8/components/interactive/ButtonComponent.d.ts +5 -0
  21. package/dist/0.8/components/interactive/ButtonComponent.js +29 -0
  22. package/dist/0.8/components/interactive/CheckBoxComponent.d.ts +5 -0
  23. package/dist/0.8/components/interactive/CheckBoxComponent.js +27 -0
  24. package/dist/0.8/components/interactive/DateTimeInputComponent.d.ts +5 -0
  25. package/dist/0.8/components/interactive/DateTimeInputComponent.js +46 -0
  26. package/dist/0.8/components/interactive/MultipleChoiceComponent.d.ts +7 -0
  27. package/dist/0.8/components/interactive/MultipleChoiceComponent.js +89 -0
  28. package/dist/0.8/components/interactive/SliderComponent.d.ts +5 -0
  29. package/dist/0.8/components/interactive/SliderComponent.js +48 -0
  30. package/dist/0.8/components/interactive/TextFieldComponent.d.ts +5 -0
  31. package/dist/0.8/components/interactive/TextFieldComponent.js +44 -0
  32. package/dist/0.8/components/interactive/index.d.ts +9 -0
  33. package/dist/0.8/components/layout/CardComponent.d.ts +5 -0
  34. package/dist/0.8/components/layout/CardComponent.js +14 -0
  35. package/dist/0.8/components/layout/ColumnComponent.d.ts +5 -0
  36. package/dist/0.8/components/layout/ColumnComponent.js +58 -0
  37. package/dist/0.8/components/layout/ListComponent.d.ts +5 -0
  38. package/dist/0.8/components/layout/ListComponent.js +51 -0
  39. package/dist/0.8/components/layout/ModalComponent.d.ts +5 -0
  40. package/dist/0.8/components/layout/ModalComponent.js +25 -0
  41. package/dist/0.8/components/layout/RowComponent.d.ts +5 -0
  42. package/dist/0.8/components/layout/RowComponent.js +58 -0
  43. package/dist/0.8/components/layout/TabsComponent.d.ts +5 -0
  44. package/dist/0.8/components/layout/TabsComponent.js +29 -0
  45. package/dist/0.8/components/layout/index.d.ts +9 -0
  46. package/dist/0.8/contexts/A2UIProvider.d.ts +56 -0
  47. package/dist/0.8/contexts/A2UIProvider.js +33 -0
  48. package/dist/0.8/contexts/ActionContext.d.ts +33 -0
  49. package/dist/0.8/contexts/ActionContext.js +41 -0
  50. package/dist/0.8/contexts/ComponentsMapContext.d.ts +63 -0
  51. package/dist/0.8/contexts/ComponentsMapContext.js +21 -0
  52. package/dist/0.8/contexts/DataModelContext.d.ts +43 -0
  53. package/dist/0.8/contexts/DataModelContext.js +86 -0
  54. package/dist/0.8/contexts/SurfaceContext.d.ts +45 -0
  55. package/dist/0.8/contexts/SurfaceContext.js +88 -0
  56. package/dist/0.8/hooks/useA2UIMessageHandler.d.ts +41 -0
  57. package/dist/0.8/hooks/useA2UIMessageHandler.js +54 -0
  58. package/dist/0.8/hooks/useComponent.d.ts +23 -0
  59. package/dist/0.8/hooks/useComponent.js +9 -0
  60. package/dist/0.8/hooks/useDataBinding.d.ts +50 -0
  61. package/dist/0.8/hooks/useDataBinding.js +28 -0
  62. package/dist/0.8/hooks/useDispatchAction.d.ts +22 -0
  63. package/dist/0.8/hooks/useDispatchAction.js +8 -0
  64. package/dist/0.8/index.d.ts +44 -0
  65. package/dist/0.8/index.js +17 -0
  66. package/dist/0.8/utils/dataBinding.d.ts +95 -0
  67. package/dist/0.8/utils/dataBinding.js +46 -0
  68. package/dist/0.8/utils/pathUtils.d.ts +63 -0
  69. package/dist/0.8/utils/pathUtils.js +44 -0
  70. package/dist/0.9/A2UIRenderer.d.ts +54 -0
  71. package/dist/0.9/A2UIRenderer.js +41 -0
  72. package/dist/0.9/components/ComponentRenderer.d.ts +39 -0
  73. package/dist/0.9/components/ComponentRenderer.js +34 -0
  74. package/dist/0.9/components/UnknownComponent.d.ts +11 -0
  75. package/dist/0.9/components/UnknownComponent.js +35 -0
  76. package/dist/0.9/components/display/AudioPlayerComponent.d.ts +5 -0
  77. package/dist/0.9/components/display/AudioPlayerComponent.js +21 -0
  78. package/dist/0.9/components/display/DividerComponent.d.ts +5 -0
  79. package/dist/0.9/components/display/DividerComponent.js +19 -0
  80. package/dist/0.9/components/display/IconComponent.d.ts +5 -0
  81. package/dist/0.9/components/display/IconComponent.js +68 -0
  82. package/dist/0.9/components/display/ImageComponent.d.ts +6 -0
  83. package/dist/0.9/components/display/ImageComponent.js +43 -0
  84. package/dist/0.9/components/display/TextComponent.d.ts +6 -0
  85. package/dist/0.9/components/display/TextComponent.js +31 -0
  86. package/dist/0.9/components/display/VideoComponent.d.ts +5 -0
  87. package/dist/0.9/components/display/VideoComponent.js +30 -0
  88. package/dist/0.9/components/display/index.d.ts +9 -0
  89. package/dist/0.9/components/index.d.ts +12 -0
  90. package/dist/0.9/components/index.js +68 -0
  91. package/dist/0.9/components/interactive/ButtonComponent.d.ts +6 -0
  92. package/dist/0.9/components/interactive/ButtonComponent.js +29 -0
  93. package/dist/0.9/components/interactive/CheckBoxComponent.d.ts +5 -0
  94. package/dist/0.9/components/interactive/CheckBoxComponent.js +41 -0
  95. package/dist/0.9/components/interactive/ChoicePickerComponent.d.ts +7 -0
  96. package/dist/0.9/components/interactive/ChoicePickerComponent.js +80 -0
  97. package/dist/0.9/components/interactive/DateTimeInputComponent.d.ts +5 -0
  98. package/dist/0.9/components/interactive/DateTimeInputComponent.js +50 -0
  99. package/dist/0.9/components/interactive/SliderComponent.d.ts +6 -0
  100. package/dist/0.9/components/interactive/SliderComponent.js +47 -0
  101. package/dist/0.9/components/interactive/TextFieldComponent.d.ts +5 -0
  102. package/dist/0.9/components/interactive/TextFieldComponent.js +57 -0
  103. package/dist/0.9/components/interactive/index.d.ts +9 -0
  104. package/dist/0.9/components/layout/CardComponent.d.ts +5 -0
  105. package/dist/0.9/components/layout/CardComponent.js +15 -0
  106. package/dist/0.9/components/layout/ColumnComponent.d.ts +6 -0
  107. package/dist/0.9/components/layout/ColumnComponent.js +50 -0
  108. package/dist/0.9/components/layout/ListComponent.d.ts +17 -0
  109. package/dist/0.9/components/layout/ListComponent.js +42 -0
  110. package/dist/0.9/components/layout/ModalComponent.d.ts +5 -0
  111. package/dist/0.9/components/layout/ModalComponent.js +30 -0
  112. package/dist/0.9/components/layout/RowComponent.d.ts +6 -0
  113. package/dist/0.9/components/layout/RowComponent.js +50 -0
  114. package/dist/0.9/components/layout/TabsComponent.d.ts +5 -0
  115. package/dist/0.9/components/layout/TabsComponent.js +30 -0
  116. package/dist/0.9/components/layout/TemplateRenderer.d.ts +25 -0
  117. package/dist/0.9/components/layout/TemplateRenderer.js +49 -0
  118. package/dist/0.9/components/layout/index.d.ts +10 -0
  119. package/dist/0.9/contexts/A2UIProvider.d.ts +58 -0
  120. package/dist/0.9/contexts/A2UIProvider.js +34 -0
  121. package/dist/0.9/contexts/ActionContext.d.ts +33 -0
  122. package/dist/0.9/contexts/ActionContext.js +47 -0
  123. package/dist/0.9/contexts/ComponentsMapContext.d.ts +73 -0
  124. package/dist/0.9/contexts/ComponentsMapContext.js +21 -0
  125. package/dist/0.9/contexts/ScopeContext.d.ts +53 -0
  126. package/dist/0.9/contexts/ScopeContext.js +22 -0
  127. package/dist/0.9/contexts/SurfaceContext.d.ts +50 -0
  128. package/dist/0.9/contexts/SurfaceContext.js +118 -0
  129. package/dist/0.9/hooks/useA2UIMessageHandler.d.ts +44 -0
  130. package/dist/0.9/hooks/useA2UIMessageHandler.js +87 -0
  131. package/dist/0.9/hooks/useComponent.d.ts +23 -0
  132. package/dist/0.9/hooks/useComponent.js +9 -0
  133. package/dist/0.9/hooks/useDataBinding.d.ts +59 -0
  134. package/dist/0.9/hooks/useDataBinding.js +43 -0
  135. package/dist/0.9/hooks/useDispatchAction.d.ts +22 -0
  136. package/dist/0.9/hooks/useDispatchAction.js +17 -0
  137. package/dist/0.9/hooks/useValidation.d.ts +25 -0
  138. package/dist/0.9/hooks/useValidation.js +14 -0
  139. package/dist/0.9/index.d.ts +35 -0
  140. package/dist/0.9/index.js +26 -0
  141. package/dist/0.9/utils/dataBinding.d.ts +126 -0
  142. package/dist/0.9/utils/dataBinding.js +41 -0
  143. package/dist/0.9/utils/pathUtils.d.ts +109 -0
  144. package/dist/0.9/utils/pathUtils.js +74 -0
  145. package/dist/0.9/utils/validation.d.ts +49 -0
  146. package/dist/0.9/utils/validation.js +75 -0
  147. package/dist/components/ui/button.d.ts +10 -0
  148. package/dist/components/ui/button.js +53 -0
  149. package/dist/components/ui/card.d.ts +9 -0
  150. package/dist/components/ui/card.js +29 -0
  151. package/dist/components/ui/checkbox.d.ts +4 -0
  152. package/dist/components/ui/checkbox.js +31 -0
  153. package/dist/components/ui/dialog.d.ts +15 -0
  154. package/dist/components/ui/dialog.js +77 -0
  155. package/dist/components/ui/input.d.ts +3 -0
  156. package/dist/components/ui/input.js +21 -0
  157. package/dist/components/ui/label.d.ts +4 -0
  158. package/dist/components/ui/label.js +22 -0
  159. package/dist/components/ui/native-select.d.ts +7 -0
  160. package/dist/components/ui/select.d.ts +15 -0
  161. package/dist/components/ui/select.js +144 -0
  162. package/dist/components/ui/separator.d.ts +4 -0
  163. package/dist/components/ui/separator.js +26 -0
  164. package/dist/components/ui/slider.d.ts +4 -0
  165. package/dist/components/ui/slider.js +63 -0
  166. package/dist/components/ui/tabs.d.ts +7 -0
  167. package/dist/components/ui/tabs.js +67 -0
  168. package/dist/components/ui/textarea.d.ts +3 -0
  169. package/dist/components/ui/textarea.js +18 -0
  170. package/dist/index.d.ts +2 -0
  171. package/dist/index.js +6 -0
  172. package/dist/lib/utils.d.ts +2 -0
  173. package/dist/lib/utils.js +8 -0
  174. package/package.json +75 -0
@@ -0,0 +1,95 @@
1
+ import { ValueSource, DataModel, DataEntry, DataModelValue } from '@a2ui-sdk/types/0.8';
2
+ /**
3
+ * Resolves a ValueSource to its actual value.
4
+ *
5
+ * @param source - The value source (literal or path reference)
6
+ * @param dataModel - The data model for path lookups
7
+ * @param defaultValue - Default value if source is undefined or path not found
8
+ * @returns The resolved value
9
+ *
10
+ * @example
11
+ * // Literal values
12
+ * resolveValue({ literalString: "Hello" }, {}); // "Hello"
13
+ * resolveValue({ literalNumber: 42 }, {}); // 42
14
+ *
15
+ * // Path references
16
+ * const model = { user: { name: "John" } };
17
+ * resolveValue({ path: "/user/name" }, model); // "John"
18
+ * resolveValue({ path: "/user/age" }, model, 0); // 0 (default)
19
+ */
20
+ export declare function resolveValue<T = unknown>(source: ValueSource | undefined, dataModel: DataModel, defaultValue?: T): T;
21
+ /**
22
+ * Checks if a value source is a path reference.
23
+ *
24
+ * @param source - The value source to check
25
+ * @returns True if the source is a path reference
26
+ */
27
+ export declare function isPathReference(source: ValueSource | undefined): source is {
28
+ path: string;
29
+ };
30
+ /**
31
+ * Gets the path from a value source, or undefined if it's not a path reference.
32
+ *
33
+ * @param source - The value source
34
+ * @returns The path string or undefined
35
+ */
36
+ export declare function getPath(source: ValueSource | undefined): string | undefined;
37
+ /**
38
+ * Converts a DataEntry array to a plain object.
39
+ * This is used for processing dataModelUpdate message contents.
40
+ *
41
+ * @param contents - Array of data entries from the server
42
+ * @returns A plain object with the converted values
43
+ *
44
+ * @example
45
+ * contentsToObject([
46
+ * { key: "name", valueString: "John" },
47
+ * { key: "age", valueNumber: 30 },
48
+ * { key: "active", valueBoolean: true },
49
+ * { key: "profile", valueMap: [
50
+ * { key: "email", valueString: "john@example.com" }
51
+ * ]}
52
+ * ]);
53
+ * // Returns: { name: "John", age: 30, active: true, profile: { email: "john@example.com" } }
54
+ */
55
+ export declare function contentsToObject(contents: DataEntry[]): Record<string, DataModelValue>;
56
+ /**
57
+ * Creates a literal string value source.
58
+ *
59
+ * @param value - The string value
60
+ * @returns A ValueSource with literalString
61
+ */
62
+ export declare function literalString(value: string): ValueSource;
63
+ /**
64
+ * Creates a literal number value source.
65
+ *
66
+ * @param value - The number value
67
+ * @returns A ValueSource with literalNumber
68
+ */
69
+ export declare function literalNumber(value: number): ValueSource;
70
+ /**
71
+ * Creates a literal boolean value source.
72
+ *
73
+ * @param value - The boolean value
74
+ * @returns A ValueSource with literalBoolean
75
+ */
76
+ export declare function literalBoolean(value: boolean): ValueSource;
77
+ /**
78
+ * Creates a path reference value source.
79
+ *
80
+ * @param path - The data model path
81
+ * @returns A ValueSource with path
82
+ */
83
+ export declare function pathRef(path: string): ValueSource;
84
+ /**
85
+ * Resolves action context items to a plain object.
86
+ * This is used when dispatching actions to resolve all context values.
87
+ *
88
+ * @param context - Array of action context items
89
+ * @param dataModel - The data model for path lookups
90
+ * @returns A plain object with resolved context values
91
+ */
92
+ export declare function resolveActionContext(context: Array<{
93
+ key: string;
94
+ value: ValueSource;
95
+ }> | undefined, dataModel: DataModel): Record<string, unknown>;
@@ -0,0 +1,46 @@
1
+ import { getValueByPath as r } from "./pathUtils.js";
2
+ function l(e, n, t) {
3
+ if (e == null)
4
+ return t;
5
+ if ("literalString" in e)
6
+ return e.literalString;
7
+ if ("literalNumber" in e)
8
+ return e.literalNumber;
9
+ if ("literalBoolean" in e)
10
+ return e.literalBoolean;
11
+ if ("literalArray" in e)
12
+ return e.literalArray;
13
+ if ("path" in e) {
14
+ const i = r(n, e.path);
15
+ return i === void 0 ? t : i;
16
+ }
17
+ return t;
18
+ }
19
+ function a(e) {
20
+ const n = {};
21
+ for (const t of e) {
22
+ const i = o(t.key);
23
+ t.valueString !== void 0 ? n[i] = t.valueString : t.valueNumber !== void 0 ? n[i] = t.valueNumber : t.valueBoolean !== void 0 ? n[i] = t.valueBoolean : t.valueMap !== void 0 && (n[i] = a(t.valueMap));
24
+ }
25
+ return n;
26
+ }
27
+ function o(e) {
28
+ if (e.includes("/")) {
29
+ const n = e.split("/").filter(Boolean);
30
+ return n[n.length - 1] || e;
31
+ }
32
+ return e;
33
+ }
34
+ function f(e, n) {
35
+ if (!e)
36
+ return {};
37
+ const t = {};
38
+ for (const i of e)
39
+ t[i.key] = l(i.value, n);
40
+ return t;
41
+ }
42
+ export {
43
+ a as contentsToObject,
44
+ f as resolveActionContext,
45
+ l as resolveValue
46
+ };
@@ -0,0 +1,63 @@
1
+ import { DataModel, DataModelValue } from '@a2ui-sdk/types/0.8';
2
+ /**
3
+ * Gets a value from the data model by path.
4
+ *
5
+ * @param dataModel - The data model to read from
6
+ * @param path - The path to the value (e.g., "/user/name")
7
+ * @returns The value at the path, or undefined if not found
8
+ *
9
+ * @example
10
+ * const model = { user: { name: "John" } };
11
+ * getValueByPath(model, "/user/name"); // "John"
12
+ * getValueByPath(model, "/user/age"); // undefined
13
+ */
14
+ export declare function getValueByPath(dataModel: DataModel, path: string): DataModelValue | undefined;
15
+ /**
16
+ * Sets a value in the data model by path, returning a new data model.
17
+ * This function is immutable - it does not modify the original data model.
18
+ *
19
+ * @param dataModel - The data model to update
20
+ * @param path - The path to set (e.g., "/user/name")
21
+ * @param value - The value to set
22
+ * @returns A new data model with the value set
23
+ *
24
+ * @example
25
+ * const model = { user: { name: "John" } };
26
+ * setValueByPath(model, "/user/name", "Jane");
27
+ * // Returns: { user: { name: "Jane" } }
28
+ */
29
+ export declare function setValueByPath(dataModel: DataModel, path: string, value: unknown): DataModel;
30
+ /**
31
+ * Merges data into the data model at a given path.
32
+ * This is used for dataModelUpdate messages where contents are merged.
33
+ *
34
+ * @param dataModel - The data model to update
35
+ * @param path - The path to merge at (e.g., "/form")
36
+ * @param data - The data to merge
37
+ * @returns A new data model with the data merged
38
+ */
39
+ export declare function mergeAtPath(dataModel: DataModel, path: string, data: Record<string, unknown>): DataModel;
40
+ /**
41
+ * Normalizes a path to ensure it starts with "/" and has no trailing "/".
42
+ *
43
+ * @param path - The path to normalize
44
+ * @returns The normalized path
45
+ *
46
+ * @example
47
+ * normalizePath("user/name"); // "/user/name"
48
+ * normalizePath("/user/name/"); // "/user/name"
49
+ */
50
+ export declare function normalizePath(path: string): string;
51
+ /**
52
+ * Joins two paths together.
53
+ *
54
+ * @param basePath - The base path
55
+ * @param relativePath - The relative path to join
56
+ * @returns The joined path
57
+ *
58
+ * @example
59
+ * joinPaths("/user", "name"); // "/user/name"
60
+ * joinPaths("/user", "/name"); // "/user/name"
61
+ * joinPaths("/user/", "/name/"); // "/user/name"
62
+ */
63
+ export declare function joinPaths(basePath: string, relativePath: string): string;
@@ -0,0 +1,44 @@
1
+ function l(e, t) {
2
+ if (!t || t === "/")
3
+ return e;
4
+ const n = t.split("/").filter(Boolean);
5
+ let r = e;
6
+ for (const o of n) {
7
+ if (r == null || typeof r != "object")
8
+ return;
9
+ r = r[o];
10
+ }
11
+ return r;
12
+ }
13
+ function g(e, t, n) {
14
+ if (!t || t === "/")
15
+ return typeof n == "object" && n !== null && !Array.isArray(n) ? { ...e, ...n } : e;
16
+ const r = t.split("/").filter(Boolean);
17
+ function o(u, s, i) {
18
+ if (s.length === 0)
19
+ return typeof i == "object" && i !== null && !Array.isArray(i) ? { ...u, ...i } : u;
20
+ const [f, ...y] = s;
21
+ if (y.length === 0)
22
+ return {
23
+ ...u,
24
+ [f]: i
25
+ };
26
+ const c = u[f], A = typeof c == "object" && c !== null && !Array.isArray(c) ? c : {};
27
+ return {
28
+ ...u,
29
+ [f]: o(A, y, i)
30
+ };
31
+ }
32
+ return o(e, r, n);
33
+ }
34
+ function b(e, t, n) {
35
+ if (!t || t === "/")
36
+ return { ...e, ...n };
37
+ const r = l(e, t), u = { ...typeof r == "object" && r !== null && !Array.isArray(r) ? r : {}, ...n };
38
+ return g(e, t, u);
39
+ }
40
+ export {
41
+ l as getValueByPath,
42
+ b as mergeAtPath,
43
+ g as setValueByPath
44
+ };
@@ -0,0 +1,54 @@
1
+ /**
2
+ * A2UIRenderer - Component for rendering A2UI 0.9 surfaces.
3
+ *
4
+ * This component renders the surfaces from the A2UI context.
5
+ * It must be used within an A2UIProvider.
6
+ *
7
+ * @example
8
+ * ```tsx
9
+ * import { A2UIProvider, A2UIRenderer, A2UIMessage, A2UIAction } from '@a2ui-sdk/react/0.9'
10
+ *
11
+ * function App() {
12
+ * const messages: A2UIMessage[] = [...]
13
+ * const handleAction = (action: A2UIAction) => {
14
+ * console.log('Action:', action)
15
+ * }
16
+ * return (
17
+ * <A2UIProvider messages={messages} onAction={handleAction}>
18
+ * <A2UIRenderer />
19
+ * </A2UIProvider>
20
+ * )
21
+ * }
22
+ * ```
23
+ */
24
+ /**
25
+ * Props for A2UIRenderer.
26
+ */
27
+ export interface A2UIRendererProps {
28
+ /** Optional surface ID to render a specific surface (renders all if not provided) */
29
+ surfaceId?: string;
30
+ }
31
+ /**
32
+ * Component for rendering A2UI 0.9 surfaces.
33
+ *
34
+ * Renders all surfaces from the A2UI context, or a specific surface if surfaceId is provided.
35
+ * Must be used within an A2UIProvider.
36
+ *
37
+ * @example
38
+ * ```tsx
39
+ * // Render all surfaces
40
+ * <A2UIProvider messages={messages} onAction={handleAction}>
41
+ * <A2UIRenderer />
42
+ * </A2UIProvider>
43
+ *
44
+ * // Render specific surface
45
+ * <A2UIProvider messages={messages} onAction={handleAction}>
46
+ * <A2UIRenderer surfaceId="sidebar" />
47
+ * <A2UIRenderer surfaceId="main" />
48
+ * </A2UIProvider>
49
+ * ```
50
+ */
51
+ export declare function A2UIRenderer({ surfaceId }: A2UIRendererProps): import("react/jsx-runtime").JSX.Element | null;
52
+ export declare namespace A2UIRenderer {
53
+ var displayName: string;
54
+ }
@@ -0,0 +1,41 @@
1
+ import { jsx as i, Fragment as s } from "react/jsx-runtime";
2
+ import { useSurfaceContext as a } from "./contexts/SurfaceContext.js";
3
+ import { ComponentRenderer as f } from "./components/ComponentRenderer.js";
4
+ function c(e) {
5
+ if (e.has("root"))
6
+ return "root";
7
+ const t = /* @__PURE__ */ new Set();
8
+ for (const r of e.values()) {
9
+ if ("children" in r) {
10
+ const n = r.children;
11
+ Array.isArray(n) && n.forEach((o) => t.add(o));
12
+ }
13
+ "child" in r && typeof r.child == "string" && t.add(r.child), "trigger" in r && typeof r.trigger == "string" && t.add(r.trigger), "content" in r && typeof r.content == "string" && t.add(r.content), "tabs" in r && Array.isArray(r.tabs) && r.tabs.forEach((n) => {
14
+ n.child && t.add(n.child);
15
+ });
16
+ }
17
+ for (const [r] of e)
18
+ if (!t.has(r))
19
+ return r;
20
+ }
21
+ function l({ surfaceId: e }) {
22
+ const { surfaces: t } = a();
23
+ if (e) {
24
+ const n = t.get(e);
25
+ if (!n || !n.created)
26
+ return null;
27
+ const o = c(n.components);
28
+ return o ? /* @__PURE__ */ i(f, { surfaceId: e, componentId: o }) : null;
29
+ }
30
+ const r = Array.from(t.entries());
31
+ return r.length === 0 ? null : /* @__PURE__ */ i(s, { children: r.map(([n, o]) => {
32
+ if (!o.created)
33
+ return null;
34
+ const d = c(o.components);
35
+ return d ? /* @__PURE__ */ i(f, { surfaceId: n, componentId: d }, n) : null;
36
+ }) });
37
+ }
38
+ l.displayName = "A2UI.Renderer";
39
+ export {
40
+ l as A2UIRenderer
41
+ };
@@ -0,0 +1,39 @@
1
+ import { ComponentType } from 'react';
2
+ import { A2UIComponentProps } from '../contexts/ComponentsMapContext';
3
+ /**
4
+ * Component registry mapping component type names to React components.
5
+ * This will be populated with actual components.
6
+ */
7
+ export declare const componentRegistry: Record<string, ComponentType<A2UIComponentProps>>;
8
+ /**
9
+ * Props for ComponentRenderer.
10
+ */
11
+ export interface ComponentRendererProps {
12
+ surfaceId: string;
13
+ componentId: string;
14
+ }
15
+ /**
16
+ * Renders a component based on its type from the component registry.
17
+ * Supports custom component overrides via ComponentsMapContext.
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * // Render a component by ID
22
+ * <ComponentRenderer surfaceId="surface-1" componentId="text-1" />
23
+ * ```
24
+ */
25
+ export declare const ComponentRenderer: import('react').NamedExoticComponent<ComponentRendererProps>;
26
+ /**
27
+ * Registers a component type in the default registry.
28
+ *
29
+ * @param type - The component type name
30
+ * @param component - The React component to register
31
+ *
32
+ * @example
33
+ * ```tsx
34
+ * registerComponent('CustomChart', ({ surfaceId, component }) => {
35
+ * return <Chart data={component.data} />;
36
+ * });
37
+ * ```
38
+ */
39
+ export declare function registerComponent(type: string, component: ComponentType<A2UIComponentProps>): void;
@@ -0,0 +1,34 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { memo as l, useContext as C } from "react";
3
+ import { useComponent as c } from "../hooks/useComponent.js";
4
+ import { ComponentsMapContext as f } from "../contexts/ComponentsMapContext.js";
5
+ import { UnknownComponent as u } from "./UnknownComponent.js";
6
+ const a = {}, m = /* @__PURE__ */ new Set(), y = l(function({
7
+ surfaceId: n,
8
+ componentId: o
9
+ }) {
10
+ const e = c(n, o), p = C(f), r = `${n}:${o}`;
11
+ if (m.has(r))
12
+ return console.error(
13
+ `[A2UI 0.9] Circular reference detected for component "${o}" on surface "${n}". Skipping render.`
14
+ ), null;
15
+ if (!e)
16
+ return console.warn(
17
+ `[A2UI 0.9] Component not found: ${o} on surface ${n}`
18
+ ), null;
19
+ const i = e.component;
20
+ let t;
21
+ if (p ? t = p.getComponent(i) : t = a[i], !t)
22
+ return /* @__PURE__ */ s(u, { surfaceId: n, component: e });
23
+ m.add(r);
24
+ try {
25
+ return /* @__PURE__ */ s(t, { surfaceId: n, component: e });
26
+ } finally {
27
+ m.delete(r);
28
+ }
29
+ });
30
+ y.displayName = "A2UI.ComponentRenderer";
31
+ export {
32
+ y as ComponentRenderer,
33
+ a as componentRegistry
34
+ };
@@ -0,0 +1,11 @@
1
+ import { A2UIComponentProps } from '../contexts/ComponentsMapContext';
2
+ /**
3
+ * Fallback component for unknown types.
4
+ *
5
+ * Displays a warning box with the unknown component type name
6
+ * to help developers identify configuration issues.
7
+ */
8
+ export declare function UnknownComponent({ component }: A2UIComponentProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare namespace UnknownComponent {
10
+ var displayName: string;
11
+ }
@@ -0,0 +1,35 @@
1
+ import { jsxs as p, jsx as t } from "react/jsx-runtime";
2
+ function r({ component: n }) {
3
+ const o = n.component, e = n.id;
4
+ return process.env.NODE_ENV === "development" && console.warn(
5
+ `[A2UI 0.9] Unknown component type "${o}" (id: ${e}). Make sure the component type is correct or provide a custom component.`
6
+ ), /* @__PURE__ */ p(
7
+ "div",
8
+ {
9
+ style: {
10
+ padding: "8px 12px",
11
+ margin: "4px",
12
+ backgroundColor: "#fff3cd",
13
+ border: "1px solid #ffc107",
14
+ borderRadius: "4px",
15
+ color: "#856404",
16
+ fontSize: "12px",
17
+ fontFamily: "monospace"
18
+ },
19
+ children: [
20
+ /* @__PURE__ */ t("strong", { children: "Unknown component:" }),
21
+ " ",
22
+ o,
23
+ /* @__PURE__ */ t("br", {}),
24
+ /* @__PURE__ */ p("span", { style: { opacity: 0.7 }, children: [
25
+ "ID: ",
26
+ e
27
+ ] })
28
+ ]
29
+ }
30
+ );
31
+ }
32
+ r.displayName = "A2UI.UnknownComponent";
33
+ export {
34
+ r as UnknownComponent
35
+ };
@@ -0,0 +1,5 @@
1
+ import { A2UIComponentProps } from '../../contexts/ComponentsMapContext';
2
+ /**
3
+ * AudioPlayer component for playing audio content.
4
+ */
5
+ export declare const AudioPlayerComponent: import('react').NamedExoticComponent<A2UIComponentProps>;
@@ -0,0 +1,21 @@
1
+ import { jsxs as m, jsx as i } from "react/jsx-runtime";
2
+ import { memo as d } from "react";
3
+ import { useStringBinding as n } from "../../hooks/useDataBinding.js";
4
+ import { cn as u } from "../../../lib/utils.js";
5
+ const c = d(function({
6
+ surfaceId: e,
7
+ component: s
8
+ }) {
9
+ const o = s, r = n(e, o.url, ""), t = n(e, o.description, "");
10
+ if (!r)
11
+ return null;
12
+ const l = o.weight ? { flexGrow: o.weight } : void 0;
13
+ return /* @__PURE__ */ m("div", { className: u("flex flex-col gap-2"), style: l, children: [
14
+ t && /* @__PURE__ */ i("p", { className: "text-sm text-muted-foreground", children: t }),
15
+ /* @__PURE__ */ i("audio", { src: r, controls: !0, className: "w-full", children: "Your browser does not support the audio element." })
16
+ ] });
17
+ });
18
+ c.displayName = "A2UI.AudioPlayer";
19
+ export {
20
+ c as AudioPlayerComponent
21
+ };
@@ -0,0 +1,5 @@
1
+ import { A2UIComponentProps } from '../../contexts/ComponentsMapContext';
2
+ /**
3
+ * Divider component for visual separation.
4
+ */
5
+ export declare const DividerComponent: import('react').NamedExoticComponent<A2UIComponentProps>;
@@ -0,0 +1,19 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { memo as t } from "react";
3
+ import { Separator as e } from "../../../components/ui/separator.js";
4
+ const m = t(function({
5
+ component: i
6
+ }) {
7
+ const o = i.axis ?? "horizontal";
8
+ return /* @__PURE__ */ r(
9
+ e,
10
+ {
11
+ orientation: o,
12
+ className: o === "vertical" ? "self-stretch h-auto!" : "w-full"
13
+ }
14
+ );
15
+ });
16
+ m.displayName = "A2UI.Divider";
17
+ export {
18
+ m as DividerComponent
19
+ };
@@ -0,0 +1,5 @@
1
+ import { A2UIComponentProps } from '../../contexts/ComponentsMapContext';
2
+ /**
3
+ * Icon component for displaying icons from the A2UI icon set.
4
+ */
5
+ export declare const IconComponent: import('react').NamedExoticComponent<A2UIComponentProps>;
@@ -0,0 +1,68 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { memo as t } from "react";
3
+ import { useStringBinding as l } from "../../hooks/useDataBinding.js";
4
+ import { AlertTriangle as c, EyeOff as f, Eye as s, Upload as m, StarOff as p, StarHalf as d, Star as h, ShoppingCart as C, Share2 as u, Settings as w, Send as g, Search as O, RefreshCw as S, Printer as k, Image as y, Phone as o, User as H, CreditCard as I, Bell as U, BellOff as A, MoreHorizontal as M, MoreVertical as P, Menu as v, Mail as B, Unlock as F, Lock as N, MapPin as T, Info as b, Home as x, HelpCircle as z, Folder as D, HeartOff as E, Heart as L, AlertCircle as R, CalendarDays as V, Pencil as j, Download as X, Trash2 as $, X as q, Check as G, Camera as J, Calendar as K, Paperclip as Q, ArrowRight as W, ArrowLeft as Y, Plus as Z, UserCircle as _ } from "lucide-react";
5
+ import { cn as ee } from "../../../lib/utils.js";
6
+ const re = {
7
+ accountCircle: _,
8
+ add: Z,
9
+ arrowBack: Y,
10
+ arrowForward: W,
11
+ attachFile: Q,
12
+ calendarToday: K,
13
+ call: o,
14
+ camera: J,
15
+ check: G,
16
+ close: q,
17
+ delete: $,
18
+ download: X,
19
+ edit: j,
20
+ event: V,
21
+ error: R,
22
+ favorite: L,
23
+ favoriteOff: E,
24
+ folder: D,
25
+ help: z,
26
+ home: x,
27
+ info: b,
28
+ locationOn: T,
29
+ lock: N,
30
+ lockOpen: F,
31
+ mail: B,
32
+ menu: v,
33
+ moreVert: P,
34
+ moreHoriz: M,
35
+ notificationsOff: A,
36
+ notifications: U,
37
+ payment: I,
38
+ person: H,
39
+ phone: o,
40
+ photo: y,
41
+ print: k,
42
+ refresh: S,
43
+ search: O,
44
+ send: g,
45
+ settings: w,
46
+ share: u,
47
+ shoppingCart: C,
48
+ star: h,
49
+ starHalf: d,
50
+ starOff: p,
51
+ upload: m,
52
+ visibility: s,
53
+ visibilityOff: f,
54
+ warning: c
55
+ }, oe = t(function({
56
+ surfaceId: n,
57
+ component: a
58
+ }) {
59
+ const e = l(n, a.name, "");
60
+ if (!e)
61
+ return null;
62
+ const r = re[e];
63
+ return r ? /* @__PURE__ */ i(r, { className: ee("w-5 h-5") }) : (console.warn(`[A2UI 0.9] Unknown icon name: ${e}`), null);
64
+ });
65
+ oe.displayName = "A2UI.Icon";
66
+ export {
67
+ oe as IconComponent
68
+ };
@@ -0,0 +1,6 @@
1
+ import { A2UIComponentProps } from '../../contexts/ComponentsMapContext';
2
+ /**
3
+ * Image component for displaying images.
4
+ * Supports different sizes via variant and object-fit via fit property.
5
+ */
6
+ export declare const ImageComponent: import('react').NamedExoticComponent<A2UIComponentProps>;
@@ -0,0 +1,43 @@
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { memo as s } from "react";
3
+ import { useStringBinding as f } from "../../hooks/useDataBinding.js";
4
+ import { cn as u } from "../../../lib/utils.js";
5
+ const n = {
6
+ contain: "object-contain",
7
+ cover: "object-cover",
8
+ fill: "object-fill",
9
+ none: "object-none",
10
+ "scale-down": "object-scale-down"
11
+ }, g = {
12
+ icon: "w-6 h-6",
13
+ avatar: "w-10 h-10 rounded-full",
14
+ smallFeature: "w-16 h-16",
15
+ mediumFeature: "w-32 h-32",
16
+ largeFeature: "w-48 h-48",
17
+ header: "w-full h-48"
18
+ }, w = s(function({
19
+ surfaceId: r,
20
+ component: a
21
+ }) {
22
+ const o = a, e = f(r, o.url, "");
23
+ if (!e)
24
+ return null;
25
+ const i = o.fit ?? "cover", t = o.variant, c = o.weight ? { flexGrow: o.weight } : void 0, l = u(
26
+ n[i] || n.cover,
27
+ t && g[t]
28
+ );
29
+ return /* @__PURE__ */ m(
30
+ "img",
31
+ {
32
+ src: e,
33
+ alt: "",
34
+ className: l,
35
+ style: c,
36
+ loading: "lazy"
37
+ }
38
+ );
39
+ });
40
+ w.displayName = "A2UI.Image";
41
+ export {
42
+ w as ImageComponent
43
+ };
@@ -0,0 +1,6 @@
1
+ import { A2UIComponentProps } from '../../contexts/ComponentsMapContext';
2
+ /**
3
+ * Text component for displaying text content.
4
+ * Supports different text styles via variant.
5
+ */
6
+ export declare const TextComponent: import('react').NamedExoticComponent<A2UIComponentProps>;