glchat-a2ui-react-renderer 0.1.0 → 0.2.2

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 (75) hide show
  1. package/README.md +68 -116
  2. package/dist/index.d.ts +4 -4
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +5 -7
  5. package/dist/src/AllSurfacesRenderer.d.ts +14 -0
  6. package/dist/src/AllSurfacesRenderer.d.ts.map +1 -0
  7. package/dist/src/AllSurfacesRenderer.js +18 -0
  8. package/dist/src/Provider.d.ts +20 -0
  9. package/dist/src/Provider.d.ts.map +1 -0
  10. package/dist/src/Provider.js +50 -0
  11. package/dist/src/SingleSurfaceRenderer.d.ts +15 -0
  12. package/dist/src/SingleSurfaceRenderer.d.ts.map +1 -0
  13. package/dist/src/SingleSurfaceRenderer.js +9 -0
  14. package/dist/src/components/Button/Button.d.ts +4 -0
  15. package/dist/src/components/Button/Button.d.ts.map +1 -0
  16. package/dist/src/components/Button/Button.js +27 -0
  17. package/dist/src/components/Button/theme.d.ts +14 -0
  18. package/dist/src/components/Button/theme.d.ts.map +1 -0
  19. package/dist/src/components/Button/theme.js +59 -0
  20. package/dist/src/components/Card/Card.d.ts +4 -0
  21. package/dist/src/components/Card/Card.d.ts.map +1 -0
  22. package/dist/src/components/Card/Card.js +16 -0
  23. package/dist/src/components/Card/theme.d.ts +10 -0
  24. package/dist/src/components/Card/theme.d.ts.map +1 -0
  25. package/dist/src/components/Card/theme.js +21 -0
  26. package/dist/src/components/Timeout/Timeout.d.ts +4 -0
  27. package/dist/src/components/Timeout/Timeout.d.ts.map +1 -0
  28. package/dist/src/components/Timeout/Timeout.js +30 -0
  29. package/dist/src/components/Timeout/theme.d.ts +8 -0
  30. package/dist/src/components/Timeout/theme.d.ts.map +1 -0
  31. package/dist/src/components/Timeout/theme.js +12 -0
  32. package/dist/src/utils/catalog.d.ts +7 -0
  33. package/dist/src/utils/catalog.d.ts.map +1 -0
  34. package/dist/src/utils/catalog.js +21 -0
  35. package/dist/src/utils/theme.d.ts +4 -0
  36. package/dist/src/utils/theme.d.ts.map +1 -0
  37. package/dist/src/utils/theme.js +67 -0
  38. package/dist/src/utils/time.d.ts +17 -0
  39. package/dist/src/utils/time.d.ts.map +1 -0
  40. package/dist/src/utils/time.js +28 -0
  41. package/package.json +12 -3
  42. package/styles/globals.css +35 -0
  43. package/dist/src/a2ui/GlchatA2UIProvider.d.ts +0 -4
  44. package/dist/src/a2ui/GlchatA2UIProvider.d.ts.map +0 -1
  45. package/dist/src/a2ui/GlchatA2UIProvider.js +0 -8
  46. package/dist/src/a2ui/GlchatA2UIRenderer.d.ts +0 -4
  47. package/dist/src/a2ui/GlchatA2UIRenderer.d.ts.map +0 -1
  48. package/dist/src/a2ui/GlchatA2UIRenderer.js +0 -6
  49. package/dist/src/a2ui/adapter.d.ts +0 -3
  50. package/dist/src/a2ui/adapter.d.ts.map +0 -1
  51. package/dist/src/a2ui/adapter.js +0 -12
  52. package/dist/src/a2ui/glchatStandardCatalog.d.ts +0 -10
  53. package/dist/src/a2ui/glchatStandardCatalog.d.ts.map +0 -1
  54. package/dist/src/a2ui/glchatStandardCatalog.js +0 -14
  55. package/dist/src/components/custom/Button.d.ts +0 -3
  56. package/dist/src/components/custom/Button.d.ts.map +0 -1
  57. package/dist/src/components/custom/Button.js +0 -14
  58. package/dist/src/components/custom/Card.d.ts +0 -3
  59. package/dist/src/components/custom/Card.d.ts.map +0 -1
  60. package/dist/src/components/custom/Card.js +0 -7
  61. package/dist/src/components/custom/Timeout.d.ts +0 -3
  62. package/dist/src/components/custom/Timeout.d.ts.map +0 -1
  63. package/dist/src/components/custom/Timeout.js +0 -6
  64. package/dist/src/components/ui/Button.d.ts +0 -12
  65. package/dist/src/components/ui/Button.d.ts.map +0 -1
  66. package/dist/src/components/ui/Button.js +0 -38
  67. package/dist/src/components/ui/Card.d.ts +0 -9
  68. package/dist/src/components/ui/Card.d.ts.map +0 -1
  69. package/dist/src/components/ui/Card.js +0 -16
  70. package/dist/src/components/ui/Timeout.d.ts +0 -6
  71. package/dist/src/components/ui/Timeout.d.ts.map +0 -1
  72. package/dist/src/components/ui/Timeout.js +0 -35
  73. package/dist/src/helpers/css.d.ts +0 -6
  74. package/dist/src/helpers/css.d.ts.map +0 -1
  75. package/dist/src/helpers/css.js +0 -7
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { classMapToString, useA2UIComponent, } from '@a2ui/react';
3
+ import { useEffect, useMemo, useState } from 'react';
4
+ import { getGlchatTimeoutTextStyle } from './theme.js';
5
+ import { formatAsHhMmSs, getRemainingSeconds } from '../../utils/time.js';
6
+ export function CustomTimeoutComponent({ node, surfaceId, }) {
7
+ const { resolveString, theme } = useA2UIComponent(node, surfaceId);
8
+ const props = node.properties;
9
+ const resolvedTargetTimeUtcString = useMemo(() => {
10
+ const raw = props.targetTimeUtc;
11
+ if (!raw)
12
+ return '';
13
+ return String(resolveString(raw) ?? '');
14
+ }, [props.targetTimeUtc, resolveString]);
15
+ const [remaining, setRemaining] = useState(() => getRemainingSeconds(resolvedTargetTimeUtcString));
16
+ useEffect(() => {
17
+ setRemaining(getRemainingSeconds(resolvedTargetTimeUtcString));
18
+ }, [resolvedTargetTimeUtcString]);
19
+ useEffect(() => {
20
+ if (!resolvedTargetTimeUtcString)
21
+ return;
22
+ const t = setInterval(() => {
23
+ setRemaining(getRemainingSeconds(resolvedTargetTimeUtcString));
24
+ }, 1000);
25
+ return () => clearInterval(t);
26
+ }, [resolvedTargetTimeUtcString]);
27
+ const hostStyle = node.weight === void 0 ? undefined : { '--weight': node.weight };
28
+ const textStyle = getGlchatTimeoutTextStyle();
29
+ return (_jsx("div", { className: "a2ui-text", style: hostStyle, children: _jsx("section", { className: classMapToString(theme.components.Text.all), style: textStyle, children: _jsx("p", { children: formatAsHhMmSs(remaining) }) }) }));
30
+ }
@@ -0,0 +1,8 @@
1
+ import type { CSSProperties } from 'react';
2
+ /**
3
+ * Tokenized style for GLChat Timeout countdown text.
4
+ *
5
+ * `--foreground` is client-overridable
6
+ */
7
+ export declare function getGlchatTimeoutTextStyle(): CSSProperties;
8
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../src/components/Timeout/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,aAAa,CAMzD"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Tokenized style for GLChat Timeout countdown text.
3
+ *
4
+ * `--foreground` is client-overridable
5
+ */
6
+ export function getGlchatTimeoutTextStyle() {
7
+ return {
8
+ color: `hsl(var(--foreground) / 0.5)`,
9
+ fontSize: '0.875rem',
10
+ lineHeight: '1.25rem',
11
+ };
12
+ }
@@ -0,0 +1,7 @@
1
+ import { type ComponentRegistry } from '@a2ui/react';
2
+ /**
3
+ * Ensures the registry has the official default A2UI components
4
+ * extended with GLChat-specific components (Button/Card/Timeout).
5
+ */
6
+ export declare function ensureGlchatComponentsRegistered(registry: ComponentRegistry): void;
7
+ //# sourceMappingURL=catalog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/utils/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAA0B,MAAM,aAAa,CAAC;AAQ7E;;;GAGG;AACH,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,iBAAiB,QAc3E"}
@@ -0,0 +1,21 @@
1
+ import { registerDefaultCatalog } from '@a2ui/react';
2
+ import { CustomButtonComponent } from '../components/Button/Button.js';
3
+ import { CustomCardComponent } from '../components/Card/Card.js';
4
+ import { CustomTimeoutComponent } from '../components/Timeout/Timeout.js';
5
+ const registeredRegistries = new WeakSet();
6
+ /**
7
+ * Ensures the registry has the official default A2UI components
8
+ * extended with GLChat-specific components (Button/Card/Timeout).
9
+ */
10
+ export function ensureGlchatComponentsRegistered(registry) {
11
+ if (registeredRegistries.has(registry))
12
+ return;
13
+ registerDefaultCatalog(registry);
14
+ registry.unregister('Button');
15
+ registry.unregister('Card');
16
+ registry.unregister('Timeout');
17
+ registry.register('Button', { component: CustomButtonComponent });
18
+ registry.register('Card', { component: CustomCardComponent });
19
+ registry.register('Timeout', { component: CustomTimeoutComponent });
20
+ registeredRegistries.add(registry);
21
+ }
@@ -0,0 +1,4 @@
1
+ import type { Theme } from '@a2ui/web_core/types/types';
2
+ export declare const glchatDefaultTheme: Theme;
3
+ export declare function mergeGlchatTheme(override?: Partial<Theme>): Theme;
4
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/utils/theme.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAQxD,eAAO,MAAM,kBAAkB,EAAE,KAYhC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,CAwDjE"}
@@ -0,0 +1,67 @@
1
+ import { litTheme } from '@a2ui/react';
2
+ import { glchatButtonAdditionalStyles, glchatButtonComponents, } from '../components/Button/theme.js';
3
+ import { glchatCardAdditionalStyles, glchatCardComponents } from '../components/Card/theme.js';
4
+ export const glchatDefaultTheme = {
5
+ ...litTheme,
6
+ components: {
7
+ ...litTheme.components,
8
+ Card: glchatCardComponents,
9
+ Button: glchatButtonComponents,
10
+ },
11
+ additionalStyles: {
12
+ ...litTheme.additionalStyles,
13
+ Card: { ...glchatCardAdditionalStyles },
14
+ Button: { ...glchatButtonAdditionalStyles },
15
+ },
16
+ };
17
+ export function mergeGlchatTheme(override) {
18
+ if (!override) {
19
+ return glchatDefaultTheme;
20
+ }
21
+ const patchComponents = override.components;
22
+ const patchElements = override.elements;
23
+ const patchMarkdown = override.markdown;
24
+ const patchAdditional = override.additionalStyles;
25
+ const components = patchComponents
26
+ ? {
27
+ ...glchatDefaultTheme.components,
28
+ ...patchComponents,
29
+ Card: {
30
+ ...glchatDefaultTheme.components.Card,
31
+ ...patchComponents.Card,
32
+ },
33
+ Button: {
34
+ ...glchatDefaultTheme.components.Button,
35
+ ...patchComponents.Button,
36
+ },
37
+ }
38
+ : glchatDefaultTheme.components;
39
+ const elements = patchElements
40
+ ? { ...glchatDefaultTheme.elements, ...patchElements }
41
+ : glchatDefaultTheme.elements;
42
+ const markdown = patchMarkdown
43
+ ? { ...glchatDefaultTheme.markdown, ...patchMarkdown }
44
+ : glchatDefaultTheme.markdown;
45
+ const additionalStyles = patchAdditional
46
+ ? {
47
+ ...glchatDefaultTheme.additionalStyles,
48
+ ...patchAdditional,
49
+ Card: {
50
+ ...glchatDefaultTheme.additionalStyles?.Card,
51
+ ...patchAdditional.Card,
52
+ },
53
+ Button: {
54
+ ...glchatDefaultTheme.additionalStyles?.Button,
55
+ ...patchAdditional.Button,
56
+ },
57
+ }
58
+ : glchatDefaultTheme.additionalStyles;
59
+ return {
60
+ ...glchatDefaultTheme,
61
+ ...override,
62
+ components,
63
+ elements,
64
+ markdown,
65
+ additionalStyles,
66
+ };
67
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Returns the number of whole seconds remaining until the given UTC time string.
3
+ *
4
+ * @param {string} targetTimeUtc - A UTC time string in a format recognized by Date.parse().
5
+ * @returns {number} The number of whole seconds remaining until the specified time.
6
+ * Returns 0 if the time is in the past or the string is invalid.
7
+ */
8
+ export declare function getRemainingSeconds(targetTimeUtc: string): number;
9
+ /**
10
+ * Formats a duration in seconds as HH:MM:SS.
11
+ * Negative values are clamped to 0.
12
+ *
13
+ * @param {number} seconds - The number of seconds to format.
14
+ * @returns {string} The formatted time string in HH:MM:SS format.
15
+ */
16
+ export declare function formatAsHhMmSs(seconds: number): string;
17
+ //# sourceMappingURL=time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../../src/utils/time.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAIjE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAOtD"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Returns the number of whole seconds remaining until the given UTC time string.
3
+ *
4
+ * @param {string} targetTimeUtc - A UTC time string in a format recognized by Date.parse().
5
+ * @returns {number} The number of whole seconds remaining until the specified time.
6
+ * Returns 0 if the time is in the past or the string is invalid.
7
+ */
8
+ export function getRemainingSeconds(targetTimeUtc) {
9
+ const targetMs = Date.parse(targetTimeUtc);
10
+ if (Number.isNaN(targetMs))
11
+ return 0;
12
+ return Math.max(0, Math.floor((targetMs - Date.now()) / 1000));
13
+ }
14
+ /**
15
+ * Formats a duration in seconds as HH:MM:SS.
16
+ * Negative values are clamped to 0.
17
+ *
18
+ * @param {number} seconds - The number of seconds to format.
19
+ * @returns {string} The formatted time string in HH:MM:SS format.
20
+ */
21
+ export function formatAsHhMmSs(seconds) {
22
+ const s = Math.max(0, Math.floor(seconds));
23
+ const m = Math.floor(s / 60);
24
+ const h = Math.floor(m / 60);
25
+ const mm = m % 60;
26
+ const ss = s % 60;
27
+ return `${String(h).padStart(2, '0')}:${String(mm).padStart(2, '0')}:${String(ss).padStart(2, '0')}`;
28
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glchat-a2ui-react-renderer",
3
- "version": "0.1.0",
3
+ "version": "0.2.2",
4
4
  "description": "A2UI (Agent-to-UI) React renderer for GLChat — render declarative UI from AI agent messages",
5
5
  "author": {
6
6
  "name": "GDP Labs",
@@ -40,15 +40,19 @@
40
40
  "build": "npm run build:ts",
41
41
  "build:ts": "tsc -p tsconfig.build.json",
42
42
  "prepare": "npm run build",
43
- "lint": "npx publint",
43
+ "lint": "eslint . && npx publint",
44
+ "lint:pub": "npx publint",
45
+ "format": "prettier --write .",
46
+ "format:check": "prettier --check .",
44
47
  "test": "vitest run",
48
+ "test:watch": "vitest",
45
49
  "test:coverage": "vitest run --coverage"
46
50
  },
47
51
  "peerDependencies": {
48
52
  "react": ">=18.0.0"
49
53
  },
50
54
  "dependencies": {
51
- "@a2ui-sdk/react": "^0.4.0",
55
+ "@a2ui/react": "^0.10.0",
52
56
  "@radix-ui/react-checkbox": "^1.3.3",
53
57
  "@radix-ui/react-label": "^2.1.8",
54
58
  "@radix-ui/react-separator": "^1.1.8",
@@ -61,9 +65,14 @@
61
65
  "@testing-library/react": "^16.0.1",
62
66
  "@types/react": "^18.3.12",
63
67
  "@vitest/coverage-v8": "^3.2.4",
68
+ "eslint": "^9.39.4",
69
+ "eslint-config-prettier": "^10.1.8",
70
+ "eslint-plugin-react-hooks": "^7.0.1",
64
71
  "jsdom": "^25.0.1",
72
+ "prettier": "^3.8.1",
65
73
  "publint": "^0.3.17",
66
74
  "typescript": "^5.7.2",
75
+ "typescript-eslint": "^8.57.2",
67
76
  "vitest": "^3.2.4",
68
77
  "vitest-sonar-reporter": "^2.0.4"
69
78
  },
@@ -101,3 +101,38 @@
101
101
 
102
102
  --hover: 0 0% 100% / 5%;
103
103
  }
104
+
105
+ /* Button */
106
+ .a2ui-surface .a2ui-button > button.glchat-a2ui-button {
107
+ font-weight: 600 !important;
108
+ }
109
+
110
+ .a2ui-surface .a2ui-button > button.glchat-a2ui-button .a2ui-text p,
111
+ .a2ui-surface .a2ui-button > button.glchat-a2ui-button p {
112
+ font-weight: 600 !important;
113
+ }
114
+
115
+ .a2ui-surface .a2ui-button > button.glchat-a2ui-button:hover {
116
+ background-image: var(--glchat-button-bg-hover) !important;
117
+ border-color: var(--glchat-button-border-hover) !important;
118
+ }
119
+
120
+ .a2ui-surface .a2ui-button > button.glchat-a2ui-button:focus,
121
+ .a2ui-surface .a2ui-button > button.glchat-a2ui-button:focus-visible {
122
+ outline: none !important;
123
+ background-image: var(--glchat-button-bg-hover) !important;
124
+ box-shadow: 0 0 0 2px var(--glchat-button-ring-color) !important;
125
+ }
126
+
127
+ .a2ui-surface .a2ui-button > button.glchat-a2ui-button:active {
128
+ background-image: var(--glchat-button-bg-active) !important;
129
+ border-color: var(--glchat-button-border-active) !important;
130
+ outline: none !important;
131
+ box-shadow: 0 0 0 2px var(--glchat-button-ring-color) !important;
132
+ }
133
+
134
+ .a2ui-surface .a2ui-button > button.glchat-a2ui-button:disabled {
135
+ opacity: 0.5 !important;
136
+ cursor: default !important;
137
+ pointer-events: none !important;
138
+ }
@@ -1,4 +0,0 @@
1
- import { type A2UIProviderProps } from '@a2ui-sdk/react/0.8';
2
- export type GlchatA2UIProviderProps = A2UIProviderProps;
3
- export declare function GlchatA2UIProvider(props: Readonly<GlchatA2UIProviderProps>): import("react/jsx-runtime").JSX.Element;
4
- //# sourceMappingURL=GlchatA2UIProvider.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GlchatA2UIProvider.d.ts","sourceRoot":"","sources":["../../../src/a2ui/GlchatA2UIProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG3E,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;AAExD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,uBAAuB,CAAC,2CAI1E"}
@@ -1,8 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { A2UIProvider } from '@a2ui-sdk/react/0.8';
4
- import { glchatStandardCatalog } from './glchatStandardCatalog.js';
5
- export function GlchatA2UIProvider(props) {
6
- const catalog = props.catalog ?? glchatStandardCatalog;
7
- return _jsx(A2UIProvider, { ...props, catalog: catalog });
8
- }
@@ -1,4 +0,0 @@
1
- import { type A2UIRendererProps } from '@a2ui-sdk/react/0.8';
2
- export type GlchatA2UIRendererProps = A2UIRendererProps;
3
- export declare function GlchatA2UIRenderer(props: Readonly<GlchatA2UIRendererProps>): import("react/jsx-runtime").JSX.Element;
4
- //# sourceMappingURL=GlchatA2UIRenderer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GlchatA2UIRenderer.d.ts","sourceRoot":"","sources":["../../../src/a2ui/GlchatA2UIRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE3E,MAAM,MAAM,uBAAuB,GAAG,iBAAiB,CAAC;AAExD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,uBAAuB,CAAC,2CAE1E"}
@@ -1,6 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { A2UIRenderer } from '@a2ui-sdk/react/0.8';
4
- export function GlchatA2UIRenderer(props) {
5
- return _jsx(A2UIRenderer, { ...props });
6
- }
@@ -1,3 +0,0 @@
1
- export { ComponentRenderer, standardCatalog, useDispatchAction, useDataBinding, useFormBinding, useSurfaceContext, useDataModelContext, useA2UIMessageHandler, ActionProvider, useActionContext, type A2UIMessage, type A2UIAction, type Action, type ValueSource, type A2UIProviderProps, type A2UIRendererProps, type A2UIMessageHandler, type CatalogComponent, } from '@a2ui-sdk/react/0.8';
2
- export * from '@a2ui-sdk/types/0.8/standard-catalog';
3
- //# sourceMappingURL=adapter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/a2ui/adapter.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,iBAAiB,EACjB,eAAe,EAEf,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EAErB,cAAc,EACd,gBAAgB,EAEhB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,GACtB,MAAM,qBAAqB,CAAC;AAG7B,cAAc,sCAAsC,CAAC"}
@@ -1,12 +0,0 @@
1
- /*
2
- * Central adapter for the wrapper package.
3
- */
4
- export {
5
- // Core components
6
- ComponentRenderer, standardCatalog,
7
- // Hooks
8
- useDispatchAction, useDataBinding, useFormBinding, useSurfaceContext, useDataModelContext, useA2UIMessageHandler,
9
- // Context providers
10
- ActionProvider, useActionContext, } from '@a2ui-sdk/react/0.8';
11
- // Re-exports standard catalog types
12
- export * from '@a2ui-sdk/types/0.8/standard-catalog';
@@ -1,10 +0,0 @@
1
- /** GLChat standard catalog: upstream standard catalog + custom Button, Card, Timeout. */
2
- export declare const glchatStandardCatalog: {
3
- components: {
4
- Button: import("@a2ui-sdk/react/0.8").CatalogComponent;
5
- Card: import("@a2ui-sdk/react/0.8").CatalogComponent;
6
- Timeout: import("@a2ui-sdk/react/0.8").CatalogComponent;
7
- };
8
- functions?: import("@a2ui-sdk/react/0.8").CatalogFunctions;
9
- };
10
- //# sourceMappingURL=glchatStandardCatalog.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"glchatStandardCatalog.d.ts","sourceRoot":"","sources":["../../../src/a2ui/glchatStandardCatalog.ts"],"names":[],"mappings":"AAKA,yFAAyF;AACzF,eAAO,MAAM,qBAAqB;;;;;;;CAQjC,CAAC"}
@@ -1,14 +0,0 @@
1
- import { standardCatalog } from '@a2ui-sdk/react/0.8';
2
- import { CustomButtonComponent } from '../components/custom/Button.js';
3
- import { CustomCardComponent } from '../components/custom/Card.js';
4
- import { CustomTimeoutComponent } from '../components/custom/Timeout.js';
5
- /** GLChat standard catalog: upstream standard catalog + custom Button, Card, Timeout. */
6
- export const glchatStandardCatalog = {
7
- ...standardCatalog,
8
- components: {
9
- ...standardCatalog.components,
10
- Button: CustomButtonComponent,
11
- Card: CustomCardComponent,
12
- Timeout: CustomTimeoutComponent,
13
- },
14
- };
@@ -1,3 +0,0 @@
1
- import { type CatalogComponent } from '@a2ui-sdk/react/0.8';
2
- export declare const CustomButtonComponent: CatalogComponent;
3
- //# sourceMappingURL=Button.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/custom/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,qBAAqB,CAAA;AAQ5B,eAAO,MAAM,qBAAqB,EAAE,gBAoBnC,CAAA"}
@@ -1,14 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useDispatchAction, ComponentRenderer, } from '@a2ui-sdk/react/0.8';
3
- import { Button } from '../ui/Button';
4
- export const CustomButtonComponent = ({ surfaceId, componentId, ...props }) => {
5
- const { child, action, primary, destructive } = props;
6
- const dispatchAction = useDispatchAction();
7
- const handleClick = () => {
8
- if (action) {
9
- dispatchAction(surfaceId, componentId, action);
10
- }
11
- };
12
- const variant = destructive ? 'destructive' : primary ? 'primary' : 'outline';
13
- return (_jsx(Button, { onClick: handleClick, variant: variant, children: child && _jsx(ComponentRenderer, { surfaceId: surfaceId, componentId: child }) }));
14
- };
@@ -1,3 +0,0 @@
1
- import { type CatalogComponent } from '@a2ui-sdk/react/0.8';
2
- export declare const CustomCardComponent: CatalogComponent;
3
- //# sourceMappingURL=Card.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../src/components/custom/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAqB,MAAM,qBAAqB,CAAA;AAI9E,eAAO,MAAM,mBAAmB,EAAE,gBAWjC,CAAA"}
@@ -1,7 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { ComponentRenderer } from '@a2ui-sdk/react/0.8';
3
- import { Card } from '../ui/Card';
4
- export const CustomCardComponent = ({ surfaceId, componentId, ...props }) => {
5
- const { child } = props;
6
- return (_jsx(Card, { children: child && _jsx(ComponentRenderer, { surfaceId: surfaceId, componentId: child }) }));
7
- };
@@ -1,3 +0,0 @@
1
- import { type CatalogComponent } from "@a2ui-sdk/react/0.8";
2
- export declare const CustomTimeoutComponent: CatalogComponent;
3
- //# sourceMappingURL=Timeout.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Timeout.d.ts","sourceRoot":"","sources":["../../../../src/components/custom/Timeout.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAO3D,eAAO,MAAM,sBAAsB,EAAE,gBAOpC,CAAA"}
@@ -1,6 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Timeout } from "../ui/Timeout";
3
- export const CustomTimeoutComponent = ({ surfaceId, componentId, ...props }) => {
4
- const { targetTimeUtc } = props;
5
- return _jsx(Timeout, { targetTimeUtc: targetTimeUtc });
6
- };
@@ -1,12 +0,0 @@
1
- import { VariantProps } from 'class-variance-authority';
2
- declare const buttonVariants: (props?: ({
3
- variant?: "primary" | "secondary" | "destructive" | "destructive-subtle" | "outline" | "ghost-primary" | "ghost-neutral" | "ghost-destructive" | "link-primary" | "link-neutral" | null | undefined;
4
- size?: "tiny" | "small" | "medium" | "large" | "icon" | null | undefined;
5
- shape?: "normal" | "pill" | null | undefined;
6
- } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
- export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
8
- asChild?: boolean;
9
- }
10
- declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
11
- export { Button, buttonVariants };
12
- //# sourceMappingURL=Button.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/Button.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAO,MAAM,0BAA0B,CAAC;AAE7D,QAAA,MAAM,cAAc;;;;8EAiFnB,CAAC;AAEF,MAAM,WAAW,WACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,cAAc,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,QAAA,MAAM,MAAM,2GAsBX,CAAC;AAIF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC"}
@@ -1,38 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Slot } from '@radix-ui/react-slot';
3
- import { forwardRef } from 'react';
4
- import { cn } from '../../helpers/css.js';
5
- import { cva } from 'class-variance-authority';
6
- const buttonVariants = cva(cn('group inline-flex font-semibold border items-center justify-center whitespace-nowrap ring-offset-background transition-colors cursor-pointer', 'disabled:pointer-events-none disabled:opacity-secondary'), {
7
- variants: {
8
- variant: {
9
- primary: cn('border-primary bg-primary text-primary-foreground', 'hover:border-primary-hover hover:bg-primary-hover', 'focus:bg-primary-hover focus:outline-none focus:ring-2 focus:ring-ring', 'focus-visible:bg-primary-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring', 'active:bg-primary-hover active:outline-none active:ring-2 active:ring-ring'),
10
- secondary: cn('border-primary-subtle bg-primary-subtle text-primary-subtle-foreground', 'hover:border-primary-subtle-hover hover:bg-primary-subtle-hover ', 'focus:border-primary-subtle-hover focus:bg-primary-subtle-hover focus:outline-none focus:ring-2 focus:ring-ring', 'focus-visible:border-primary-subtle-hover focus-visible:bg-primary-subtle-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring', 'active:border-primary-subtle-hover active:bg-primary-subtle-hover active:outline-none active:ring-2 active:ring-ring'),
11
- destructive: cn('border-destructive bg-destructive text-destructive-foreground', 'hover:border-destructive-hover hover:bg-destructive-hover', 'focus:bg-destructive-hover focus:border-destructive-hover focus:outline-none focus:ring-2 focus:ring-ring', 'focus-visible:bg-destructive-hover focus-visible:border-destructive-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring', 'active:bg-destructive-hover active:border-destructive-hover active:outline-none active:ring-2 active:ring-ring'),
12
- 'destructive-subtle': cn('border-destructive-alternate bg-destructive-alternate text-destructive', 'hover:border-destructive-alternate-hover hover:bg-destructive-alternate-hover', 'focus:bg-destructive-alternate-hover focus:border-destructive-alternate-hover focus:outline-none focus:ring-2 focus:ring-ring', 'focus-visible:bg-destructive-alternate-hover focus-visible:border-destructive-alternate-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring', 'active:bg-destructive-alternate-hover active:border-destructive-alternate-hover active:outline-none active:ring-2 active:ring-ring'),
13
- outline: cn('bg-background text-foreground border-border', 'hover:bg-background-hover', 'focus:bg-background-hover', 'focus-visible:bg-background-hover', 'active:bg-background-hover'),
14
- 'ghost-primary': cn('group-hover:underline group-hover:decoration-primary group-active:underline group-active:decoration-primary', 'text-primary border-transparent', 'hover:bg-primary-hover hover:border-primary-hover', 'focus:bg-primary-hover focus:border-primary-hover', 'focus-visible:bg-primary-hover focus-visible:border-primary-hover', 'active:bg-primary-hover active:border-primary-hover'),
15
- 'ghost-neutral': cn('border-transparent text-foreground', 'hover:bg-background-hover hover:border-background-hover', 'focus:bg-background-hover focus:border-background-hover', 'focus-visible:bg-background-hover focus-visible:border-background-hover', 'active:bg-background-hover active:border-background-hover'),
16
- 'ghost-destructive': cn('border-transparent text-destructive', 'hover:bg-destructive-alternate hover:border-destructive-alternate', 'focus:bg-destructive-alternate focus:border-destructive-alternate', 'focus-visible:bg-destructive-alternate focus-visible:border-destructive-alternate', 'active:bg-destructive-alternate active:border-destructive-alternate'),
17
- 'link-primary': cn('border-transparent text-primary'),
18
- 'link-neutral': cn('border-transparent text-foreground'),
19
- },
20
- size: {
21
- tiny: 'text-sm px-[12px] py-[6px] rounded-[6px]',
22
- small: 'text-base px-[16px] py-[8px] rounded-[8px]',
23
- medium: 'text-base px-[16px] py-[10px] rounded-[10px]',
24
- large: 'text-lg px-[20px] py-[10px] rounded-[12px]',
25
- icon: 'h-10 w-10 rounded-[8px]',
26
- },
27
- shape: {
28
- normal: '',
29
- pill: 'rounded-full',
30
- },
31
- },
32
- });
33
- const Button = forwardRef(({ className, variant = 'primary', size = 'medium', shape = 'normal', asChild = false, ...props }, ref) => {
34
- const Comp = asChild ? Slot : 'button';
35
- return (_jsx(Comp, { className: cn(buttonVariants({ variant, size, shape }), className), ref: ref, ...props }));
36
- });
37
- Button.displayName = 'Button';
38
- export { Button, buttonVariants };
@@ -1,9 +0,0 @@
1
- import * as React from 'react';
2
- declare const Card: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
3
- declare const CardHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
4
- declare const CardTitle: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLHeadingElement> & React.RefAttributes<HTMLHeadingElement>>;
5
- declare const CardDescription: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLParagraphElement> & React.RefAttributes<HTMLParagraphElement>>;
6
- declare const CardContent: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
7
- declare const CardFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
8
- export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, };
9
- //# sourceMappingURL=Card.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/Card.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,IAAI,6GAYR,CAAC;AAGH,QAAA,MAAM,UAAU,6GASd,CAAC;AAGH,QAAA,MAAM,SAAS,qHAWb,CAAC;AAGH,QAAA,MAAM,eAAe,yHAKnB,CAAC;AAGH,QAAA,MAAM,WAAW,6GAKf,CAAC;AAGH,QAAA,MAAM,UAAU,6GASd,CAAC;AAGH,OAAO,EACL,IAAI,EACJ,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,SAAS,GACV,CAAC"}
@@ -1,16 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import * as React from 'react';
3
- import { cn } from '../../helpers/css.js';
4
- const Card = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('rounded-lg border border-border p-4 bg-card text-card-foreground shadow-sm transition-colors duration-300', className), ...props })));
5
- Card.displayName = 'Card';
6
- const CardHeader = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('flex flex-col space-y-1.5 p-6', className), ...props })));
7
- CardHeader.displayName = 'CardHeader';
8
- const CardTitle = React.forwardRef(({ className, children, ...props }, ref) => (_jsx("h3", { ref: ref, className: cn('font-semibold leading-none tracking-tight', className), ...props, children: children })));
9
- CardTitle.displayName = 'CardTitle';
10
- const CardDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx("p", { ref: ref, className: cn('text-sm', className), ...props })));
11
- CardDescription.displayName = 'CardDescription';
12
- const CardContent = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('p-6 pt-0', className), ...props })));
13
- CardContent.displayName = 'CardContent';
14
- const CardFooter = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn('flex items-center p-6 pt-0', className), ...props })));
15
- CardFooter.displayName = 'CardFooter';
16
- export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, };
@@ -1,6 +0,0 @@
1
- export interface TimeoutProps {
2
- targetTimeUtc: string;
3
- className?: string;
4
- }
5
- export declare function Timeout({ targetTimeUtc, className, }: Readonly<TimeoutProps>): import("react/jsx-runtime").JSX.Element;
6
- //# sourceMappingURL=Timeout.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Timeout.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/Timeout.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,YAAY;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAiBD,wBAAgB,OAAO,CAAC,EACtB,aAAa,EACb,SAAS,GACV,EAAE,QAAQ,CAAC,YAAY,CAAC,2CAyBxB"}
@@ -1,35 +0,0 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- import { useEffect, useState } from 'react';
4
- import { cn } from '../../helpers/css.js';
5
- function getRemainingSeconds(targetTimeUtc) {
6
- const targetMs = Date.parse(targetTimeUtc);
7
- if (Number.isNaN(targetMs))
8
- return 0;
9
- return Math.max(0, Math.floor((targetMs - Date.now()) / 1000));
10
- }
11
- function formatAsHhMmSs(seconds) {
12
- const s = Math.max(0, Math.floor(seconds));
13
- const m = Math.floor(s / 60);
14
- const h = Math.floor(m / 60);
15
- const mm = m % 60;
16
- const ss = s % 60;
17
- return `${String(h).padStart(2, '0')}:${String(mm).padStart(2, '0')}:${String(ss).padStart(2, '0')}`;
18
- }
19
- export function Timeout({ targetTimeUtc, className, }) {
20
- const [remaining, setRemaining] = useState(() => getRemainingSeconds(targetTimeUtc));
21
- useEffect(() => {
22
- setRemaining(getRemainingSeconds(targetTimeUtc));
23
- }, [targetTimeUtc]);
24
- useEffect(() => {
25
- const t = setInterval(() => {
26
- const next = getRemainingSeconds(targetTimeUtc);
27
- setRemaining(next);
28
- if (next <= 0)
29
- clearInterval(t);
30
- }, 1000);
31
- return () => clearInterval(t);
32
- }, [targetTimeUtc]);
33
- const display = formatAsHhMmSs(remaining);
34
- return (_jsx("div", { className: cn('text-foreground/50 text-sm', className), children: display }));
35
- }
@@ -1,6 +0,0 @@
1
- import { ClassValue } from 'clsx';
2
- /**
3
- * Conditionally joins class names.
4
- */
5
- export declare function cn(...inputs: ClassValue[]): string;
6
- //# sourceMappingURL=css.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../../src/helpers/css.ts"],"names":[],"mappings":"AAAA,OAAa,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAExC;;GAEG;AACH,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAElD"}
@@ -1,7 +0,0 @@
1
- import clsx from 'clsx';
2
- /**
3
- * Conditionally joins class names.
4
- */
5
- export function cn(...inputs) {
6
- return clsx(inputs);
7
- }