glchat-a2ui-react-renderer 0.3.6 → 0.4.1

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 (128) 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_9/AudioPlayer/AudioPlayer.d.ts +1 -5
  12. package/dist/src/components/a2ui/v0_9/AudioPlayer/AudioPlayer.d.ts.map +1 -1
  13. package/dist/src/components/a2ui/v0_9/AudioPlayer/AudioPlayer.js +2 -12
  14. package/dist/src/components/a2ui/v0_9/Button/Button.d.ts +73 -239
  15. package/dist/src/components/a2ui/v0_9/Button/Button.d.ts.map +1 -1
  16. package/dist/src/components/a2ui/v0_9/Button/Button.js +2 -13
  17. package/dist/src/components/a2ui/v0_9/ChoicePicker/ChoicePicker.d.ts +1 -8
  18. package/dist/src/components/a2ui/v0_9/ChoicePicker/ChoicePicker.d.ts.map +1 -1
  19. package/dist/src/components/a2ui/v0_9/ChoicePicker/ChoicePicker.js +2 -51
  20. package/dist/src/components/a2ui/v0_9/TagInput/TagInput.d.ts +40 -196
  21. package/dist/src/components/a2ui/v0_9/TagInput/TagInput.d.ts.map +1 -1
  22. package/dist/src/components/a2ui/v0_9/TagInput/TagInput.js +3 -10
  23. package/dist/src/components/a2ui/v0_9/Timeout/Timeout.d.ts +24 -100
  24. package/dist/src/components/a2ui/v0_9/Timeout/Timeout.d.ts.map +1 -1
  25. package/dist/src/components/a2ui/v0_9/Timeout/Timeout.js +3 -23
  26. package/dist/src/components/a2ui/v0_9/common.d.ts +11 -57
  27. package/dist/src/components/a2ui/v0_9/common.d.ts.map +1 -1
  28. package/dist/src/components/a2ui/v0_9/common.js +0 -9
  29. package/dist/src/components/a2ui/v1_0/AudioPlayer/AudioPlayer.d.ts +3 -0
  30. package/dist/src/components/a2ui/v1_0/AudioPlayer/AudioPlayer.d.ts.map +1 -0
  31. package/dist/src/components/a2ui/v1_0/AudioPlayer/AudioPlayer.js +6 -0
  32. package/dist/src/components/a2ui/v1_0/Button/Button.d.ts +223 -0
  33. package/dist/src/components/a2ui/v1_0/Button/Button.d.ts.map +1 -0
  34. package/dist/src/components/a2ui/v1_0/Button/Button.js +26 -0
  35. package/dist/src/components/a2ui/v1_0/ChoicePicker/ChoicePicker.d.ts +3 -0
  36. package/dist/src/components/a2ui/v1_0/ChoicePicker/ChoicePicker.d.ts.map +1 -0
  37. package/dist/src/components/a2ui/v1_0/ChoicePicker/ChoicePicker.js +6 -0
  38. package/dist/src/components/a2ui/v1_0/TagInput/TagInput.d.ts +214 -0
  39. package/dist/src/components/a2ui/v1_0/TagInput/TagInput.d.ts.map +1 -0
  40. package/dist/src/components/a2ui/v1_0/TagInput/TagInput.js +34 -0
  41. package/dist/src/components/a2ui/v1_0/Timeout/Timeout.d.ts +58 -0
  42. package/dist/src/components/a2ui/v1_0/Timeout/Timeout.d.ts.map +1 -0
  43. package/dist/src/components/a2ui/v1_0/Timeout/Timeout.js +25 -0
  44. package/dist/src/components/a2ui/v1_0/common.d.ts +15 -0
  45. package/dist/src/components/a2ui/v1_0/common.d.ts.map +1 -0
  46. package/dist/src/components/a2ui/v1_0/common.js +16 -0
  47. package/dist/src/components/a2ui/views/AudioPlayer/AudioPlayer.d.ts +14 -0
  48. package/dist/src/components/a2ui/views/AudioPlayer/AudioPlayer.d.ts.map +1 -0
  49. package/dist/src/components/a2ui/views/AudioPlayer/AudioPlayer.js +10 -0
  50. package/dist/src/components/a2ui/views/Button/Button.d.ts +18 -0
  51. package/dist/src/components/a2ui/views/Button/Button.d.ts.map +1 -0
  52. package/dist/src/components/a2ui/views/Button/Button.js +22 -0
  53. package/dist/src/components/a2ui/views/ChoicePicker/ChoicePicker.d.ts +25 -0
  54. package/dist/src/components/a2ui/views/ChoicePicker/ChoicePicker.d.ts.map +1 -0
  55. package/dist/src/components/a2ui/views/ChoicePicker/ChoicePicker.js +46 -0
  56. package/dist/src/components/a2ui/views/ChoicePicker/theme.d.ts.map +1 -0
  57. package/dist/src/components/a2ui/views/TagInput/TagInput.d.ts +16 -0
  58. package/dist/src/components/a2ui/views/TagInput/TagInput.d.ts.map +1 -0
  59. package/dist/src/components/a2ui/views/TagInput/TagInput.js +12 -0
  60. package/dist/src/components/a2ui/views/Timeout/Timeout.d.ts +9 -0
  61. package/dist/src/components/a2ui/views/Timeout/Timeout.d.ts.map +1 -0
  62. package/dist/src/components/a2ui/views/Timeout/Timeout.js +27 -0
  63. package/dist/src/components/a2ui/views/weight.d.ts +7 -0
  64. package/dist/src/components/a2ui/views/weight.d.ts.map +1 -0
  65. package/dist/src/components/a2ui/views/weight.js +9 -0
  66. package/dist/src/core/SurfaceErrorBoundary.d.ts +27 -0
  67. package/dist/src/core/SurfaceErrorBoundary.d.ts.map +1 -0
  68. package/dist/src/core/SurfaceErrorBoundary.js +24 -0
  69. package/dist/src/core/SurfaceGroupProvider.d.ts +40 -0
  70. package/dist/src/core/SurfaceGroupProvider.d.ts.map +1 -0
  71. package/dist/src/core/SurfaceGroupProvider.js +142 -0
  72. package/dist/src/core/SurfaceRenderer.d.ts +4 -0
  73. package/dist/src/core/SurfaceRenderer.d.ts.map +1 -0
  74. package/dist/src/core/SurfaceRenderer.js +64 -0
  75. package/dist/src/core/errors.d.ts +44 -0
  76. package/dist/src/core/errors.d.ts.map +1 -0
  77. package/dist/src/core/errors.js +42 -0
  78. package/dist/src/core/types.d.ts +11 -0
  79. package/dist/src/core/types.d.ts.map +1 -0
  80. package/dist/src/core/types.js +1 -0
  81. package/dist/src/core/unknownComponent.d.ts +28 -0
  82. package/dist/src/core/unknownComponent.d.ts.map +1 -0
  83. package/dist/src/core/unknownComponent.js +41 -0
  84. package/dist/src/{v0_9 → core}/useSurfaces.d.ts +3 -3
  85. package/dist/src/core/useSurfaces.d.ts.map +1 -0
  86. package/dist/src/utils/detectVersion.d.ts +4 -2
  87. package/dist/src/utils/detectVersion.d.ts.map +1 -1
  88. package/dist/src/utils/detectVersion.js +5 -1
  89. package/dist/src/v0_8/Provider.d.ts +2 -1
  90. package/dist/src/v0_8/Provider.d.ts.map +1 -1
  91. package/dist/src/v0_8/Provider.js +3 -8
  92. package/dist/src/v0_9/Provider.d.ts +13 -13
  93. package/dist/src/v0_9/Provider.d.ts.map +1 -1
  94. package/dist/src/v0_9/Provider.js +14 -61
  95. package/dist/src/v0_9/catalog.d.ts +2 -8
  96. package/dist/src/v0_9/catalog.d.ts.map +1 -1
  97. package/dist/src/v0_9/catalog.js +3 -17
  98. package/dist/src/v1_0/Provider.d.ts +27 -0
  99. package/dist/src/v1_0/Provider.d.ts.map +1 -0
  100. package/dist/src/v1_0/Provider.js +35 -0
  101. package/dist/src/v1_0/catalog.d.ts +52 -0
  102. package/dist/src/v1_0/catalog.d.ts.map +1 -0
  103. package/dist/src/v1_0/catalog.js +118 -0
  104. package/dist/src/v1_0/types.d.ts +13 -0
  105. package/dist/src/v1_0/types.d.ts.map +1 -0
  106. package/dist/src/v1_0/types.js +1 -0
  107. package/json/README.md +27 -30
  108. package/json/v0_9/glchat_standard_catalog_definition.json +5 -5
  109. package/json/v1_0/a2ui-sample-messages-extension.json +150 -0
  110. package/json/v1_0/a2ui-sample-messages.json +144 -0
  111. package/json/v1_0/glchat_extension_catalog_definition.json +794 -0
  112. package/json/v1_0/glchat_standard_catalog_definition.json +1487 -0
  113. package/package.json +4 -4
  114. package/styles/globals.css +136 -67
  115. package/dist/src/components/a2ui/v0_9/ChoicePicker/theme.d.ts.map +0 -1
  116. package/dist/src/components/a2ui/v0_9/UnknownComponent/UnknownComponent.d.ts +0 -231
  117. package/dist/src/components/a2ui/v0_9/UnknownComponent/UnknownComponent.d.ts.map +0 -1
  118. package/dist/src/components/a2ui/v0_9/UnknownComponent/UnknownComponent.js +0 -24
  119. package/dist/src/v0_9/SurfaceErrorBoundary.d.ts +0 -18
  120. package/dist/src/v0_9/SurfaceErrorBoundary.d.ts.map +0 -1
  121. package/dist/src/v0_9/SurfaceErrorBoundary.js +0 -24
  122. package/dist/src/v0_9/SurfaceRenderer.d.ts +0 -3
  123. package/dist/src/v0_9/SurfaceRenderer.d.ts.map +0 -1
  124. package/dist/src/v0_9/SurfaceRenderer.js +0 -47
  125. package/dist/src/v0_9/useSurfaces.d.ts.map +0 -1
  126. /package/dist/src/components/a2ui/{v0_9 → views}/ChoicePicker/theme.d.ts +0 -0
  127. /package/dist/src/components/a2ui/{v0_9 → views}/ChoicePicker/theme.js +0 -0
  128. /package/dist/src/{v0_9 → core}/useSurfaces.js +0 -0
@@ -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", children: 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