@copilotkit/shared 1.84.2-canary.1793807121 → 1.84.2-canary.openbot-intel-fixes
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 +1 -1
- package/dist/a2ui-catalog-schema.cjs +14 -5
- package/dist/a2ui-catalog-schema.cjs.map +1 -1
- package/dist/a2ui-catalog-schema.d.cts +4 -2
- package/dist/a2ui-catalog-schema.d.cts.map +1 -1
- package/dist/a2ui-catalog-schema.d.mts +4 -2
- package/dist/a2ui-catalog-schema.d.mts.map +1 -1
- package/dist/a2ui-catalog-schema.mjs +14 -5
- package/dist/a2ui-catalog-schema.mjs.map +1 -1
- package/dist/event-transforms/open-generative-ui-middleware.cjs +7 -6
- package/dist/event-transforms/open-generative-ui-middleware.cjs.map +1 -1
- package/dist/event-transforms/open-generative-ui-middleware.d.cts.map +1 -1
- package/dist/event-transforms/open-generative-ui-middleware.d.mts.map +1 -1
- package/dist/event-transforms/open-generative-ui-middleware.mjs +7 -6
- package/dist/event-transforms/open-generative-ui-middleware.mjs.map +1 -1
- package/dist/generative-ui/catalog/catalog-export.cjs +329 -0
- package/dist/generative-ui/catalog/catalog-export.cjs.map +1 -0
- package/dist/generative-ui/catalog/catalog-export.d.cts +92 -0
- package/dist/generative-ui/catalog/catalog-export.d.cts.map +1 -0
- package/dist/generative-ui/catalog/catalog-export.d.mts +92 -0
- package/dist/generative-ui/catalog/catalog-export.d.mts.map +1 -0
- package/dist/generative-ui/catalog/catalog-export.mjs +328 -0
- package/dist/generative-ui/catalog/catalog-export.mjs.map +1 -0
- package/dist/generative-ui/catalog/catalog.cjs +314 -0
- package/dist/generative-ui/catalog/catalog.cjs.map +1 -0
- package/dist/generative-ui/catalog/catalog.d.cts +407 -0
- package/dist/generative-ui/catalog/catalog.d.cts.map +1 -0
- package/dist/generative-ui/catalog/catalog.d.mts +407 -0
- package/dist/generative-ui/catalog/catalog.d.mts.map +1 -0
- package/dist/generative-ui/catalog/catalog.mjs +311 -0
- package/dist/generative-ui/catalog/catalog.mjs.map +1 -0
- package/dist/generative-ui/catalog/errors.cjs +13 -0
- package/dist/generative-ui/catalog/errors.cjs.map +1 -0
- package/dist/generative-ui/catalog/errors.d.cts +46 -0
- package/dist/generative-ui/catalog/errors.d.cts.map +1 -0
- package/dist/generative-ui/catalog/errors.d.mts +46 -0
- package/dist/generative-ui/catalog/errors.d.mts.map +1 -0
- package/dist/generative-ui/catalog/errors.mjs +12 -0
- package/dist/generative-ui/catalog/errors.mjs.map +1 -0
- package/dist/generative-ui/catalog/index.d.mts +6 -0
- package/dist/generative-ui/catalog/json-schema.cjs +19 -0
- package/dist/generative-ui/catalog/json-schema.cjs.map +1 -0
- package/dist/generative-ui/catalog/json-schema.d.cts +13 -0
- package/dist/generative-ui/catalog/json-schema.d.cts.map +1 -0
- package/dist/generative-ui/catalog/json-schema.d.mts +13 -0
- package/dist/generative-ui/catalog/json-schema.d.mts.map +1 -0
- package/dist/generative-ui/catalog/json-schema.mjs +18 -0
- package/dist/generative-ui/catalog/json-schema.mjs.map +1 -0
- package/dist/generative-ui/catalog/refs.cjs +20 -0
- package/dist/generative-ui/catalog/refs.cjs.map +1 -0
- package/dist/generative-ui/catalog/refs.d.cts +54 -0
- package/dist/generative-ui/catalog/refs.d.cts.map +1 -0
- package/dist/generative-ui/catalog/refs.d.mts +54 -0
- package/dist/generative-ui/catalog/refs.d.mts.map +1 -0
- package/dist/generative-ui/catalog/refs.mjs +18 -0
- package/dist/generative-ui/catalog/refs.mjs.map +1 -0
- package/dist/generative-ui/catalog/schema.cjs +74 -0
- package/dist/generative-ui/catalog/schema.cjs.map +1 -0
- package/dist/generative-ui/catalog/schema.d.cts +43 -0
- package/dist/generative-ui/catalog/schema.d.cts.map +1 -0
- package/dist/generative-ui/catalog/schema.d.mts +43 -0
- package/dist/generative-ui/catalog/schema.d.mts.map +1 -0
- package/dist/generative-ui/catalog/schema.mjs +68 -0
- package/dist/generative-ui/catalog/schema.mjs.map +1 -0
- package/dist/generative-ui/index.cjs +247 -0
- package/dist/generative-ui/index.d.cts +33 -0
- package/dist/generative-ui/index.d.mts +35 -0
- package/dist/generative-ui/index.mjs +34 -0
- package/dist/generative-ui/is-record.cjs +6 -1
- package/dist/generative-ui/is-record.cjs.map +1 -1
- package/dist/generative-ui/is-record.d.cts +6 -0
- package/dist/generative-ui/is-record.d.cts.map +1 -0
- package/dist/generative-ui/is-record.d.mts +6 -0
- package/dist/generative-ui/is-record.d.mts.map +1 -0
- package/dist/generative-ui/is-record.mjs +6 -2
- package/dist/generative-ui/is-record.mjs.map +1 -1
- package/dist/generative-ui/standard/chart.cjs +56 -0
- package/dist/generative-ui/standard/chart.cjs.map +1 -0
- package/dist/generative-ui/standard/chart.d.cts +142 -0
- package/dist/generative-ui/standard/chart.d.cts.map +1 -0
- package/dist/generative-ui/standard/chart.d.mts +142 -0
- package/dist/generative-ui/standard/chart.d.mts.map +1 -0
- package/dist/generative-ui/standard/chart.mjs +54 -0
- package/dist/generative-ui/standard/chart.mjs.map +1 -0
- package/dist/generative-ui/standard/checks.cjs +74 -0
- package/dist/generative-ui/standard/checks.cjs.map +1 -0
- package/dist/generative-ui/standard/checks.d.cts +74 -0
- package/dist/generative-ui/standard/checks.d.cts.map +1 -0
- package/dist/generative-ui/standard/checks.d.mts +74 -0
- package/dist/generative-ui/standard/checks.d.mts.map +1 -0
- package/dist/generative-ui/standard/checks.mjs +71 -0
- package/dist/generative-ui/standard/checks.mjs.map +1 -0
- package/dist/generative-ui/standard/components.cjs +23 -0
- package/dist/generative-ui/standard/components.cjs.map +1 -0
- package/dist/generative-ui/standard/components.d.cts +24 -0
- package/dist/generative-ui/standard/components.d.cts.map +1 -0
- package/dist/generative-ui/standard/components.d.mts +24 -0
- package/dist/generative-ui/standard/components.d.mts.map +1 -0
- package/dist/generative-ui/standard/components.mjs +22 -0
- package/dist/generative-ui/standard/components.mjs.map +1 -0
- package/dist/generative-ui/standard/composites.cjs +143 -0
- package/dist/generative-ui/standard/composites.cjs.map +1 -0
- package/dist/generative-ui/standard/composites.d.cts +500 -0
- package/dist/generative-ui/standard/composites.d.cts.map +1 -0
- package/dist/generative-ui/standard/composites.d.mts +500 -0
- package/dist/generative-ui/standard/composites.d.mts.map +1 -0
- package/dist/generative-ui/standard/composites.mjs +132 -0
- package/dist/generative-ui/standard/composites.mjs.map +1 -0
- package/dist/generative-ui/standard/data.cjs +176 -0
- package/dist/generative-ui/standard/data.cjs.map +1 -0
- package/dist/generative-ui/standard/data.d.cts +745 -0
- package/dist/generative-ui/standard/data.d.cts.map +1 -0
- package/dist/generative-ui/standard/data.d.mts +745 -0
- package/dist/generative-ui/standard/data.d.mts.map +1 -0
- package/dist/generative-ui/standard/data.mjs +167 -0
- package/dist/generative-ui/standard/data.mjs.map +1 -0
- package/dist/generative-ui/standard/declarations.cjs +40 -0
- package/dist/generative-ui/standard/declarations.cjs.map +1 -0
- package/dist/generative-ui/standard/declarations.d.cts +4604 -0
- package/dist/generative-ui/standard/declarations.d.cts.map +1 -0
- package/dist/generative-ui/standard/declarations.d.mts +4605 -0
- package/dist/generative-ui/standard/declarations.d.mts.map +1 -0
- package/dist/generative-ui/standard/declarations.mjs +39 -0
- package/dist/generative-ui/standard/declarations.mjs.map +1 -0
- package/dist/generative-ui/standard/feedback.cjs +97 -0
- package/dist/generative-ui/standard/feedback.cjs.map +1 -0
- package/dist/generative-ui/standard/feedback.d.cts +227 -0
- package/dist/generative-ui/standard/feedback.d.cts.map +1 -0
- package/dist/generative-ui/standard/feedback.d.mts +227 -0
- package/dist/generative-ui/standard/feedback.d.mts.map +1 -0
- package/dist/generative-ui/standard/feedback.mjs +90 -0
- package/dist/generative-ui/standard/feedback.mjs.map +1 -0
- package/dist/generative-ui/standard/index.d.mts +16 -0
- package/dist/generative-ui/standard/inputs.cjs +333 -0
- package/dist/generative-ui/standard/inputs.cjs.map +1 -0
- package/dist/generative-ui/standard/inputs.d.cts +2658 -0
- package/dist/generative-ui/standard/inputs.d.cts.map +1 -0
- package/dist/generative-ui/standard/inputs.d.mts +2658 -0
- package/dist/generative-ui/standard/inputs.d.mts.map +1 -0
- package/dist/generative-ui/standard/inputs.mjs +318 -0
- package/dist/generative-ui/standard/inputs.mjs.map +1 -0
- package/dist/generative-ui/standard/layout.cjs +289 -0
- package/dist/generative-ui/standard/layout.cjs.map +1 -0
- package/dist/generative-ui/standard/layout.d.cts +2854 -0
- package/dist/generative-ui/standard/layout.d.cts.map +1 -0
- package/dist/generative-ui/standard/layout.d.mts +2854 -0
- package/dist/generative-ui/standard/layout.d.mts.map +1 -0
- package/dist/generative-ui/standard/layout.mjs +269 -0
- package/dist/generative-ui/standard/layout.mjs.map +1 -0
- package/dist/generative-ui/standard/map.cjs +27 -0
- package/dist/generative-ui/standard/map.cjs.map +1 -0
- package/dist/generative-ui/standard/map.d.cts +93 -0
- package/dist/generative-ui/standard/map.d.cts.map +1 -0
- package/dist/generative-ui/standard/map.d.mts +93 -0
- package/dist/generative-ui/standard/map.d.mts.map +1 -0
- package/dist/generative-ui/standard/map.mjs +25 -0
- package/dist/generative-ui/standard/map.mjs.map +1 -0
- package/dist/generative-ui/standard/media.cjs +215 -0
- package/dist/generative-ui/standard/media.cjs.map +1 -0
- package/dist/generative-ui/standard/media.d.cts +968 -0
- package/dist/generative-ui/standard/media.d.cts.map +1 -0
- package/dist/generative-ui/standard/media.d.mts +968 -0
- package/dist/generative-ui/standard/media.d.mts.map +1 -0
- package/dist/generative-ui/standard/media.mjs +205 -0
- package/dist/generative-ui/standard/media.mjs.map +1 -0
- package/dist/generative-ui/standard/parameter-order.cjs +231 -0
- package/dist/generative-ui/standard/parameter-order.cjs.map +1 -0
- package/dist/generative-ui/standard/parameter-order.d.cts +84 -0
- package/dist/generative-ui/standard/parameter-order.d.cts.map +1 -0
- package/dist/generative-ui/standard/parameter-order.d.mts +84 -0
- package/dist/generative-ui/standard/parameter-order.d.mts.map +1 -0
- package/dist/generative-ui/standard/parameter-order.mjs +230 -0
- package/dist/generative-ui/standard/parameter-order.mjs.map +1 -0
- package/dist/generative-ui/standard/styles.cjs +62 -0
- package/dist/generative-ui/standard/styles.cjs.map +1 -0
- package/dist/generative-ui/standard/styles.d.cts +17 -0
- package/dist/generative-ui/standard/styles.d.cts.map +1 -0
- package/dist/generative-ui/standard/styles.d.mts +17 -0
- package/dist/generative-ui/standard/styles.d.mts.map +1 -0
- package/dist/generative-ui/standard/styles.mjs +60 -0
- package/dist/generative-ui/standard/styles.mjs.map +1 -0
- package/dist/generative-ui/standard/text.cjs +226 -0
- package/dist/generative-ui/standard/text.cjs.map +1 -0
- package/dist/generative-ui/standard/text.d.cts +687 -0
- package/dist/generative-ui/standard/text.d.cts.map +1 -0
- package/dist/generative-ui/standard/text.d.mts +687 -0
- package/dist/generative-ui/standard/text.d.mts.map +1 -0
- package/dist/generative-ui/standard/text.mjs +209 -0
- package/dist/generative-ui/standard/text.mjs.map +1 -0
- package/dist/generative-ui/standard/theme.cjs +115 -0
- package/dist/generative-ui/standard/theme.cjs.map +1 -0
- package/dist/generative-ui/standard/theme.d.cts +60 -0
- package/dist/generative-ui/standard/theme.d.cts.map +1 -0
- package/dist/generative-ui/standard/theme.d.mts +60 -0
- package/dist/generative-ui/standard/theme.d.mts.map +1 -0
- package/dist/generative-ui/standard/theme.mjs +112 -0
- package/dist/generative-ui/standard/theme.mjs.map +1 -0
- package/dist/generative-ui/standard/tokens.cjs +336 -0
- package/dist/generative-ui/standard/tokens.cjs.map +1 -0
- package/dist/generative-ui/standard/tokens.d.cts +76 -0
- package/dist/generative-ui/standard/tokens.d.cts.map +1 -0
- package/dist/generative-ui/standard/tokens.d.mts +76 -0
- package/dist/generative-ui/standard/tokens.d.mts.map +1 -0
- package/dist/generative-ui/standard/tokens.mjs +305 -0
- package/dist/generative-ui/standard/tokens.mjs.map +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -10
- package/dist/index.d.mts +10 -10
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +16 -7
- package/dist/index.umd.js.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/package.json +7 -3
- package/src/__tests__/a2ui-catalog-schema.test.ts +26 -0
- package/src/a2ui-catalog-schema.ts +14 -5
- package/src/event-transforms/open-generative-ui-middleware.ts +19 -10
- package/src/generative-ui/base.ts +9 -0
- package/src/generative-ui/catalog/catalog-export.ts +478 -0
- package/src/generative-ui/catalog/catalog.ts +1166 -0
- package/src/generative-ui/catalog/errors.ts +102 -0
- package/src/generative-ui/catalog/index.ts +6 -0
- package/src/generative-ui/catalog/json-schema.ts +23 -0
- package/src/generative-ui/catalog/refs.ts +86 -0
- package/src/generative-ui/catalog/schema.ts +107 -0
- package/src/generative-ui/index.ts +7 -0
- package/src/generative-ui/is-record.ts +6 -1
- package/src/generative-ui/standard/__tests__/theme.test.ts +61 -0
- package/src/generative-ui/standard/__tests__/tokens.test.ts +139 -0
- package/src/generative-ui/standard/chart.ts +79 -0
- package/src/generative-ui/standard/checks.ts +98 -0
- package/src/generative-ui/standard/components.ts +35 -0
- package/src/generative-ui/standard/composites.ts +158 -0
- package/src/generative-ui/standard/data.ts +213 -0
- package/src/generative-ui/standard/declarations.ts +57 -0
- package/src/generative-ui/standard/feedback.ts +105 -0
- package/src/generative-ui/standard/index.ts +19 -0
- package/src/generative-ui/standard/inputs.ts +423 -0
- package/src/generative-ui/standard/layout.ts +312 -0
- package/src/generative-ui/standard/map.ts +32 -0
- package/src/generative-ui/standard/media.ts +265 -0
- package/src/generative-ui/standard/parameter-order.ts +155 -0
- package/src/generative-ui/standard/styles.ts +79 -0
- package/src/generative-ui/standard/text.ts +210 -0
- package/src/generative-ui/standard/theme.ts +198 -0
- package/src/generative-ui/standard/tokens.ts +317 -0
- package/src/index.ts +1 -1
- package/tsdown.config.ts +1 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/generative-ui/standard/chart.d.ts
|
|
4
|
+
declare const chartSeries: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
5
|
+
key: z.ZodString;
|
|
6
|
+
label: z.ZodOptional<z.ZodString>;
|
|
7
|
+
color: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
key: string;
|
|
10
|
+
label?: string | undefined;
|
|
11
|
+
color?: string | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
key: string;
|
|
14
|
+
label?: string | undefined;
|
|
15
|
+
color?: string | undefined;
|
|
16
|
+
}>]>;
|
|
17
|
+
type ChartSeries = z.output<typeof chartSeries>;
|
|
18
|
+
declare const chartSchema: z.ZodObject<{
|
|
19
|
+
chartType: z.ZodOptional<z.ZodEnum<["bar", "line", "area", "scatter", "pie", "donut"]>>;
|
|
20
|
+
data: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
21
|
+
xKey: z.ZodOptional<z.ZodString>;
|
|
22
|
+
series: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
23
|
+
key: z.ZodString;
|
|
24
|
+
label: z.ZodOptional<z.ZodString>;
|
|
25
|
+
color: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
key: string;
|
|
28
|
+
label?: string | undefined;
|
|
29
|
+
color?: string | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
key: string;
|
|
32
|
+
label?: string | undefined;
|
|
33
|
+
color?: string | undefined;
|
|
34
|
+
}>]>, "many">>;
|
|
35
|
+
stacked: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
+
layout: z.ZodOptional<z.ZodEnum<["vertical", "horizontal"]>>;
|
|
37
|
+
yAxis: z.ZodOptional<z.ZodObject<{
|
|
38
|
+
label: z.ZodOptional<z.ZodString>;
|
|
39
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
label?: string | undefined;
|
|
44
|
+
width?: number | undefined;
|
|
45
|
+
min?: number | undefined;
|
|
46
|
+
max?: number | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
label?: string | undefined;
|
|
49
|
+
width?: number | undefined;
|
|
50
|
+
min?: number | undefined;
|
|
51
|
+
max?: number | undefined;
|
|
52
|
+
}>>;
|
|
53
|
+
showDots: z.ZodOptional<z.ZodBoolean>;
|
|
54
|
+
barRadius: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
innerRadius: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
56
|
+
outerRadius: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
57
|
+
startAngle: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
endAngle: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
cornerRadius: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
paddingAngle: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
showLabelLines: z.ZodOptional<z.ZodBoolean>;
|
|
62
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
showLegend: z.ZodOptional<z.ZodBoolean>;
|
|
64
|
+
showGrid: z.ZodOptional<z.ZodBoolean>;
|
|
65
|
+
showTooltip: z.ZodOptional<z.ZodBoolean>;
|
|
66
|
+
showValueLabels: z.ZodOptional<z.ZodBoolean>;
|
|
67
|
+
format: z.ZodOptional<z.ZodEnum<["number", "currency", "percent"]>>;
|
|
68
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
69
|
+
title: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}, "strip", z.ZodTypeAny, {
|
|
71
|
+
title?: string | undefined;
|
|
72
|
+
height?: number | undefined;
|
|
73
|
+
layout?: "horizontal" | "vertical" | undefined;
|
|
74
|
+
chartType?: "bar" | "line" | "area" | "scatter" | "pie" | "donut" | undefined;
|
|
75
|
+
data?: Record<string, unknown>[] | undefined;
|
|
76
|
+
xKey?: string | undefined;
|
|
77
|
+
series?: (string | {
|
|
78
|
+
key: string;
|
|
79
|
+
label?: string | undefined;
|
|
80
|
+
color?: string | undefined;
|
|
81
|
+
})[] | undefined;
|
|
82
|
+
stacked?: boolean | undefined;
|
|
83
|
+
yAxis?: {
|
|
84
|
+
label?: string | undefined;
|
|
85
|
+
width?: number | undefined;
|
|
86
|
+
min?: number | undefined;
|
|
87
|
+
max?: number | undefined;
|
|
88
|
+
} | undefined;
|
|
89
|
+
showDots?: boolean | undefined;
|
|
90
|
+
barRadius?: number | undefined;
|
|
91
|
+
innerRadius?: string | number | undefined;
|
|
92
|
+
outerRadius?: string | number | undefined;
|
|
93
|
+
startAngle?: number | undefined;
|
|
94
|
+
endAngle?: number | undefined;
|
|
95
|
+
cornerRadius?: number | undefined;
|
|
96
|
+
paddingAngle?: number | undefined;
|
|
97
|
+
showLabelLines?: boolean | undefined;
|
|
98
|
+
showLegend?: boolean | undefined;
|
|
99
|
+
showGrid?: boolean | undefined;
|
|
100
|
+
showTooltip?: boolean | undefined;
|
|
101
|
+
showValueLabels?: boolean | undefined;
|
|
102
|
+
currency?: string | undefined;
|
|
103
|
+
format?: "number" | "currency" | "percent" | undefined;
|
|
104
|
+
}, {
|
|
105
|
+
title?: string | undefined;
|
|
106
|
+
height?: number | undefined;
|
|
107
|
+
layout?: "horizontal" | "vertical" | undefined;
|
|
108
|
+
chartType?: "bar" | "line" | "area" | "scatter" | "pie" | "donut" | undefined;
|
|
109
|
+
data?: Record<string, unknown>[] | undefined;
|
|
110
|
+
xKey?: string | undefined;
|
|
111
|
+
series?: (string | {
|
|
112
|
+
key: string;
|
|
113
|
+
label?: string | undefined;
|
|
114
|
+
color?: string | undefined;
|
|
115
|
+
})[] | undefined;
|
|
116
|
+
stacked?: boolean | undefined;
|
|
117
|
+
yAxis?: {
|
|
118
|
+
label?: string | undefined;
|
|
119
|
+
width?: number | undefined;
|
|
120
|
+
min?: number | undefined;
|
|
121
|
+
max?: number | undefined;
|
|
122
|
+
} | undefined;
|
|
123
|
+
showDots?: boolean | undefined;
|
|
124
|
+
barRadius?: number | undefined;
|
|
125
|
+
innerRadius?: string | number | undefined;
|
|
126
|
+
outerRadius?: string | number | undefined;
|
|
127
|
+
startAngle?: number | undefined;
|
|
128
|
+
endAngle?: number | undefined;
|
|
129
|
+
cornerRadius?: number | undefined;
|
|
130
|
+
paddingAngle?: number | undefined;
|
|
131
|
+
showLabelLines?: boolean | undefined;
|
|
132
|
+
showLegend?: boolean | undefined;
|
|
133
|
+
showGrid?: boolean | undefined;
|
|
134
|
+
showTooltip?: boolean | undefined;
|
|
135
|
+
showValueLabels?: boolean | undefined;
|
|
136
|
+
currency?: string | undefined;
|
|
137
|
+
format?: "number" | "currency" | "percent" | undefined;
|
|
138
|
+
}>;
|
|
139
|
+
type ChartProps = z.output<typeof chartSchema>;
|
|
140
|
+
//#endregion
|
|
141
|
+
export { ChartProps, ChartSeries, chartSchema, chartSeries };
|
|
142
|
+
//# sourceMappingURL=chart.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.d.cts","names":[],"sources":["../../../src/generative-ui/standard/chart.ts"],"mappings":";;;cAIa,WAAA,EAAW,CAAA,CAAA,QAAA,EAAA,CAAA,CAAA,SAAA,EAAA,CAAA,CAAA,SAAA;;;;;;;;;;;;;KAQZ,WAAA,GAAc,CAAA,CAAE,MAAA,QAAc,WAAA;AAAA,cAE7B,WAAA,EAAW,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgEZ,UAAA,GAAa,CAAA,CAAE,MAAA,QAAc,WAAA"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/generative-ui/standard/chart.d.ts
|
|
4
|
+
declare const chartSeries: z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
5
|
+
key: z.ZodString;
|
|
6
|
+
label: z.ZodOptional<z.ZodString>;
|
|
7
|
+
color: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
key: string;
|
|
10
|
+
label?: string | undefined;
|
|
11
|
+
color?: string | undefined;
|
|
12
|
+
}, {
|
|
13
|
+
key: string;
|
|
14
|
+
label?: string | undefined;
|
|
15
|
+
color?: string | undefined;
|
|
16
|
+
}>]>;
|
|
17
|
+
type ChartSeries = z.output<typeof chartSeries>;
|
|
18
|
+
declare const chartSchema: z.ZodObject<{
|
|
19
|
+
chartType: z.ZodOptional<z.ZodEnum<["bar", "line", "area", "scatter", "pie", "donut"]>>;
|
|
20
|
+
data: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>, "many">>;
|
|
21
|
+
xKey: z.ZodOptional<z.ZodString>;
|
|
22
|
+
series: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
|
|
23
|
+
key: z.ZodString;
|
|
24
|
+
label: z.ZodOptional<z.ZodString>;
|
|
25
|
+
color: z.ZodOptional<z.ZodString>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
key: string;
|
|
28
|
+
label?: string | undefined;
|
|
29
|
+
color?: string | undefined;
|
|
30
|
+
}, {
|
|
31
|
+
key: string;
|
|
32
|
+
label?: string | undefined;
|
|
33
|
+
color?: string | undefined;
|
|
34
|
+
}>]>, "many">>;
|
|
35
|
+
stacked: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
+
layout: z.ZodOptional<z.ZodEnum<["vertical", "horizontal"]>>;
|
|
37
|
+
yAxis: z.ZodOptional<z.ZodObject<{
|
|
38
|
+
label: z.ZodOptional<z.ZodString>;
|
|
39
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
label?: string | undefined;
|
|
44
|
+
width?: number | undefined;
|
|
45
|
+
min?: number | undefined;
|
|
46
|
+
max?: number | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
label?: string | undefined;
|
|
49
|
+
width?: number | undefined;
|
|
50
|
+
min?: number | undefined;
|
|
51
|
+
max?: number | undefined;
|
|
52
|
+
}>>;
|
|
53
|
+
showDots: z.ZodOptional<z.ZodBoolean>;
|
|
54
|
+
barRadius: z.ZodOptional<z.ZodNumber>;
|
|
55
|
+
innerRadius: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
56
|
+
outerRadius: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
57
|
+
startAngle: z.ZodOptional<z.ZodNumber>;
|
|
58
|
+
endAngle: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
cornerRadius: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
paddingAngle: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
showLabelLines: z.ZodOptional<z.ZodBoolean>;
|
|
62
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
showLegend: z.ZodOptional<z.ZodBoolean>;
|
|
64
|
+
showGrid: z.ZodOptional<z.ZodBoolean>;
|
|
65
|
+
showTooltip: z.ZodOptional<z.ZodBoolean>;
|
|
66
|
+
showValueLabels: z.ZodOptional<z.ZodBoolean>;
|
|
67
|
+
format: z.ZodOptional<z.ZodEnum<["number", "currency", "percent"]>>;
|
|
68
|
+
currency: z.ZodOptional<z.ZodString>;
|
|
69
|
+
title: z.ZodOptional<z.ZodString>;
|
|
70
|
+
}, "strip", z.ZodTypeAny, {
|
|
71
|
+
title?: string | undefined;
|
|
72
|
+
height?: number | undefined;
|
|
73
|
+
layout?: "horizontal" | "vertical" | undefined;
|
|
74
|
+
chartType?: "bar" | "line" | "area" | "scatter" | "pie" | "donut" | undefined;
|
|
75
|
+
data?: Record<string, unknown>[] | undefined;
|
|
76
|
+
xKey?: string | undefined;
|
|
77
|
+
series?: (string | {
|
|
78
|
+
key: string;
|
|
79
|
+
label?: string | undefined;
|
|
80
|
+
color?: string | undefined;
|
|
81
|
+
})[] | undefined;
|
|
82
|
+
stacked?: boolean | undefined;
|
|
83
|
+
yAxis?: {
|
|
84
|
+
label?: string | undefined;
|
|
85
|
+
width?: number | undefined;
|
|
86
|
+
min?: number | undefined;
|
|
87
|
+
max?: number | undefined;
|
|
88
|
+
} | undefined;
|
|
89
|
+
showDots?: boolean | undefined;
|
|
90
|
+
barRadius?: number | undefined;
|
|
91
|
+
innerRadius?: string | number | undefined;
|
|
92
|
+
outerRadius?: string | number | undefined;
|
|
93
|
+
startAngle?: number | undefined;
|
|
94
|
+
endAngle?: number | undefined;
|
|
95
|
+
cornerRadius?: number | undefined;
|
|
96
|
+
paddingAngle?: number | undefined;
|
|
97
|
+
showLabelLines?: boolean | undefined;
|
|
98
|
+
showLegend?: boolean | undefined;
|
|
99
|
+
showGrid?: boolean | undefined;
|
|
100
|
+
showTooltip?: boolean | undefined;
|
|
101
|
+
showValueLabels?: boolean | undefined;
|
|
102
|
+
currency?: string | undefined;
|
|
103
|
+
format?: "number" | "currency" | "percent" | undefined;
|
|
104
|
+
}, {
|
|
105
|
+
title?: string | undefined;
|
|
106
|
+
height?: number | undefined;
|
|
107
|
+
layout?: "horizontal" | "vertical" | undefined;
|
|
108
|
+
chartType?: "bar" | "line" | "area" | "scatter" | "pie" | "donut" | undefined;
|
|
109
|
+
data?: Record<string, unknown>[] | undefined;
|
|
110
|
+
xKey?: string | undefined;
|
|
111
|
+
series?: (string | {
|
|
112
|
+
key: string;
|
|
113
|
+
label?: string | undefined;
|
|
114
|
+
color?: string | undefined;
|
|
115
|
+
})[] | undefined;
|
|
116
|
+
stacked?: boolean | undefined;
|
|
117
|
+
yAxis?: {
|
|
118
|
+
label?: string | undefined;
|
|
119
|
+
width?: number | undefined;
|
|
120
|
+
min?: number | undefined;
|
|
121
|
+
max?: number | undefined;
|
|
122
|
+
} | undefined;
|
|
123
|
+
showDots?: boolean | undefined;
|
|
124
|
+
barRadius?: number | undefined;
|
|
125
|
+
innerRadius?: string | number | undefined;
|
|
126
|
+
outerRadius?: string | number | undefined;
|
|
127
|
+
startAngle?: number | undefined;
|
|
128
|
+
endAngle?: number | undefined;
|
|
129
|
+
cornerRadius?: number | undefined;
|
|
130
|
+
paddingAngle?: number | undefined;
|
|
131
|
+
showLabelLines?: boolean | undefined;
|
|
132
|
+
showLegend?: boolean | undefined;
|
|
133
|
+
showGrid?: boolean | undefined;
|
|
134
|
+
showTooltip?: boolean | undefined;
|
|
135
|
+
showValueLabels?: boolean | undefined;
|
|
136
|
+
currency?: string | undefined;
|
|
137
|
+
format?: "number" | "currency" | "percent" | undefined;
|
|
138
|
+
}>;
|
|
139
|
+
type ChartProps = z.output<typeof chartSchema>;
|
|
140
|
+
//#endregion
|
|
141
|
+
export { ChartProps, ChartSeries, chartSchema, chartSeries };
|
|
142
|
+
//# sourceMappingURL=chart.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.d.mts","names":[],"sources":["../../../src/generative-ui/standard/chart.ts"],"mappings":";;;cAIa,WAAA,EAAW,CAAA,CAAA,QAAA,EAAA,CAAA,CAAA,SAAA,EAAA,CAAA,CAAA,SAAA;;;;;;;;;;;;;KAQZ,WAAA,GAAc,CAAA,CAAE,MAAA,QAAc,WAAA;AAAA,cAE7B,WAAA,EAAW,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgEZ,UAAA,GAAa,CAAA,CAAE,MAAA,QAAc,WAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/generative-ui/standard/chart.ts
|
|
4
|
+
const chartSeries = z.union([z.string(), z.object({
|
|
5
|
+
key: z.string(),
|
|
6
|
+
label: z.string().optional(),
|
|
7
|
+
color: z.string().optional().describe("A text color token or a CSS color")
|
|
8
|
+
})]);
|
|
9
|
+
const chartSchema = z.object({
|
|
10
|
+
chartType: z.enum([
|
|
11
|
+
"bar",
|
|
12
|
+
"line",
|
|
13
|
+
"area",
|
|
14
|
+
"scatter",
|
|
15
|
+
"pie",
|
|
16
|
+
"donut"
|
|
17
|
+
]).optional().describe("Default \"bar\""),
|
|
18
|
+
data: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
19
|
+
xKey: z.string().optional().describe("The field of the category axis"),
|
|
20
|
+
series: z.array(chartSeries).optional().describe("Default: every number field except xKey"),
|
|
21
|
+
stacked: z.boolean().optional(),
|
|
22
|
+
layout: z.enum(["vertical", "horizontal"]).optional().describe("\"horizontal\" draws the bars from left to right. Default \"vertical\""),
|
|
23
|
+
yAxis: z.object({
|
|
24
|
+
label: z.string().optional(),
|
|
25
|
+
min: z.number().optional(),
|
|
26
|
+
max: z.number().optional(),
|
|
27
|
+
width: z.number().optional().describe("Pixels")
|
|
28
|
+
}).optional().describe("Example: {label: \"Revenue (USD)\", min: 0, max: 100}. In a horizontal chart it is the horizontal axis, and width sets the category axis width"),
|
|
29
|
+
showDots: z.boolean().optional().describe("Point markers on a line or area"),
|
|
30
|
+
barRadius: z.number().optional().describe("The corner radius of a bar, in pixels"),
|
|
31
|
+
innerRadius: z.union([z.number(), z.string()]).optional().describe("Pie and donut"),
|
|
32
|
+
outerRadius: z.union([z.number(), z.string()]).optional().describe("Pie and donut"),
|
|
33
|
+
startAngle: z.number().optional().describe("Pie and donut. Default 90"),
|
|
34
|
+
endAngle: z.number().optional().describe("Pie and donut. Default -270"),
|
|
35
|
+
cornerRadius: z.number().optional().describe("The corners of a slice"),
|
|
36
|
+
paddingAngle: z.number().optional().describe("The gap between slices"),
|
|
37
|
+
showLabelLines: z.boolean().optional().describe("Leader lines of the slice labels. Default true"),
|
|
38
|
+
height: z.number().optional().describe("Pixels. Default 240"),
|
|
39
|
+
showLegend: z.boolean().optional().describe("Default true"),
|
|
40
|
+
showGrid: z.boolean().optional().describe("Default true"),
|
|
41
|
+
showTooltip: z.boolean().optional().describe("Default true"),
|
|
42
|
+
showValueLabels: z.boolean().optional(),
|
|
43
|
+
format: z.enum([
|
|
44
|
+
"number",
|
|
45
|
+
"currency",
|
|
46
|
+
"percent"
|
|
47
|
+
]).optional().describe("With \"percent\", data values and axis min/max are fractions: 0.4 shows as 40%; for 0% to 10%, use min: 0 and max: 0.1."),
|
|
48
|
+
currency: z.string().optional().describe("ISO code. Default \"USD\""),
|
|
49
|
+
title: z.string().optional()
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
//#endregion
|
|
53
|
+
export { chartSchema, chartSeries };
|
|
54
|
+
//# sourceMappingURL=chart.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart.mjs","names":[],"sources":["../../../src/generative-ui/standard/chart.ts"],"sourcesContent":["import { z } from \"zod\";\n\n// ---- Schema ----\n\nexport const chartSeries = z.union([\n z.string(),\n z.object({\n key: z.string(),\n label: z.string().optional(),\n color: z.string().optional().describe(\"A text color token or a CSS color\"),\n }),\n]);\nexport type ChartSeries = z.output<typeof chartSeries>;\n\nexport const chartSchema = z.object({\n chartType: z\n .enum([\"bar\", \"line\", \"area\", \"scatter\", \"pie\", \"donut\"])\n .optional()\n .describe('Default \"bar\"'),\n data: z.array(z.record(z.string(), z.unknown())).optional(),\n xKey: z.string().optional().describe(\"The field of the category axis\"),\n series: z\n .array(chartSeries)\n .optional()\n .describe(\"Default: every number field except xKey\"),\n stacked: z.boolean().optional(),\n layout: z\n .enum([\"vertical\", \"horizontal\"])\n .optional()\n .describe(\n '\"horizontal\" draws the bars from left to right. Default \"vertical\"',\n ),\n yAxis: z\n .object({\n label: z.string().optional(),\n min: z.number().optional(),\n max: z.number().optional(),\n width: z.number().optional().describe(\"Pixels\"),\n })\n .optional()\n .describe(\n 'Example: {label: \"Revenue (USD)\", min: 0, max: 100}. In a horizontal chart it is the horizontal axis, and width sets the category axis width',\n ),\n showDots: z.boolean().optional().describe(\"Point markers on a line or area\"),\n barRadius: z\n .number()\n .optional()\n .describe(\"The corner radius of a bar, in pixels\"),\n innerRadius: z\n .union([z.number(), z.string()])\n .optional()\n .describe(\"Pie and donut\"),\n outerRadius: z\n .union([z.number(), z.string()])\n .optional()\n .describe(\"Pie and donut\"),\n startAngle: z.number().optional().describe(\"Pie and donut. Default 90\"),\n endAngle: z.number().optional().describe(\"Pie and donut. Default -270\"),\n cornerRadius: z.number().optional().describe(\"The corners of a slice\"),\n paddingAngle: z.number().optional().describe(\"The gap between slices\"),\n showLabelLines: z\n .boolean()\n .optional()\n .describe(\"Leader lines of the slice labels. Default true\"),\n height: z.number().optional().describe(\"Pixels. Default 240\"),\n showLegend: z.boolean().optional().describe(\"Default true\"),\n showGrid: z.boolean().optional().describe(\"Default true\"),\n showTooltip: z.boolean().optional().describe(\"Default true\"),\n showValueLabels: z.boolean().optional(),\n format: z\n .enum([\"number\", \"currency\", \"percent\"])\n .optional()\n .describe(\n 'With \"percent\", data values and axis min/max are fractions: 0.4 shows as 40%; for 0% to 10%, use min: 0 and max: 0.1.',\n ),\n currency: z.string().optional().describe('ISO code. Default \"USD\"'),\n title: z.string().optional(),\n});\nexport type ChartProps = z.output<typeof chartSchema>;\n"],"mappings":";;;AAIA,MAAa,cAAc,EAAE,MAAM,CACjC,EAAE,QAAQ,EACV,EAAE,OAAO;CACP,KAAK,EAAE,QAAQ;CACf,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC5B,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,oCAAoC;CAC3E,CAAC,CACH,CAAC;AAGF,MAAa,cAAc,EAAE,OAAO;CAClC,WAAW,EACR,KAAK;EAAC;EAAO;EAAQ;EAAQ;EAAW;EAAO;EAAQ,CAAC,CACxD,UAAU,CACV,SAAS,kBAAgB;CAC5B,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,UAAU;CAC3D,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,iCAAiC;CACtE,QAAQ,EACL,MAAM,YAAY,CAClB,UAAU,CACV,SAAS,0CAA0C;CACtD,SAAS,EAAE,SAAS,CAAC,UAAU;CAC/B,QAAQ,EACL,KAAK,CAAC,YAAY,aAAa,CAAC,CAChC,UAAU,CACV,SACC,yEACD;CACH,OAAO,EACJ,OAAO;EACN,OAAO,EAAE,QAAQ,CAAC,UAAU;EAC5B,KAAK,EAAE,QAAQ,CAAC,UAAU;EAC1B,KAAK,EAAE,QAAQ,CAAC,UAAU;EAC1B,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,SAAS;EAChD,CAAC,CACD,UAAU,CACV,SACC,iJACD;CACH,UAAU,EAAE,SAAS,CAAC,UAAU,CAAC,SAAS,kCAAkC;CAC5E,WAAW,EACR,QAAQ,CACR,UAAU,CACV,SAAS,wCAAwC;CACpD,aAAa,EACV,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC,CAC/B,UAAU,CACV,SAAS,gBAAgB;CAC5B,aAAa,EACV,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC,CAC/B,UAAU,CACV,SAAS,gBAAgB;CAC5B,YAAY,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,4BAA4B;CACvE,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,8BAA8B;CACvE,cAAc,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,yBAAyB;CACtE,cAAc,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,yBAAyB;CACtE,gBAAgB,EACb,SAAS,CACT,UAAU,CACV,SAAS,iDAAiD;CAC7D,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,sBAAsB;CAC7D,YAAY,EAAE,SAAS,CAAC,UAAU,CAAC,SAAS,eAAe;CAC3D,UAAU,EAAE,SAAS,CAAC,UAAU,CAAC,SAAS,eAAe;CACzD,aAAa,EAAE,SAAS,CAAC,UAAU,CAAC,SAAS,eAAe;CAC5D,iBAAiB,EAAE,SAAS,CAAC,UAAU;CACvC,QAAQ,EACL,KAAK;EAAC;EAAU;EAAY;EAAU,CAAC,CACvC,UAAU,CACV,SACC,0HACD;CACH,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,4BAA0B;CACnE,OAAO,EAAE,QAAQ,CAAC,UAAU;CAC7B,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_tokens = require('./tokens.cjs');
|
|
3
|
+
let zod = require("zod");
|
|
4
|
+
|
|
5
|
+
//#region src/generative-ui/standard/checks.ts
|
|
6
|
+
/**
|
|
7
|
+
* The `checks` of the A2UI 1.0 `Checkable` components. The model writes
|
|
8
|
+
* each condition as a validator call or a boolean binding:
|
|
9
|
+
* `{ "condition": { "@call": "email", "args": { "value": { "@path": "/form/email" } } }, "message": "..." }`.
|
|
10
|
+
* The engine resolves the condition before the component renders, so a
|
|
11
|
+
* component sees a boolean or a `ValidationResult`.
|
|
12
|
+
*/
|
|
13
|
+
const severity = zod.z.enum([
|
|
14
|
+
"error",
|
|
15
|
+
"warning",
|
|
16
|
+
"info"
|
|
17
|
+
]);
|
|
18
|
+
const validationResult = zod.z.object({
|
|
19
|
+
valid: zod.z.boolean(),
|
|
20
|
+
message: zod.z.string().optional(),
|
|
21
|
+
code: zod.z.string().optional(),
|
|
22
|
+
severity: severity.optional()
|
|
23
|
+
}).passthrough();
|
|
24
|
+
const checksProp = zod.z.array(zod.z.object({
|
|
25
|
+
condition: zod.z.union([zod.z.boolean(), validationResult]).optional().describe("A validator call, for example {\"@call\":\"required\",\"args\":{\"value\":{\"@path\":\"/x\"}}}, or a boolean binding"),
|
|
26
|
+
message: zod.z.string().optional().describe("Shown when the check fails, instead of the default message")
|
|
27
|
+
})).optional().describe("Validation rules. The control shows the first failed one");
|
|
28
|
+
/**
|
|
29
|
+
* The failed check to show, or `undefined` when every check passes: the
|
|
30
|
+
* first error, or the first warning or info when no check is an error, so
|
|
31
|
+
* a warning never hides an error that comes after it. A condition that is
|
|
32
|
+
* not known yet (undefined) passes. A `false` condition is an error with
|
|
33
|
+
* the check's message. The check's message also wins over the message of
|
|
34
|
+
* a validator result: the built-in validators always have one, and the
|
|
35
|
+
* check is where the model puts its own wording.
|
|
36
|
+
*/
|
|
37
|
+
function firstFailedCheck(checks) {
|
|
38
|
+
let first;
|
|
39
|
+
for (const check of checks ?? []) {
|
|
40
|
+
const { condition } = check;
|
|
41
|
+
if (condition === void 0 || condition === null) continue;
|
|
42
|
+
let failed;
|
|
43
|
+
if (typeof condition === "boolean") {
|
|
44
|
+
if (condition) continue;
|
|
45
|
+
failed = {
|
|
46
|
+
message: check.message ?? "Invalid value",
|
|
47
|
+
severity: "error"
|
|
48
|
+
};
|
|
49
|
+
} else {
|
|
50
|
+
if (condition.valid) continue;
|
|
51
|
+
failed = {
|
|
52
|
+
message: check.message ?? condition.message ?? "Invalid value",
|
|
53
|
+
severity: condition.severity ?? "error",
|
|
54
|
+
...condition.code === void 0 ? {} : { code: condition.code }
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (failed.severity === "error") return failed;
|
|
58
|
+
first ??= failed;
|
|
59
|
+
}
|
|
60
|
+
return first;
|
|
61
|
+
}
|
|
62
|
+
/** The style of a check message, by its severity. */
|
|
63
|
+
function checkMessageStyle(severity) {
|
|
64
|
+
return {
|
|
65
|
+
...require_tokens.textFont("sm"),
|
|
66
|
+
color: require_tokens.textColor(severity === "error" ? "danger" : severity === "warning" ? "warning" : "secondary")
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
exports.checkMessageStyle = checkMessageStyle;
|
|
72
|
+
exports.checksProp = checksProp;
|
|
73
|
+
exports.firstFailedCheck = firstFailedCheck;
|
|
74
|
+
//# sourceMappingURL=checks.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks.cjs","names":["z","textFont","textColor"],"sources":["../../../src/generative-ui/standard/checks.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { textColor, textFont } from \"./tokens\";\n\n/**\n * The `checks` of the A2UI 1.0 `Checkable` components. The model writes\n * each condition as a validator call or a boolean binding:\n * `{ \"condition\": { \"@call\": \"email\", \"args\": { \"value\": { \"@path\": \"/form/email\" } } }, \"message\": \"...\" }`.\n * The engine resolves the condition before the component renders, so a\n * component sees a boolean or a `ValidationResult`.\n */\n\nconst severity = z.enum([\"error\", \"warning\", \"info\"]);\n\nconst validationResult = z\n .object({\n valid: z.boolean(),\n message: z.string().optional(),\n code: z.string().optional(),\n severity: severity.optional(),\n })\n .passthrough();\n\n/** The first failed check of a control, as the control shows it. */\nexport interface FailedCheck {\n message: string;\n /** `\"error\"` when the result named none. Only an error blocks. */\n severity: z.output<typeof severity>;\n /** The `code` of the validation result, when it had one. */\n code?: string;\n}\n\nexport const checksProp = z\n .array(\n z.object({\n condition: z\n .union([z.boolean(), validationResult])\n .optional()\n .describe(\n 'A validator call, for example {\"@call\":\"required\",\"args\":{\"value\":{\"@path\":\"/x\"}}}, or a boolean binding',\n ),\n message: z\n .string()\n .optional()\n .describe(\"Shown when the check fails, instead of the default message\"),\n }),\n )\n .optional()\n .describe(\"Validation rules. The control shows the first failed one\");\n\nexport type ResolvedChecks = z.output<typeof checksProp>;\n\n/**\n * The failed check to show, or `undefined` when every check passes: the\n * first error, or the first warning or info when no check is an error, so\n * a warning never hides an error that comes after it. A condition that is\n * not known yet (undefined) passes. A `false` condition is an error with\n * the check's message. The check's message also wins over the message of\n * a validator result: the built-in validators always have one, and the\n * check is where the model puts its own wording.\n */\nexport function firstFailedCheck(\n checks: ResolvedChecks,\n): FailedCheck | undefined {\n let first: FailedCheck | undefined;\n for (const check of checks ?? []) {\n const { condition } = check;\n if (condition === undefined || condition === null) continue;\n let failed: FailedCheck;\n if (typeof condition === \"boolean\") {\n if (condition) continue;\n failed = { message: check.message ?? \"Invalid value\", severity: \"error\" };\n } else {\n if (condition.valid) continue;\n failed = {\n message: check.message ?? condition.message ?? \"Invalid value\",\n severity: condition.severity ?? \"error\",\n ...(condition.code === undefined ? {} : { code: condition.code }),\n };\n }\n if (failed.severity === \"error\") return failed;\n first ??= failed;\n }\n return first;\n}\n\n/** The style of a check message, by its severity. */\nexport function checkMessageStyle(severity: FailedCheck[\"severity\"]) {\n return {\n ...textFont(\"sm\"),\n color: textColor(\n severity === \"error\"\n ? \"danger\"\n : severity === \"warning\"\n ? \"warning\"\n : \"secondary\",\n ),\n };\n}\n"],"mappings":";;;;;;;;;;;;AAWA,MAAM,WAAWA,MAAE,KAAK;CAAC;CAAS;CAAW;CAAO,CAAC;AAErD,MAAM,mBAAmBA,MACtB,OAAO;CACN,OAAOA,MAAE,SAAS;CAClB,SAASA,MAAE,QAAQ,CAAC,UAAU;CAC9B,MAAMA,MAAE,QAAQ,CAAC,UAAU;CAC3B,UAAU,SAAS,UAAU;CAC9B,CAAC,CACD,aAAa;AAWhB,MAAa,aAAaA,MACvB,MACCA,MAAE,OAAO;CACP,WAAWA,MACR,MAAM,CAACA,MAAE,SAAS,EAAE,iBAAiB,CAAC,CACtC,UAAU,CACV,SACC,uHACD;CACH,SAASA,MACN,QAAQ,CACR,UAAU,CACV,SAAS,6DAA6D;CAC1E,CAAC,CACH,CACA,UAAU,CACV,SAAS,2DAA2D;;;;;;;;;;AAavE,SAAgB,iBACd,QACyB;CACzB,IAAI;AACJ,MAAK,MAAM,SAAS,UAAU,EAAE,EAAE;EAChC,MAAM,EAAE,cAAc;AACtB,MAAI,cAAc,UAAa,cAAc,KAAM;EACnD,IAAI;AACJ,MAAI,OAAO,cAAc,WAAW;AAClC,OAAI,UAAW;AACf,YAAS;IAAE,SAAS,MAAM,WAAW;IAAiB,UAAU;IAAS;SACpE;AACL,OAAI,UAAU,MAAO;AACrB,YAAS;IACP,SAAS,MAAM,WAAW,UAAU,WAAW;IAC/C,UAAU,UAAU,YAAY;IAChC,GAAI,UAAU,SAAS,SAAY,EAAE,GAAG,EAAE,MAAM,UAAU,MAAM;IACjE;;AAEH,MAAI,OAAO,aAAa,QAAS,QAAO;AACxC,YAAU;;AAEZ,QAAO;;;AAIT,SAAgB,kBAAkB,UAAmC;AACnE,QAAO;EACL,GAAGC,wBAAS,KAAK;EACjB,OAAOC,yBACL,aAAa,UACT,WACA,aAAa,YACX,YACA,YACP;EACF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/generative-ui/standard/checks.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The `checks` of the A2UI 1.0 `Checkable` components. The model writes
|
|
6
|
+
* each condition as a validator call or a boolean binding:
|
|
7
|
+
* `{ "condition": { "@call": "email", "args": { "value": { "@path": "/form/email" } } }, "message": "..." }`.
|
|
8
|
+
* The engine resolves the condition before the component renders, so a
|
|
9
|
+
* component sees a boolean or a `ValidationResult`.
|
|
10
|
+
*/
|
|
11
|
+
declare const severity: z.ZodEnum<["error", "warning", "info"]>;
|
|
12
|
+
/** The first failed check of a control, as the control shows it. */
|
|
13
|
+
interface FailedCheck {
|
|
14
|
+
message: string;
|
|
15
|
+
/** `"error"` when the result named none. Only an error blocks. */
|
|
16
|
+
severity: z.output<typeof severity>;
|
|
17
|
+
/** The `code` of the validation result, when it had one. */
|
|
18
|
+
code?: string;
|
|
19
|
+
}
|
|
20
|
+
declare const checksProp: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
21
|
+
condition: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
|
|
22
|
+
valid: z.ZodBoolean;
|
|
23
|
+
message: z.ZodOptional<z.ZodString>;
|
|
24
|
+
code: z.ZodOptional<z.ZodString>;
|
|
25
|
+
severity: z.ZodOptional<z.ZodEnum<["error", "warning", "info"]>>;
|
|
26
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
27
|
+
valid: z.ZodBoolean;
|
|
28
|
+
message: z.ZodOptional<z.ZodString>;
|
|
29
|
+
code: z.ZodOptional<z.ZodString>;
|
|
30
|
+
severity: z.ZodOptional<z.ZodEnum<["error", "warning", "info"]>>;
|
|
31
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
32
|
+
valid: z.ZodBoolean;
|
|
33
|
+
message: z.ZodOptional<z.ZodString>;
|
|
34
|
+
code: z.ZodOptional<z.ZodString>;
|
|
35
|
+
severity: z.ZodOptional<z.ZodEnum<["error", "warning", "info"]>>;
|
|
36
|
+
}, z.ZodTypeAny, "passthrough">>]>>;
|
|
37
|
+
message: z.ZodOptional<z.ZodString>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
message?: string | undefined;
|
|
40
|
+
condition?: boolean | z.objectOutputType<{
|
|
41
|
+
valid: z.ZodBoolean;
|
|
42
|
+
message: z.ZodOptional<z.ZodString>;
|
|
43
|
+
code: z.ZodOptional<z.ZodString>;
|
|
44
|
+
severity: z.ZodOptional<z.ZodEnum<["error", "warning", "info"]>>;
|
|
45
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
message?: string | undefined;
|
|
48
|
+
condition?: boolean | z.objectInputType<{
|
|
49
|
+
valid: z.ZodBoolean;
|
|
50
|
+
message: z.ZodOptional<z.ZodString>;
|
|
51
|
+
code: z.ZodOptional<z.ZodString>;
|
|
52
|
+
severity: z.ZodOptional<z.ZodEnum<["error", "warning", "info"]>>;
|
|
53
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
54
|
+
}>, "many">>;
|
|
55
|
+
type ResolvedChecks = z.output<typeof checksProp>;
|
|
56
|
+
/**
|
|
57
|
+
* The failed check to show, or `undefined` when every check passes: the
|
|
58
|
+
* first error, or the first warning or info when no check is an error, so
|
|
59
|
+
* a warning never hides an error that comes after it. A condition that is
|
|
60
|
+
* not known yet (undefined) passes. A `false` condition is an error with
|
|
61
|
+
* the check's message. The check's message also wins over the message of
|
|
62
|
+
* a validator result: the built-in validators always have one, and the
|
|
63
|
+
* check is where the model puts its own wording.
|
|
64
|
+
*/
|
|
65
|
+
declare function firstFailedCheck(checks: ResolvedChecks): FailedCheck | undefined;
|
|
66
|
+
/** The style of a check message, by its severity. */
|
|
67
|
+
declare function checkMessageStyle(severity: FailedCheck["severity"]): {
|
|
68
|
+
color: string | undefined;
|
|
69
|
+
fontSize: string;
|
|
70
|
+
lineHeight: number;
|
|
71
|
+
};
|
|
72
|
+
//#endregion
|
|
73
|
+
export { FailedCheck, ResolvedChecks, checkMessageStyle, checksProp, firstFailedCheck };
|
|
74
|
+
//# sourceMappingURL=checks.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks.d.cts","names":[],"sources":["../../../src/generative-ui/standard/checks.ts"],"mappings":";;;;;AAAwB;;;;;cAWlB,QAAA,EAAQ,CAAA,CAAA,OAAA;;UAYG,WAAA;EACf,OAAA;EAAA;EAEA,QAAA,EAAU,CAAA,CAAE,MAAA,QAAc,QAAA;EAAhB;EAEV,IAAA;AAAA;AAAA,cAGW,UAAA,EAAU,CAAA,CAAA,WAAA,CAAA,CAAA,CAAA,QAAA,CAAA,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkBX,cAAA,GAAiB,CAAA,CAAE,MAAA,QAAc,UAAA;;;;;;;;;;iBAW7B,gBAAA,CACd,MAAA,EAAQ,cAAA,GACP,WAAA;;iBAwBa,iBAAA,CAAkB,QAAA,EAAU,WAAA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/generative-ui/standard/checks.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* The `checks` of the A2UI 1.0 `Checkable` components. The model writes
|
|
6
|
+
* each condition as a validator call or a boolean binding:
|
|
7
|
+
* `{ "condition": { "@call": "email", "args": { "value": { "@path": "/form/email" } } }, "message": "..." }`.
|
|
8
|
+
* The engine resolves the condition before the component renders, so a
|
|
9
|
+
* component sees a boolean or a `ValidationResult`.
|
|
10
|
+
*/
|
|
11
|
+
declare const severity: z.ZodEnum<["error", "warning", "info"]>;
|
|
12
|
+
/** The first failed check of a control, as the control shows it. */
|
|
13
|
+
interface FailedCheck {
|
|
14
|
+
message: string;
|
|
15
|
+
/** `"error"` when the result named none. Only an error blocks. */
|
|
16
|
+
severity: z.output<typeof severity>;
|
|
17
|
+
/** The `code` of the validation result, when it had one. */
|
|
18
|
+
code?: string;
|
|
19
|
+
}
|
|
20
|
+
declare const checksProp: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
21
|
+
condition: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
|
|
22
|
+
valid: z.ZodBoolean;
|
|
23
|
+
message: z.ZodOptional<z.ZodString>;
|
|
24
|
+
code: z.ZodOptional<z.ZodString>;
|
|
25
|
+
severity: z.ZodOptional<z.ZodEnum<["error", "warning", "info"]>>;
|
|
26
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
27
|
+
valid: z.ZodBoolean;
|
|
28
|
+
message: z.ZodOptional<z.ZodString>;
|
|
29
|
+
code: z.ZodOptional<z.ZodString>;
|
|
30
|
+
severity: z.ZodOptional<z.ZodEnum<["error", "warning", "info"]>>;
|
|
31
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
32
|
+
valid: z.ZodBoolean;
|
|
33
|
+
message: z.ZodOptional<z.ZodString>;
|
|
34
|
+
code: z.ZodOptional<z.ZodString>;
|
|
35
|
+
severity: z.ZodOptional<z.ZodEnum<["error", "warning", "info"]>>;
|
|
36
|
+
}, z.ZodTypeAny, "passthrough">>]>>;
|
|
37
|
+
message: z.ZodOptional<z.ZodString>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
message?: string | undefined;
|
|
40
|
+
condition?: boolean | z.objectOutputType<{
|
|
41
|
+
valid: z.ZodBoolean;
|
|
42
|
+
message: z.ZodOptional<z.ZodString>;
|
|
43
|
+
code: z.ZodOptional<z.ZodString>;
|
|
44
|
+
severity: z.ZodOptional<z.ZodEnum<["error", "warning", "info"]>>;
|
|
45
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
message?: string | undefined;
|
|
48
|
+
condition?: boolean | z.objectInputType<{
|
|
49
|
+
valid: z.ZodBoolean;
|
|
50
|
+
message: z.ZodOptional<z.ZodString>;
|
|
51
|
+
code: z.ZodOptional<z.ZodString>;
|
|
52
|
+
severity: z.ZodOptional<z.ZodEnum<["error", "warning", "info"]>>;
|
|
53
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
54
|
+
}>, "many">>;
|
|
55
|
+
type ResolvedChecks = z.output<typeof checksProp>;
|
|
56
|
+
/**
|
|
57
|
+
* The failed check to show, or `undefined` when every check passes: the
|
|
58
|
+
* first error, or the first warning or info when no check is an error, so
|
|
59
|
+
* a warning never hides an error that comes after it. A condition that is
|
|
60
|
+
* not known yet (undefined) passes. A `false` condition is an error with
|
|
61
|
+
* the check's message. The check's message also wins over the message of
|
|
62
|
+
* a validator result: the built-in validators always have one, and the
|
|
63
|
+
* check is where the model puts its own wording.
|
|
64
|
+
*/
|
|
65
|
+
declare function firstFailedCheck(checks: ResolvedChecks): FailedCheck | undefined;
|
|
66
|
+
/** The style of a check message, by its severity. */
|
|
67
|
+
declare function checkMessageStyle(severity: FailedCheck["severity"]): {
|
|
68
|
+
color: string | undefined;
|
|
69
|
+
fontSize: string;
|
|
70
|
+
lineHeight: number;
|
|
71
|
+
};
|
|
72
|
+
//#endregion
|
|
73
|
+
export { FailedCheck, ResolvedChecks, checkMessageStyle, checksProp, firstFailedCheck };
|
|
74
|
+
//# sourceMappingURL=checks.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks.d.mts","names":[],"sources":["../../../src/generative-ui/standard/checks.ts"],"mappings":";;;;;AAAwB;;;;;cAWlB,QAAA,EAAQ,CAAA,CAAA,OAAA;;UAYG,WAAA;EACf,OAAA;EAAA;EAEA,QAAA,EAAU,CAAA,CAAE,MAAA,QAAc,QAAA;EAAhB;EAEV,IAAA;AAAA;AAAA,cAGW,UAAA,EAAU,CAAA,CAAA,WAAA,CAAA,CAAA,CAAA,QAAA,CAAA,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkBX,cAAA,GAAiB,CAAA,CAAE,MAAA,QAAc,UAAA;;;;;;;;;;iBAW7B,gBAAA,CACd,MAAA,EAAQ,cAAA,GACP,WAAA;;iBAwBa,iBAAA,CAAkB,QAAA,EAAU,WAAA"}
|