glchat-a2ui-react-renderer 0.2.7 → 0.3.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.
- package/README.md +223 -178
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -5
- package/dist/src/Provider.d.ts +21 -14
- package/dist/src/Provider.d.ts.map +1 -1
- package/dist/src/Provider.js +56 -42
- package/dist/src/SurfaceRenderer.d.ts +17 -0
- package/dist/src/SurfaceRenderer.d.ts.map +1 -0
- package/dist/src/SurfaceRenderer.js +28 -0
- package/dist/src/components/a2ui/Button/Button.d.ts +313 -3
- package/dist/src/components/a2ui/Button/Button.d.ts.map +1 -1
- package/dist/src/components/a2ui/Button/Button.js +29 -14
- package/dist/src/components/a2ui/{MultipleChoice → ChoicePicker}/CheckboxList.d.ts +1 -2
- package/dist/src/components/a2ui/ChoicePicker/CheckboxList.d.ts.map +1 -0
- package/dist/src/components/a2ui/{MultipleChoice → ChoicePicker}/CheckboxList.js +2 -13
- package/dist/src/components/a2ui/ChoicePicker/ChoicePicker.d.ts +9 -0
- package/dist/src/components/a2ui/ChoicePicker/ChoicePicker.d.ts.map +1 -0
- package/dist/src/components/a2ui/ChoicePicker/ChoicePicker.js +54 -0
- package/dist/src/components/a2ui/ChoicePicker/theme.d.ts +10 -0
- package/dist/src/components/a2ui/ChoicePicker/theme.d.ts.map +1 -0
- package/dist/src/components/a2ui/{MultipleChoice → ChoicePicker}/theme.js +12 -9
- package/dist/src/components/a2ui/TagInput/TagInput.d.ts +289 -3
- package/dist/src/components/a2ui/TagInput/TagInput.d.ts.map +1 -1
- package/dist/src/components/a2ui/TagInput/TagInput.js +44 -54
- package/dist/src/components/a2ui/TagInput/theme.d.ts +0 -9
- package/dist/src/components/a2ui/TagInput/theme.d.ts.map +1 -1
- package/dist/src/components/a2ui/TagInput/theme.js +1 -9
- package/dist/src/components/a2ui/Timeout/Timeout.d.ts +154 -3
- package/dist/src/components/a2ui/Timeout/Timeout.d.ts.map +1 -1
- package/dist/src/components/a2ui/Timeout/Timeout.js +40 -25
- package/dist/src/components/a2ui/common.d.ts +87 -0
- package/dist/src/components/a2ui/common.d.ts.map +1 -0
- package/dist/src/components/a2ui/common.js +23 -0
- package/dist/src/components/ui/Button/theme.d.ts +1 -1
- package/dist/src/components/ui/Button/theme.d.ts.map +1 -1
- package/dist/src/components/ui/Button/theme.js +11 -0
- package/dist/src/components/ui/MultiSelect/MultiSelect.d.ts +1 -1
- package/dist/src/components/ui/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/src/components/ui/Select/theme.d.ts.map +1 -1
- package/dist/src/components/ui/Select/theme.js +0 -1
- package/dist/src/utils/catalog.d.ts +16 -4
- package/dist/src/utils/catalog.d.ts.map +1 -1
- package/dist/src/utils/catalog.js +32 -23
- package/dist/src/utils/useSurfaces.d.ts +9 -0
- package/dist/src/utils/useSurfaces.d.ts.map +1 -0
- package/dist/src/utils/useSurfaces.js +28 -0
- package/json/README.md +36 -49
- package/json/a2ui-sample-messages.json +170 -315
- package/json/glchat_standard_catalog_definition.json +1236 -610
- package/package.json +11 -5
- package/styles/globals.css +196 -120
- package/dist/src/AllSurfacesRenderer.d.ts +0 -14
- package/dist/src/AllSurfacesRenderer.d.ts.map +0 -1
- package/dist/src/AllSurfacesRenderer.js +0 -18
- package/dist/src/SingleSurfaceRenderer.d.ts +0 -15
- package/dist/src/SingleSurfaceRenderer.d.ts.map +0 -1
- package/dist/src/SingleSurfaceRenderer.js +0 -9
- package/dist/src/components/a2ui/Button/theme.d.ts +0 -5
- package/dist/src/components/a2ui/Button/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/Button/theme.js +0 -5
- package/dist/src/components/a2ui/ButtonAsLink/ButtonAsLink.d.ts +0 -4
- package/dist/src/components/a2ui/ButtonAsLink/ButtonAsLink.d.ts.map +0 -1
- package/dist/src/components/a2ui/ButtonAsLink/ButtonAsLink.js +0 -42
- package/dist/src/components/a2ui/ButtonAsLink/theme.d.ts +0 -8
- package/dist/src/components/a2ui/ButtonAsLink/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/ButtonAsLink/theme.js +0 -8
- package/dist/src/components/a2ui/Card/theme.d.ts +0 -4
- package/dist/src/components/a2ui/Card/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/Card/theme.js +0 -15
- package/dist/src/components/a2ui/CheckBox/theme.d.ts +0 -4
- package/dist/src/components/a2ui/CheckBox/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/CheckBox/theme.js +0 -11
- package/dist/src/components/a2ui/DateTimeInput/theme.d.ts +0 -8
- package/dist/src/components/a2ui/DateTimeInput/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/DateTimeInput/theme.js +0 -11
- package/dist/src/components/a2ui/DestructiveButton/DestructiveButton.d.ts +0 -4
- package/dist/src/components/a2ui/DestructiveButton/DestructiveButton.d.ts.map +0 -1
- package/dist/src/components/a2ui/DestructiveButton/DestructiveButton.js +0 -22
- package/dist/src/components/a2ui/DestructiveButton/theme.d.ts +0 -8
- package/dist/src/components/a2ui/DestructiveButton/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/DestructiveButton/theme.js +0 -8
- package/dist/src/components/a2ui/MultipleChoice/CheckboxList.d.ts.map +0 -1
- package/dist/src/components/a2ui/MultipleChoice/MultipleChoice.d.ts +0 -4
- package/dist/src/components/a2ui/MultipleChoice/MultipleChoice.d.ts.map +0 -1
- package/dist/src/components/a2ui/MultipleChoice/MultipleChoice.js +0 -72
- package/dist/src/components/a2ui/MultipleChoice/theme.d.ts +0 -13
- package/dist/src/components/a2ui/MultipleChoice/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/TextField/theme.d.ts +0 -4
- package/dist/src/components/a2ui/TextField/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/TextField/theme.js +0 -9
- package/dist/src/components/a2ui/Timeout/theme.d.ts +0 -8
- package/dist/src/components/a2ui/Timeout/theme.d.ts.map +0 -1
- package/dist/src/components/a2ui/Timeout/theme.js +0 -12
- package/dist/src/components/a2ui/types.d.ts +0 -12
- package/dist/src/components/a2ui/types.d.ts.map +0 -1
- package/dist/src/components/a2ui/types.js +0 -1
- package/dist/src/components/ui/Button/ButtonAsLink.d.ts +0 -15
- package/dist/src/components/ui/Button/ButtonAsLink.d.ts.map +0 -1
- package/dist/src/components/ui/Button/ButtonAsLink.js +0 -17
- package/dist/src/components/ui/TextField/theme.d.ts +0 -4
- package/dist/src/components/ui/TextField/theme.d.ts.map +0 -1
- package/dist/src/components/ui/TextField/theme.js +0 -22
- package/dist/src/utils/href.d.ts +0 -11
- package/dist/src/utils/href.d.ts.map +0 -1
- package/dist/src/utils/href.js +0 -34
- package/dist/src/utils/theme.d.ts +0 -15
- package/dist/src/utils/theme.d.ts.map +0 -1
- package/dist/src/utils/theme.js +0 -93
- package/json/glchat_server_to_client_with_catalog.json +0 -1000
|
@@ -1,4 +1,155 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Countdown to a target UTC time (GLChat extension). Displays the remaining
|
|
4
|
+
* time as HH:MM:SS, updating every second.
|
|
5
|
+
*/
|
|
6
|
+
export declare const TimeoutApi: {
|
|
7
|
+
name: string;
|
|
8
|
+
schema: z.ZodObject<{
|
|
9
|
+
targetTimeUtc: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
10
|
+
path: z.ZodString;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
path: string;
|
|
13
|
+
}, {
|
|
14
|
+
path: string;
|
|
15
|
+
}>, z.ZodObject<{
|
|
16
|
+
call: z.ZodString;
|
|
17
|
+
args: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
18
|
+
returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
call: string;
|
|
21
|
+
args: Record<string, any>;
|
|
22
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
23
|
+
}, {
|
|
24
|
+
call: string;
|
|
25
|
+
args: Record<string, any>;
|
|
26
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
27
|
+
}>]>;
|
|
28
|
+
variant: z.ZodOptional<z.ZodEnum<["body", "caption", "h3", "h4", "h5"]>>;
|
|
29
|
+
accessibility: z.ZodOptional<z.ZodObject<{
|
|
30
|
+
label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
31
|
+
path: z.ZodString;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
path: string;
|
|
34
|
+
}, {
|
|
35
|
+
path: string;
|
|
36
|
+
}>, z.ZodObject<{
|
|
37
|
+
call: z.ZodString;
|
|
38
|
+
args: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
39
|
+
returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
call: string;
|
|
42
|
+
args: Record<string, any>;
|
|
43
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
44
|
+
}, {
|
|
45
|
+
call: string;
|
|
46
|
+
args: Record<string, any>;
|
|
47
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
48
|
+
}>]>>;
|
|
49
|
+
description: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
50
|
+
path: z.ZodString;
|
|
51
|
+
}, "strip", z.ZodTypeAny, {
|
|
52
|
+
path: string;
|
|
53
|
+
}, {
|
|
54
|
+
path: string;
|
|
55
|
+
}>, z.ZodObject<{
|
|
56
|
+
call: z.ZodString;
|
|
57
|
+
args: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
58
|
+
returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
|
|
59
|
+
}, "strip", z.ZodTypeAny, {
|
|
60
|
+
call: string;
|
|
61
|
+
args: Record<string, any>;
|
|
62
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
63
|
+
}, {
|
|
64
|
+
call: string;
|
|
65
|
+
args: Record<string, any>;
|
|
66
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
67
|
+
}>]>>;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
description?: string | {
|
|
70
|
+
path: string;
|
|
71
|
+
} | {
|
|
72
|
+
call: string;
|
|
73
|
+
args: Record<string, any>;
|
|
74
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
75
|
+
} | undefined;
|
|
76
|
+
label?: string | {
|
|
77
|
+
path: string;
|
|
78
|
+
} | {
|
|
79
|
+
call: string;
|
|
80
|
+
args: Record<string, any>;
|
|
81
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
82
|
+
} | undefined;
|
|
83
|
+
}, {
|
|
84
|
+
description?: string | {
|
|
85
|
+
path: string;
|
|
86
|
+
} | {
|
|
87
|
+
call: string;
|
|
88
|
+
args: Record<string, any>;
|
|
89
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
90
|
+
} | undefined;
|
|
91
|
+
label?: string | {
|
|
92
|
+
path: string;
|
|
93
|
+
} | {
|
|
94
|
+
call: string;
|
|
95
|
+
args: Record<string, any>;
|
|
96
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
97
|
+
} | undefined;
|
|
98
|
+
}>>;
|
|
99
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
100
|
+
}, "strict", z.ZodTypeAny, {
|
|
101
|
+
targetTimeUtc: string | {
|
|
102
|
+
path: string;
|
|
103
|
+
} | {
|
|
104
|
+
call: string;
|
|
105
|
+
args: Record<string, any>;
|
|
106
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
107
|
+
};
|
|
108
|
+
weight?: number | undefined;
|
|
109
|
+
variant?: "caption" | "h3" | "body" | "h4" | "h5" | undefined;
|
|
110
|
+
accessibility?: {
|
|
111
|
+
description?: string | {
|
|
112
|
+
path: string;
|
|
113
|
+
} | {
|
|
114
|
+
call: string;
|
|
115
|
+
args: Record<string, any>;
|
|
116
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
117
|
+
} | undefined;
|
|
118
|
+
label?: string | {
|
|
119
|
+
path: string;
|
|
120
|
+
} | {
|
|
121
|
+
call: string;
|
|
122
|
+
args: Record<string, any>;
|
|
123
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
124
|
+
} | undefined;
|
|
125
|
+
} | undefined;
|
|
126
|
+
}, {
|
|
127
|
+
targetTimeUtc: string | {
|
|
128
|
+
path: string;
|
|
129
|
+
} | {
|
|
130
|
+
call: string;
|
|
131
|
+
args: Record<string, any>;
|
|
132
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
133
|
+
};
|
|
134
|
+
weight?: number | undefined;
|
|
135
|
+
variant?: "caption" | "h3" | "body" | "h4" | "h5" | undefined;
|
|
136
|
+
accessibility?: {
|
|
137
|
+
description?: string | {
|
|
138
|
+
path: string;
|
|
139
|
+
} | {
|
|
140
|
+
call: string;
|
|
141
|
+
args: Record<string, any>;
|
|
142
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
143
|
+
} | undefined;
|
|
144
|
+
label?: string | {
|
|
145
|
+
path: string;
|
|
146
|
+
} | {
|
|
147
|
+
call: string;
|
|
148
|
+
args: Record<string, any>;
|
|
149
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
150
|
+
} | undefined;
|
|
151
|
+
} | undefined;
|
|
152
|
+
}>;
|
|
153
|
+
};
|
|
154
|
+
export declare const GlchatTimeoutComponent: import("@a2ui/react/v0_9").ReactComponentImplementation;
|
|
4
155
|
//# sourceMappingURL=Timeout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Timeout.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/Timeout/Timeout.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Timeout.d.ts","sourceRoot":"","sources":["../../../../../src/components/a2ui/Timeout/Timeout.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;GAGG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAgDy1X,CAAC;;;;;;;;;;;;;;;;;;;0BAAivB,CAAC;;;;;;;;;;;;;;;;;;;;;;;0BAA2sB,CAAC;;;;;;;0BAA0O,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAA5O,CAAC;;;;;;;0BAA0O,CAAC;;;;CA/Bzhb,CAAC;AAQF,eAAO,MAAM,sBAAsB,yDAsBjC,CAAC"}
|
|
@@ -1,30 +1,45 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { createComponentImplementation } from '@a2ui/react/v0_9';
|
|
4
|
+
import { DynamicStringSchema } from '@a2ui/web_core/v0_9';
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
|
+
import { z } from 'zod';
|
|
5
7
|
import { formatAsHhMmSs, getRemainingSeconds } from '../../../utils/time.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
8
|
+
import { CommonProps, describeDynamic, getWeightStyle } from '../common.js';
|
|
9
|
+
/**
|
|
10
|
+
* Countdown to a target UTC time (GLChat extension). Displays the remaining
|
|
11
|
+
* time as HH:MM:SS, updating every second.
|
|
12
|
+
*/
|
|
13
|
+
export const TimeoutApi = {
|
|
14
|
+
name: 'Timeout',
|
|
15
|
+
schema: z
|
|
16
|
+
.object({
|
|
17
|
+
...CommonProps,
|
|
18
|
+
targetTimeUtc: describeDynamic(DynamicStringSchema, 'DynamicString', 'The target time as a UTC ISO 8601 string to count down to.'),
|
|
19
|
+
variant: z
|
|
20
|
+
.enum(['body', 'caption', 'h3', 'h4', 'h5'])
|
|
21
|
+
.describe('A hint for the base text style.')
|
|
22
|
+
.optional(),
|
|
23
|
+
})
|
|
24
|
+
.strict()
|
|
25
|
+
.describe('A countdown timer to a target UTC time.'),
|
|
26
|
+
};
|
|
27
|
+
const textStyle = {
|
|
28
|
+
color: `hsl(var(--foreground) / 0.5)`,
|
|
29
|
+
fontSize: '0.875rem',
|
|
30
|
+
lineHeight: '1.25rem',
|
|
31
|
+
};
|
|
32
|
+
export const GlchatTimeoutComponent = createComponentImplementation(TimeoutApi, ({ props }) => {
|
|
33
|
+
const targetTimeUtc = typeof props.targetTimeUtc === 'string' ? props.targetTimeUtc : '';
|
|
34
|
+
const [remaining, setRemaining] = useState(() => getRemainingSeconds(targetTimeUtc));
|
|
16
35
|
useEffect(() => {
|
|
17
|
-
setRemaining(getRemainingSeconds(
|
|
18
|
-
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
if (!resolvedTargetTimeUtcString)
|
|
36
|
+
setRemaining(getRemainingSeconds(targetTimeUtc));
|
|
37
|
+
if (!targetTimeUtc)
|
|
21
38
|
return;
|
|
22
|
-
const
|
|
23
|
-
setRemaining(getRemainingSeconds(
|
|
39
|
+
const timer = setInterval(() => {
|
|
40
|
+
setRemaining(getRemainingSeconds(targetTimeUtc));
|
|
24
41
|
}, 1000);
|
|
25
|
-
return () => clearInterval(
|
|
26
|
-
}, [
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
}
|
|
42
|
+
return () => clearInterval(timer);
|
|
43
|
+
}, [targetTimeUtc]);
|
|
44
|
+
return (_jsx("div", { className: "a2ui-text a2ui-timeout", style: getWeightStyle(props.weight), children: _jsx("p", { style: textStyle, children: formatAsHhMmSs(remaining) }) }));
|
|
45
|
+
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import { z, type ZodTypeAny } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* Catalog-level common properties shared by every component, mirroring the
|
|
5
|
+
* `CommonProps` used by the A2UI v0.9 basic catalog (`accessibility`, `weight`).
|
|
6
|
+
*/
|
|
7
|
+
export declare const CommonProps: {
|
|
8
|
+
accessibility: z.ZodOptional<z.ZodObject<{
|
|
9
|
+
label: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
10
|
+
path: z.ZodString;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
path: string;
|
|
13
|
+
}, {
|
|
14
|
+
path: string;
|
|
15
|
+
}>, z.ZodObject<{
|
|
16
|
+
call: z.ZodString;
|
|
17
|
+
args: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
18
|
+
returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
call: string;
|
|
21
|
+
args: Record<string, any>;
|
|
22
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
23
|
+
}, {
|
|
24
|
+
call: string;
|
|
25
|
+
args: Record<string, any>;
|
|
26
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
27
|
+
}>]>>;
|
|
28
|
+
description: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
29
|
+
path: z.ZodString;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
path: string;
|
|
32
|
+
}, {
|
|
33
|
+
path: string;
|
|
34
|
+
}>, z.ZodObject<{
|
|
35
|
+
call: z.ZodString;
|
|
36
|
+
args: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
37
|
+
returnType: z.ZodDefault<z.ZodEnum<["string", "number", "boolean", "array", "object", "any", "void"]>>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
call: string;
|
|
40
|
+
args: Record<string, any>;
|
|
41
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
42
|
+
}, {
|
|
43
|
+
call: string;
|
|
44
|
+
args: Record<string, any>;
|
|
45
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
46
|
+
}>]>>;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
description?: string | {
|
|
49
|
+
path: string;
|
|
50
|
+
} | {
|
|
51
|
+
call: string;
|
|
52
|
+
args: Record<string, any>;
|
|
53
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
54
|
+
} | undefined;
|
|
55
|
+
label?: string | {
|
|
56
|
+
path: string;
|
|
57
|
+
} | {
|
|
58
|
+
call: string;
|
|
59
|
+
args: Record<string, any>;
|
|
60
|
+
returnType: "string" | "number" | "boolean" | "object" | "array" | "void" | "any";
|
|
61
|
+
} | undefined;
|
|
62
|
+
}, {
|
|
63
|
+
description?: string | {
|
|
64
|
+
path: string;
|
|
65
|
+
} | {
|
|
66
|
+
call: string;
|
|
67
|
+
args: Record<string, any>;
|
|
68
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
69
|
+
} | undefined;
|
|
70
|
+
label?: string | {
|
|
71
|
+
path: string;
|
|
72
|
+
} | {
|
|
73
|
+
call: string;
|
|
74
|
+
args: Record<string, any>;
|
|
75
|
+
returnType?: "string" | "number" | "boolean" | "object" | "array" | "void" | "any" | undefined;
|
|
76
|
+
} | undefined;
|
|
77
|
+
}>>;
|
|
78
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Maps the A2UI `weight` property to a flex style, matching the basic catalog.
|
|
82
|
+
* Only meaningful when the component is a direct child of a Row/Column.
|
|
83
|
+
*/
|
|
84
|
+
export declare function getWeightStyle(weight: number | undefined): CSSProperties | undefined;
|
|
85
|
+
/** Preserves A2UI `REF:` tags when adding a field description for catalog JSON generation. */
|
|
86
|
+
export declare function describeDynamic<T extends ZodTypeAny>(schema: T, def: string, description: string): T;
|
|
87
|
+
//# sourceMappingURL=common.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/components/a2ui/common.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,CAAC,EAAE,KAAK,UAAU,EAAE,MAAM,KAAK,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;sBAsBylZ,CAAC;;;;;;;;;;;;;;;;;;;sBAAivB,CAAC;;;;;;;;;;;;;;;;;;;;;;;sBAA2sB,CAAC;;;;;;;sBAA0O,CAAC;;;;CAnB1xc,CAAC;AAEF;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAGpF;AAED,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,CAAC,SAAS,UAAU,EAClD,MAAM,EAAE,CAAC,EACT,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,GAClB,CAAC,CAEH"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { AccessibilityAttributesSchema } from '@a2ui/web_core/v0_9';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* Catalog-level common properties shared by every component, mirroring the
|
|
5
|
+
* `CommonProps` used by the A2UI v0.9 basic catalog (`accessibility`, `weight`).
|
|
6
|
+
*/
|
|
7
|
+
export const CommonProps = {
|
|
8
|
+
accessibility: AccessibilityAttributesSchema.optional(),
|
|
9
|
+
weight: z.number().optional(),
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Maps the A2UI `weight` property to a flex style, matching the basic catalog.
|
|
13
|
+
* Only meaningful when the component is a direct child of a Row/Column.
|
|
14
|
+
*/
|
|
15
|
+
export function getWeightStyle(weight) {
|
|
16
|
+
if (typeof weight !== 'number')
|
|
17
|
+
return undefined;
|
|
18
|
+
return { flex: `${weight}`, minWidth: 0, minHeight: 0 };
|
|
19
|
+
}
|
|
20
|
+
/** Preserves A2UI `REF:` tags when adding a field description for catalog JSON generation. */
|
|
21
|
+
export function describeDynamic(schema, def, description) {
|
|
22
|
+
return schema.describe(`REF:common_types.json#/$defs/${def}|${description}`);
|
|
23
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties } from 'react';
|
|
2
|
-
export type ButtonVariant = 'primary' | 'destructive' | 'outline';
|
|
2
|
+
export type ButtonVariant = 'primary' | 'destructive' | 'outline' | 'borderless';
|
|
3
3
|
export declare const buttonBaseStyles: CSSProperties;
|
|
4
4
|
export declare function getButtonVariantStyles(variant: ButtonVariant): CSSProperties;
|
|
5
5
|
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Button/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Button/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,GAAG,YAAY,CAAC;AAEjF,eAAO,MAAM,gBAAgB,EAAE,aAiBb,CAAC;AAEnB,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,CAsD5E"}
|
|
@@ -39,6 +39,17 @@ export function getButtonVariantStyles(variant) {
|
|
|
39
39
|
'--glchat-button-border-active': 'hsl(var(--destructive))',
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
+
if (variant === 'borderless') {
|
|
43
|
+
return {
|
|
44
|
+
backgroundColor: 'transparent',
|
|
45
|
+
borderColor: 'transparent',
|
|
46
|
+
color: 'hsl(var(--foreground))',
|
|
47
|
+
'--glchat-button-bg-hover': 'linear-gradient(hsla(var(--hover)), hsla(var(--hover))), transparent',
|
|
48
|
+
'--glchat-button-border-hover': 'transparent',
|
|
49
|
+
'--glchat-button-bg-active': 'linear-gradient(hsla(var(--hover)), hsla(var(--hover))), transparent',
|
|
50
|
+
'--glchat-button-border-active': 'transparent',
|
|
51
|
+
};
|
|
52
|
+
}
|
|
42
53
|
return {
|
|
43
54
|
backgroundColor: 'hsl(var(--background))',
|
|
44
55
|
borderColor: 'hsl(var(--border))',
|
|
@@ -11,5 +11,5 @@ export type MultiSelectProps = {
|
|
|
11
11
|
className?: string;
|
|
12
12
|
style?: CSSProperties;
|
|
13
13
|
};
|
|
14
|
-
export declare function MultiSelect({ options, value, onValueChange, placeholder, disabled, filterable, maxSelections, className, style, }: Readonly<MultiSelectProps>): import("react
|
|
14
|
+
export declare function MultiSelect({ options, value, onValueChange, placeholder, disabled, filterable, maxSelections, className, style, }: Readonly<MultiSelectProps>): import("react").JSX.Element;
|
|
15
15
|
//# sourceMappingURL=MultiSelect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/MultiSelect/MultiSelect.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAM3C,OAAO,EAaL,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AAMF,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,KAAK,EACL,aAAa,EACb,WAA8B,EAC9B,QAAgB,EAChB,UAAkB,EAClB,aAAa,EACb,SAAS,EACT,KAAK,GACN,EAAE,QAAQ,CAAC,gBAAgB,CAAC
|
|
1
|
+
{"version":3,"file":"MultiSelect.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/MultiSelect/MultiSelect.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAM3C,OAAO,EAaL,KAAK,iBAAiB,EACvB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACzC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AAMF,wBAAgB,WAAW,CAAC,EAC1B,OAAO,EACP,KAAK,EACL,aAAa,EACb,WAA8B,EAC9B,QAAgB,EAChB,UAAkB,EAClB,aAAa,EACb,SAAS,EACT,KAAK,GACN,EAAE,QAAQ,CAAC,gBAAgB,CAAC,+BAyS5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Select/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;GAEG;AACH,+DAA+D;AAC/D,eAAO,MAAM,wBAAwB,EAAE,aAOtC,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,aAE5C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../src/components/ui/Select/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;GAEG;AACH,+DAA+D;AAC/D,eAAO,MAAM,wBAAwB,EAAE,aAOtC,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,aAE5C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,aAkBjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAcjC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,aAElC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,aAc9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,aAOvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,wBAAwB,EAAE,aAOtC,CAAC"}
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ReactComponentImplementation } from '@a2ui/react/v0_9';
|
|
2
|
+
import { Catalog } from '@a2ui/web_core/v0_9';
|
|
2
3
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
4
|
+
* Catalog identifier for the GLChat extended A2UI v0.9 catalog. Used as the
|
|
5
|
+
* `catalogId` in `createSurface` messages targeting the GLChat renderer.
|
|
5
6
|
*/
|
|
6
|
-
export declare
|
|
7
|
+
export declare const GLCHAT_CATALOG_ID = "https://github.com/GDP-ADMIN/glchat-sdk/blob/main/js/glchat-a2ui-react-renderer/json/glchat_standard_catalog_definition.json";
|
|
8
|
+
/** Basic catalog components whose JSON Schema is regenerated from Zod. */
|
|
9
|
+
export declare const GLCHAT_CATALOG_OVERRIDES: readonly ["Button"];
|
|
10
|
+
/** GLChat-only components not present in the basic catalog. */
|
|
11
|
+
export declare const GLCHAT_CATALOG_EXTENSIONS: readonly ["TagInput", "Timeout"];
|
|
12
|
+
/**
|
|
13
|
+
* Builds the GLChat A2UI v0.9 catalog:
|
|
14
|
+
* - Includes basic catalog components except those GLChat overrides (`Button`, `ChoicePicker`).
|
|
15
|
+
* - Adds GLChat overrides and extensions (`Button`, `ChoicePicker`, `TagInput`, `Timeout`).
|
|
16
|
+
* - Reuses basic catalog functions unchanged.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createGlchatCatalog(): Catalog<ReactComponentImplementation>;
|
|
7
19
|
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/utils/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/utils/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAO9C;;;GAGG;AACH,eAAO,MAAM,iBAAiB,iIACkG,CAAC;AAKjI,0EAA0E;AAC1E,eAAO,MAAM,wBAAwB,qBAAsB,CAAC;AAE5D,+DAA+D;AAC/D,eAAO,MAAM,yBAAyB,kCAAmC,CAAC;AAE1E;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAAC,4BAA4B,CAAC,CAgB3E"}
|
|
@@ -1,26 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { CustomTimeoutComponent } from '../components/a2ui/Timeout/Timeout.js';
|
|
8
|
-
const registeredRegistries = new WeakSet();
|
|
1
|
+
import { basicCatalog } from '@a2ui/react/v0_9';
|
|
2
|
+
import { Catalog } from '@a2ui/web_core/v0_9';
|
|
3
|
+
import { GlchatButtonComponent } from '../components/a2ui/Button/Button.js';
|
|
4
|
+
import { GlchatChoicePickerComponent } from '../components/a2ui/ChoicePicker/ChoicePicker.js';
|
|
5
|
+
import { GlchatTagInputComponent } from '../components/a2ui/TagInput/TagInput.js';
|
|
6
|
+
import { GlchatTimeoutComponent } from '../components/a2ui/Timeout/Timeout.js';
|
|
9
7
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* Catalog identifier for the GLChat extended A2UI v0.9 catalog. Used as the
|
|
9
|
+
* `catalogId` in `createSurface` messages targeting the GLChat renderer.
|
|
12
10
|
*/
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
export const GLCHAT_CATALOG_ID = 'https://github.com/GDP-ADMIN/glchat-sdk/blob/main/js/glchat-a2ui-react-renderer/json/glchat_standard_catalog_definition.json';
|
|
12
|
+
/** Basic catalog components overridden at runtime by GLChat implementations. */
|
|
13
|
+
const OVERRIDDEN_COMPONENTS = new Set(['Button', 'ChoicePicker']);
|
|
14
|
+
/** Basic catalog components whose JSON Schema is regenerated from Zod. */
|
|
15
|
+
export const GLCHAT_CATALOG_OVERRIDES = ['Button'];
|
|
16
|
+
/** GLChat-only components not present in the basic catalog. */
|
|
17
|
+
export const GLCHAT_CATALOG_EXTENSIONS = ['TagInput', 'Timeout'];
|
|
18
|
+
/**
|
|
19
|
+
* Builds the GLChat A2UI v0.9 catalog:
|
|
20
|
+
* - Includes basic catalog components except those GLChat overrides (`Button`, `ChoicePicker`).
|
|
21
|
+
* - Adds GLChat overrides and extensions (`Button`, `ChoicePicker`, `TagInput`, `Timeout`).
|
|
22
|
+
* - Reuses basic catalog functions unchanged.
|
|
23
|
+
*/
|
|
24
|
+
export function createGlchatCatalog() {
|
|
25
|
+
const baseComponents = Array.from(basicCatalog.components.values()).filter((component) => !OVERRIDDEN_COMPONENTS.has(component.name));
|
|
26
|
+
const components = [
|
|
27
|
+
...baseComponents,
|
|
28
|
+
GlchatButtonComponent,
|
|
29
|
+
GlchatChoicePickerComponent,
|
|
30
|
+
GlchatTagInputComponent,
|
|
31
|
+
GlchatTimeoutComponent,
|
|
32
|
+
];
|
|
33
|
+
const functions = Array.from(basicCatalog.functions.values());
|
|
34
|
+
return new Catalog(GLCHAT_CATALOG_ID, components, functions);
|
|
26
35
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactComponentImplementation } from '@a2ui/react/v0_9';
|
|
2
|
+
import type { SurfaceGroupModel, SurfaceModel } from '@a2ui/web_core/v0_9';
|
|
3
|
+
/**
|
|
4
|
+
* Subscribes to surface creation/deletion on a `SurfaceGroupModel` and returns
|
|
5
|
+
* the current list of surfaces. The returned array is referentially stable
|
|
6
|
+
* until the set of surfaces changes, so it is safe for `useSyncExternalStore`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useSurfaces(model: SurfaceGroupModel<ReactComponentImplementation>): SurfaceModel<ReactComponentImplementation>[];
|
|
9
|
+
//# sourceMappingURL=useSurfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSurfaces.d.ts","sourceRoot":"","sources":["../../../src/utils/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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useCallback, useRef, useSyncExternalStore } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Subscribes to surface creation/deletion on a `SurfaceGroupModel` and returns
|
|
4
|
+
* the current list of surfaces. The returned array is referentially stable
|
|
5
|
+
* until the set of surfaces changes, so it is safe for `useSyncExternalStore`.
|
|
6
|
+
*/
|
|
7
|
+
export function useSurfaces(model) {
|
|
8
|
+
const cacheRef = useRef([]);
|
|
9
|
+
const subscribe = useCallback((onStoreChange) => {
|
|
10
|
+
const created = model.onSurfaceCreated.subscribe(() => onStoreChange());
|
|
11
|
+
const deleted = model.onSurfaceDeleted.subscribe(() => onStoreChange());
|
|
12
|
+
return () => {
|
|
13
|
+
created.unsubscribe();
|
|
14
|
+
deleted.unsubscribe();
|
|
15
|
+
};
|
|
16
|
+
}, [model]);
|
|
17
|
+
const getSnapshot = useCallback(() => {
|
|
18
|
+
const surfaces = Array.from(model.surfacesMap.values());
|
|
19
|
+
const cached = cacheRef.current;
|
|
20
|
+
if (cached.length === surfaces.length &&
|
|
21
|
+
cached.every((surface, index) => surface === surfaces[index])) {
|
|
22
|
+
return cached;
|
|
23
|
+
}
|
|
24
|
+
cacheRef.current = surfaces;
|
|
25
|
+
return surfaces;
|
|
26
|
+
}, [model]);
|
|
27
|
+
return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
28
|
+
}
|