glchat-a2ui-react-renderer 0.3.5 → 0.4.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 (133) hide show
  1. package/README.md +200 -267
  2. package/dist/index.d.ts +13 -6
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +14 -4
  5. package/dist/src/Provider.d.ts +33 -8
  6. package/dist/src/Provider.d.ts.map +1 -1
  7. package/dist/src/Provider.js +12 -10
  8. package/dist/src/SurfaceRenderer.d.ts +7 -1
  9. package/dist/src/SurfaceRenderer.d.ts.map +1 -1
  10. package/dist/src/SurfaceRenderer.js +2 -2
  11. package/dist/src/components/a2ui/v0_8/UnknownComponent/UnknownComponent.d.ts.map +1 -1
  12. package/dist/src/components/a2ui/v0_8/UnknownComponent/UnknownComponent.js +1 -1
  13. package/dist/src/components/a2ui/v0_9/AudioPlayer/AudioPlayer.d.ts +1 -5
  14. package/dist/src/components/a2ui/v0_9/AudioPlayer/AudioPlayer.d.ts.map +1 -1
  15. package/dist/src/components/a2ui/v0_9/AudioPlayer/AudioPlayer.js +2 -12
  16. package/dist/src/components/a2ui/v0_9/Button/Button.d.ts +75 -241
  17. package/dist/src/components/a2ui/v0_9/Button/Button.d.ts.map +1 -1
  18. package/dist/src/components/a2ui/v0_9/Button/Button.js +2 -13
  19. package/dist/src/components/a2ui/v0_9/ChoicePicker/ChoicePicker.d.ts +1 -8
  20. package/dist/src/components/a2ui/v0_9/ChoicePicker/ChoicePicker.d.ts.map +1 -1
  21. package/dist/src/components/a2ui/v0_9/ChoicePicker/ChoicePicker.js +2 -51
  22. package/dist/src/components/a2ui/v0_9/TagInput/TagInput.d.ts +40 -196
  23. package/dist/src/components/a2ui/v0_9/TagInput/TagInput.d.ts.map +1 -1
  24. package/dist/src/components/a2ui/v0_9/TagInput/TagInput.js +3 -10
  25. package/dist/src/components/a2ui/v0_9/Timeout/Timeout.d.ts +26 -102
  26. package/dist/src/components/a2ui/v0_9/Timeout/Timeout.d.ts.map +1 -1
  27. package/dist/src/components/a2ui/v0_9/Timeout/Timeout.js +3 -23
  28. package/dist/src/components/a2ui/v0_9/common.d.ts +11 -57
  29. package/dist/src/components/a2ui/v0_9/common.d.ts.map +1 -1
  30. package/dist/src/components/a2ui/v0_9/common.js +0 -9
  31. package/dist/src/components/a2ui/v1_0/AudioPlayer/AudioPlayer.d.ts +3 -0
  32. package/dist/src/components/a2ui/v1_0/AudioPlayer/AudioPlayer.d.ts.map +1 -0
  33. package/dist/src/components/a2ui/v1_0/AudioPlayer/AudioPlayer.js +6 -0
  34. package/dist/src/components/a2ui/v1_0/Button/Button.d.ts +223 -0
  35. package/dist/src/components/a2ui/v1_0/Button/Button.d.ts.map +1 -0
  36. package/dist/src/components/a2ui/v1_0/Button/Button.js +26 -0
  37. package/dist/src/components/a2ui/v1_0/ChoicePicker/ChoicePicker.d.ts +3 -0
  38. package/dist/src/components/a2ui/v1_0/ChoicePicker/ChoicePicker.d.ts.map +1 -0
  39. package/dist/src/components/a2ui/v1_0/ChoicePicker/ChoicePicker.js +6 -0
  40. package/dist/src/components/a2ui/v1_0/TagInput/TagInput.d.ts +214 -0
  41. package/dist/src/components/a2ui/v1_0/TagInput/TagInput.d.ts.map +1 -0
  42. package/dist/src/components/a2ui/v1_0/TagInput/TagInput.js +34 -0
  43. package/dist/src/components/a2ui/v1_0/Timeout/Timeout.d.ts +58 -0
  44. package/dist/src/components/a2ui/v1_0/Timeout/Timeout.d.ts.map +1 -0
  45. package/dist/src/components/a2ui/v1_0/Timeout/Timeout.js +25 -0
  46. package/dist/src/components/a2ui/v1_0/common.d.ts +15 -0
  47. package/dist/src/components/a2ui/v1_0/common.d.ts.map +1 -0
  48. package/dist/src/components/a2ui/v1_0/common.js +16 -0
  49. package/dist/src/components/a2ui/views/AudioPlayer/AudioPlayer.d.ts +14 -0
  50. package/dist/src/components/a2ui/views/AudioPlayer/AudioPlayer.d.ts.map +1 -0
  51. package/dist/src/components/a2ui/views/AudioPlayer/AudioPlayer.js +10 -0
  52. package/dist/src/components/a2ui/views/Button/Button.d.ts +18 -0
  53. package/dist/src/components/a2ui/views/Button/Button.d.ts.map +1 -0
  54. package/dist/src/components/a2ui/views/Button/Button.js +22 -0
  55. package/dist/src/components/a2ui/views/ChoicePicker/ChoicePicker.d.ts +25 -0
  56. package/dist/src/components/a2ui/views/ChoicePicker/ChoicePicker.d.ts.map +1 -0
  57. package/dist/src/components/a2ui/views/ChoicePicker/ChoicePicker.js +46 -0
  58. package/dist/src/components/a2ui/views/ChoicePicker/theme.d.ts.map +1 -0
  59. package/dist/src/components/a2ui/views/TagInput/TagInput.d.ts +16 -0
  60. package/dist/src/components/a2ui/views/TagInput/TagInput.d.ts.map +1 -0
  61. package/dist/src/components/a2ui/views/TagInput/TagInput.js +12 -0
  62. package/dist/src/components/a2ui/views/Timeout/Timeout.d.ts +9 -0
  63. package/dist/src/components/a2ui/views/Timeout/Timeout.d.ts.map +1 -0
  64. package/dist/src/components/a2ui/views/Timeout/Timeout.js +27 -0
  65. package/dist/src/components/a2ui/views/weight.d.ts +7 -0
  66. package/dist/src/components/a2ui/views/weight.d.ts.map +1 -0
  67. package/dist/src/components/a2ui/views/weight.js +9 -0
  68. package/dist/src/components/ui/InlineAlert/InlineAlert.d.ts +60 -9
  69. package/dist/src/components/ui/InlineAlert/InlineAlert.d.ts.map +1 -1
  70. package/dist/src/components/ui/InlineAlert/InlineAlert.js +4 -3
  71. package/dist/src/core/SurfaceErrorBoundary.d.ts +27 -0
  72. package/dist/src/core/SurfaceErrorBoundary.d.ts.map +1 -0
  73. package/dist/src/core/SurfaceErrorBoundary.js +24 -0
  74. package/dist/src/core/SurfaceGroupProvider.d.ts +38 -0
  75. package/dist/src/core/SurfaceGroupProvider.d.ts.map +1 -0
  76. package/dist/src/core/SurfaceGroupProvider.js +142 -0
  77. package/dist/src/core/SurfaceRenderer.d.ts +4 -0
  78. package/dist/src/core/SurfaceRenderer.d.ts.map +1 -0
  79. package/dist/src/core/SurfaceRenderer.js +64 -0
  80. package/dist/src/core/errors.d.ts +44 -0
  81. package/dist/src/core/errors.d.ts.map +1 -0
  82. package/dist/src/core/errors.js +42 -0
  83. package/dist/src/core/types.d.ts +11 -0
  84. package/dist/src/core/types.d.ts.map +1 -0
  85. package/dist/src/core/types.js +1 -0
  86. package/dist/src/core/unknownComponent.d.ts +28 -0
  87. package/dist/src/core/unknownComponent.d.ts.map +1 -0
  88. package/dist/src/core/unknownComponent.js +41 -0
  89. package/dist/src/{v0_9 → core}/useSurfaces.d.ts +3 -3
  90. package/dist/src/core/useSurfaces.d.ts.map +1 -0
  91. package/dist/src/utils/detectVersion.d.ts +1 -1
  92. package/dist/src/utils/detectVersion.d.ts.map +1 -1
  93. package/dist/src/utils/detectVersion.js +5 -1
  94. package/dist/src/v0_8/Provider.d.ts +2 -1
  95. package/dist/src/v0_8/Provider.d.ts.map +1 -1
  96. package/dist/src/v0_8/Provider.js +4 -9
  97. package/dist/src/v0_9/Provider.d.ts +13 -13
  98. package/dist/src/v0_9/Provider.d.ts.map +1 -1
  99. package/dist/src/v0_9/Provider.js +14 -61
  100. package/dist/src/v0_9/catalog.d.ts +2 -8
  101. package/dist/src/v0_9/catalog.d.ts.map +1 -1
  102. package/dist/src/v0_9/catalog.js +3 -17
  103. package/dist/src/v1_0/Provider.d.ts +27 -0
  104. package/dist/src/v1_0/Provider.d.ts.map +1 -0
  105. package/dist/src/v1_0/Provider.js +35 -0
  106. package/dist/src/v1_0/catalog.d.ts +52 -0
  107. package/dist/src/v1_0/catalog.d.ts.map +1 -0
  108. package/dist/src/v1_0/catalog.js +118 -0
  109. package/dist/src/v1_0/types.d.ts +13 -0
  110. package/dist/src/v1_0/types.d.ts.map +1 -0
  111. package/dist/src/v1_0/types.js +1 -0
  112. package/json/README.md +27 -30
  113. package/json/v0_9/glchat_standard_catalog_definition.json +5 -5
  114. package/json/v1_0/a2ui-sample-messages-extension.json +150 -0
  115. package/json/v1_0/a2ui-sample-messages.json +144 -0
  116. package/json/v1_0/glchat_extension_catalog_definition.json +794 -0
  117. package/json/v1_0/glchat_standard_catalog_definition.json +1487 -0
  118. package/package.json +4 -4
  119. package/styles/globals.css +180 -86
  120. package/dist/src/components/a2ui/v0_9/ChoicePicker/theme.d.ts.map +0 -1
  121. package/dist/src/components/a2ui/v0_9/UnknownComponent/UnknownComponent.d.ts +0 -231
  122. package/dist/src/components/a2ui/v0_9/UnknownComponent/UnknownComponent.d.ts.map +0 -1
  123. package/dist/src/components/a2ui/v0_9/UnknownComponent/UnknownComponent.js +0 -24
  124. package/dist/src/v0_9/SurfaceErrorBoundary.d.ts +0 -18
  125. package/dist/src/v0_9/SurfaceErrorBoundary.d.ts.map +0 -1
  126. package/dist/src/v0_9/SurfaceErrorBoundary.js +0 -24
  127. package/dist/src/v0_9/SurfaceRenderer.d.ts +0 -3
  128. package/dist/src/v0_9/SurfaceRenderer.d.ts.map +0 -1
  129. package/dist/src/v0_9/SurfaceRenderer.js +0 -47
  130. package/dist/src/v0_9/useSurfaces.d.ts.map +0 -1
  131. /package/dist/src/components/a2ui/{v0_9 → views}/ChoicePicker/theme.d.ts +0 -0
  132. /package/dist/src/components/a2ui/{v0_9 → views}/ChoicePicker/theme.js +0 -0
  133. /package/dist/src/{v0_9 → core}/useSurfaces.js +0 -0
@@ -1,231 +0,0 @@
1
- import { z } from 'zod';
2
- /**
3
- * Fallback API used when a message references a component type that is not
4
- * registered in the active catalog. Properties are accepted but ignored.
5
- */
6
- export declare const UnknownComponentApi: {
7
- name: string;
8
- schema: z.ZodObject<{
9
- accessibility: z.ZodOptional<z.ZodObject<{
10
- label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
11
- path: z.ZodString;
12
- }, "strip", z.ZodTypeAny, {
13
- path: string;
14
- }, {
15
- path: string;
16
- }>, z.ZodObject<{
17
- call: z.ZodString;
18
- args: z.ZodRecord<z.ZodString, z.ZodAny>;
19
- returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
20
- }, "strip", z.ZodTypeAny, {
21
- call: string;
22
- args: Record<string, any>;
23
- returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
24
- }, {
25
- call: string;
26
- args: Record<string, any>;
27
- returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
28
- }>]>>;
29
- description: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
30
- path: z.ZodString;
31
- }, "strip", z.ZodTypeAny, {
32
- path: string;
33
- }, {
34
- path: string;
35
- }>, z.ZodObject<{
36
- call: z.ZodString;
37
- args: z.ZodRecord<z.ZodString, z.ZodAny>;
38
- returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
39
- }, "strip", z.ZodTypeAny, {
40
- call: string;
41
- args: Record<string, any>;
42
- returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
43
- }, {
44
- call: string;
45
- args: Record<string, any>;
46
- returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
47
- }>]>>;
48
- }, "strip", z.ZodTypeAny, {
49
- description?: string | {
50
- path: string;
51
- } | {
52
- call: string;
53
- args: Record<string, any>;
54
- returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
55
- } | undefined;
56
- label?: string | {
57
- path: string;
58
- } | {
59
- call: string;
60
- args: Record<string, any>;
61
- returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
62
- } | undefined;
63
- }, {
64
- description?: string | {
65
- path: string;
66
- } | {
67
- call: string;
68
- args: Record<string, any>;
69
- returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
70
- } | undefined;
71
- label?: string | {
72
- path: string;
73
- } | {
74
- call: string;
75
- args: Record<string, any>;
76
- returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
77
- } | undefined;
78
- }>>;
79
- weight: z.ZodOptional<z.ZodNumber>;
80
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
81
- accessibility: z.ZodOptional<z.ZodObject<{
82
- label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
83
- path: z.ZodString;
84
- }, "strip", z.ZodTypeAny, {
85
- path: string;
86
- }, {
87
- path: string;
88
- }>, z.ZodObject<{
89
- call: z.ZodString;
90
- args: z.ZodRecord<z.ZodString, z.ZodAny>;
91
- returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
92
- }, "strip", z.ZodTypeAny, {
93
- call: string;
94
- args: Record<string, any>;
95
- returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
96
- }, {
97
- call: string;
98
- args: Record<string, any>;
99
- returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
100
- }>]>>;
101
- description: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
102
- path: z.ZodString;
103
- }, "strip", z.ZodTypeAny, {
104
- path: string;
105
- }, {
106
- path: string;
107
- }>, z.ZodObject<{
108
- call: z.ZodString;
109
- args: z.ZodRecord<z.ZodString, z.ZodAny>;
110
- returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
111
- }, "strip", z.ZodTypeAny, {
112
- call: string;
113
- args: Record<string, any>;
114
- returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
115
- }, {
116
- call: string;
117
- args: Record<string, any>;
118
- returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
119
- }>]>>;
120
- }, "strip", z.ZodTypeAny, {
121
- description?: string | {
122
- path: string;
123
- } | {
124
- call: string;
125
- args: Record<string, any>;
126
- returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
127
- } | undefined;
128
- label?: string | {
129
- path: string;
130
- } | {
131
- call: string;
132
- args: Record<string, any>;
133
- returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
134
- } | undefined;
135
- }, {
136
- description?: string | {
137
- path: string;
138
- } | {
139
- call: string;
140
- args: Record<string, any>;
141
- returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
142
- } | undefined;
143
- label?: string | {
144
- path: string;
145
- } | {
146
- call: string;
147
- args: Record<string, any>;
148
- returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
149
- } | undefined;
150
- }>>;
151
- weight: z.ZodOptional<z.ZodNumber>;
152
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
153
- accessibility: z.ZodOptional<z.ZodObject<{
154
- label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
155
- path: z.ZodString;
156
- }, "strip", z.ZodTypeAny, {
157
- path: string;
158
- }, {
159
- path: string;
160
- }>, z.ZodObject<{
161
- call: z.ZodString;
162
- args: z.ZodRecord<z.ZodString, z.ZodAny>;
163
- returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
164
- }, "strip", z.ZodTypeAny, {
165
- call: string;
166
- args: Record<string, any>;
167
- returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
168
- }, {
169
- call: string;
170
- args: Record<string, any>;
171
- returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
172
- }>]>>;
173
- description: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
174
- path: z.ZodString;
175
- }, "strip", z.ZodTypeAny, {
176
- path: string;
177
- }, {
178
- path: string;
179
- }>, z.ZodObject<{
180
- call: z.ZodString;
181
- args: z.ZodRecord<z.ZodString, z.ZodAny>;
182
- returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
183
- }, "strip", z.ZodTypeAny, {
184
- call: string;
185
- args: Record<string, any>;
186
- returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
187
- }, {
188
- call: string;
189
- args: Record<string, any>;
190
- returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
191
- }>]>>;
192
- }, "strip", z.ZodTypeAny, {
193
- description?: string | {
194
- path: string;
195
- } | {
196
- call: string;
197
- args: Record<string, any>;
198
- returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
199
- } | undefined;
200
- label?: string | {
201
- path: string;
202
- } | {
203
- call: string;
204
- args: Record<string, any>;
205
- returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
206
- } | undefined;
207
- }, {
208
- description?: string | {
209
- path: string;
210
- } | {
211
- call: string;
212
- args: Record<string, any>;
213
- returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
214
- } | undefined;
215
- label?: string | {
216
- path: string;
217
- } | {
218
- call: string;
219
- args: Record<string, any>;
220
- returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
221
- } | undefined;
222
- }>>;
223
- weight: z.ZodOptional<z.ZodNumber>;
224
- }, z.ZodTypeAny, "passthrough">>;
225
- };
226
- /**
227
- * Renders a warning alert for unknown component types.
228
- * Wired into catalogs via `installUnknownComponentFallback`.
229
- */
230
- export declare const UnknownComponentFallback: import("@a2ui/react/v0_9").ReactComponentImplementation;
231
- //# sourceMappingURL=UnknownComponent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UnknownComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/components/a2ui/v0_9/UnknownComponent/UnknownComponent.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;;GAGG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;0BAwB8pZ,CAAC;;;;;;;;;;;;;;;;;;;0BAAivB,CAAC;;;;;;;;;;;;;;;;;;;;;;;0BAA2sB,CAAC;;;;;;;0BAA0O,CAAC;;;;;;;;;;;;;;;;;;;;;;;0BAA1qD,CAAC;;;;;;;;;;;;;;;;;;;0BAAivB,CAAC;;;;;;;;;;;;;;;;;;;;;;;0BAA2sB,CAAC;;;;;;;0BAA0O,CAAC;;;;;;;;;;;;;;;;;;;;;;;0BAA1qD,CAAC;;;;;;;;;;;;;;;;;;;0BAAivB,CAAC;;;;;;;;;;;;;;;;;;;;;;;0BAA2sB,CAAC;;;;;;;0BAA0O,CAAC;;;;;CAhBv2c,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB,yDASpC,CAAC"}
@@ -1,24 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { createBinderlessComponentImplementation } from '@a2ui/react/v0_9';
4
- import { z } from 'zod';
5
- import { InlineAlert } from '../../../../components/ui/InlineAlert/InlineAlert.js';
6
- import { CommonProps } from '../common.js';
7
- /**
8
- * Fallback API used when a message references a component type that is not
9
- * registered in the active catalog. Properties are accepted but ignored.
10
- */
11
- export const UnknownComponentApi = {
12
- name: '__UnknownComponent__',
13
- schema: z
14
- .object({
15
- ...CommonProps,
16
- })
17
- .passthrough()
18
- .describe('Placeholder for an unsupported or unregistered A2UI component.'),
19
- };
20
- /**
21
- * Renders a warning alert for unknown component types.
22
- * Wired into catalogs via `installUnknownComponentFallback`.
23
- */
24
- export const UnknownComponentFallback = createBinderlessComponentImplementation(UnknownComponentApi, ({ context }) => (_jsx(InlineAlert, { role: "status", variant: "warning", message: `Unknown A2UI component: ${context.componentModel.type}` })));
@@ -1,18 +0,0 @@
1
- import { Component, type ErrorInfo, type ReactNode } from 'react';
2
- type SurfaceErrorBoundaryProps = Readonly<{
3
- children: ReactNode;
4
- }>;
5
- type SurfaceErrorBoundaryState = {
6
- hasError: boolean;
7
- };
8
- /**
9
- * Catches render errors from `@a2ui/react` catalog components.
10
- */
11
- export declare class SurfaceErrorBoundary extends Component<SurfaceErrorBoundaryProps, SurfaceErrorBoundaryState> {
12
- state: SurfaceErrorBoundaryState;
13
- static getDerivedStateFromError(): SurfaceErrorBoundaryState;
14
- componentDidCatch(error: Error, info: ErrorInfo): void;
15
- render(): ReactNode;
16
- }
17
- export {};
18
- //# sourceMappingURL=SurfaceErrorBoundary.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SurfaceErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/v0_9/SurfaceErrorBoundary.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMlE,KAAK,yBAAyB,GAAG,QAAQ,CAAC;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,CAAC,CAAC;AACnE,KAAK,yBAAyB,GAAG;IAAE,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvD;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,SAAS,CACjD,yBAAyB,EACzB,yBAAyB,CAC1B;IACC,KAAK,EAAE,yBAAyB,CAAuB;IAEvD,MAAM,CAAC,wBAAwB,IAAI,yBAAyB;IAI5D,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI;IAKtD,MAAM,IAAI,SAAS;CAMpB"}
@@ -1,24 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { Component } from 'react';
4
- import { InlineAlert } from '../components/ui/InlineAlert/InlineAlert.js';
5
- const RENDER_ERROR_MESSAGE = 'Failed to render A2UI surface';
6
- /**
7
- * Catches render errors from `@a2ui/react` catalog components.
8
- */
9
- export class SurfaceErrorBoundary extends Component {
10
- state = { hasError: false };
11
- static getDerivedStateFromError() {
12
- return { hasError: true };
13
- }
14
- componentDidCatch(error, info) {
15
- // eslint-disable-next-line no-console -- match Provider message-process logging
16
- console.error('[glchat-a2ui] Failed to render v0.9 surface:', error, info.componentStack);
17
- }
18
- render() {
19
- if (this.state.hasError) {
20
- return _jsx(InlineAlert, { role: "alert", variant: "warning", message: RENDER_ERROR_MESSAGE });
21
- }
22
- return this.props.children;
23
- }
24
- }
@@ -1,3 +0,0 @@
1
- import type { SurfaceRendererProps } from '../SurfaceRenderer.js';
2
- export declare function V09SurfaceRenderer(props: Readonly<SurfaceRendererProps>): import("react").JSX.Element;
3
- //# sourceMappingURL=SurfaceRenderer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SurfaceRenderer.d.ts","sourceRoot":"","sources":["../../../src/v0_9/SurfaceRenderer.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AA2DlE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,oBAAoB,CAAC,+BAkCvE"}
@@ -1,47 +0,0 @@
1
- 'use client';
2
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
3
- import { useCallback, useSyncExternalStore } from 'react';
4
- import { A2uiSurface } from '@a2ui/react/v0_9';
5
- import { InlineAlert } from '../components/ui/InlineAlert/InlineAlert.js';
6
- import { useSurfaceGroup } from './Provider.js';
7
- import { SurfaceErrorBoundary } from './SurfaceErrorBoundary.js';
8
- import { useSurfaces } from './useSurfaces.js';
9
- const DEFAULT_FALLBACK = _jsx(_Fragment, {});
10
- const ROOT_MISSING_MESSAGE = 'This A2UI interface could not be loaded because no root component was found.';
11
- /** True when the surface has a `root` component (replace `@a2ui` "[Loading root...]"). */
12
- function useHasRootComponent(surface) {
13
- const subscribe = useCallback((onStoreChange) => {
14
- const created = surface.componentsModel.onCreated.subscribe(() => onStoreChange());
15
- const deleted = surface.componentsModel.onDeleted.subscribe(() => onStoreChange());
16
- return () => {
17
- created.unsubscribe();
18
- deleted.unsubscribe();
19
- };
20
- }, [surface]);
21
- const getSnapshot = useCallback(() => surface.componentsModel.get('root') != null, [surface]);
22
- return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
23
- }
24
- function SurfaceView({ surface, className, fallback, hasMessages, }) {
25
- const hasRoot = useHasRootComponent(surface);
26
- if (!hasRoot) {
27
- if (!hasMessages)
28
- return _jsx(_Fragment, { children: fallback });
29
- return (_jsx("div", { className: className, children: _jsx(InlineAlert, { role: "alert", variant: "warning", message: ROOT_MISSING_MESSAGE }) }));
30
- }
31
- return (_jsx("div", { className: className, children: _jsx(SurfaceErrorBoundary, { children: _jsx(A2uiSurface, { surface: surface }) }) }));
32
- }
33
- export function V09SurfaceRenderer(props) {
34
- const { model, hasMessages } = useSurfaceGroup();
35
- const surfaces = useSurfaces(model);
36
- const fallback = props.fallback ?? DEFAULT_FALLBACK;
37
- const surfaceClassName = props.className ? `a2ui-surface ${props.className}` : 'a2ui-surface';
38
- if (props.surfaceId !== undefined) {
39
- const surface = model.getSurface(props.surfaceId);
40
- if (!surface)
41
- return _jsx(_Fragment, { children: fallback });
42
- return (_jsx(SurfaceView, { surface: surface, className: surfaceClassName, fallback: fallback, hasMessages: hasMessages }));
43
- }
44
- if (surfaces.length === 0)
45
- return _jsx(_Fragment, { children: fallback });
46
- return (_jsx(_Fragment, { children: surfaces.map((surface) => (_jsx(SurfaceView, { surface: surface, className: surfaceClassName, fallback: fallback, hasMessages: hasMessages }, surface.id))) }));
47
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"useSurfaces.d.ts","sourceRoot":"","sources":["../../../src/v0_9/useSurfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAG3E;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,iBAAiB,CAAC,4BAA4B,CAAC,GACrD,YAAY,CAAC,4BAA4B,CAAC,EAAE,CA6B9C"}
File without changes