@copilotkit/shared 2.0.0-rc.30 → 2.0.0-rc.32
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/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 +315 -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 +312 -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 +16 -0
- package/dist/generative-ui/catalog/json-schema.cjs.map +1 -0
- package/dist/generative-ui/catalog/json-schema.d.cts +12 -0
- package/dist/generative-ui/catalog/json-schema.d.cts.map +1 -0
- package/dist/generative-ui/catalog/json-schema.d.mts +12 -0
- package/dist/generative-ui/catalog/json-schema.d.mts.map +1 -0
- package/dist/generative-ui/catalog/json-schema.mjs +16 -0
- package/dist/generative-ui/catalog/json-schema.mjs.map +1 -0
- package/dist/generative-ui/catalog/refs.cjs +21 -0
- package/dist/generative-ui/catalog/refs.cjs.map +1 -0
- package/dist/generative-ui/catalog/refs.d.cts +55 -0
- package/dist/generative-ui/catalog/refs.d.cts.map +1 -0
- package/dist/generative-ui/catalog/refs.d.mts +55 -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 +62 -0
- package/dist/generative-ui/standard/chart.d.cts.map +1 -0
- package/dist/generative-ui/standard/chart.d.mts +62 -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 +56 -0
- package/dist/generative-ui/standard/checks.d.cts.map +1 -0
- package/dist/generative-ui/standard/checks.d.mts +56 -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 +233 -0
- package/dist/generative-ui/standard/composites.d.cts.map +1 -0
- package/dist/generative-ui/standard/composites.d.mts +233 -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 +365 -0
- package/dist/generative-ui/standard/data.d.cts.map +1 -0
- package/dist/generative-ui/standard/data.d.mts +365 -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 +2570 -0
- package/dist/generative-ui/standard/declarations.d.cts.map +1 -0
- package/dist/generative-ui/standard/declarations.d.mts +2571 -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 +133 -0
- package/dist/generative-ui/standard/feedback.d.cts.map +1 -0
- package/dist/generative-ui/standard/feedback.d.mts +133 -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 +1128 -0
- package/dist/generative-ui/standard/inputs.d.cts.map +1 -0
- package/dist/generative-ui/standard/inputs.d.mts +1128 -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 +1974 -0
- package/dist/generative-ui/standard/layout.d.cts.map +1 -0
- package/dist/generative-ui/standard/layout.d.mts +1975 -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 +31 -0
- package/dist/generative-ui/standard/map.d.cts.map +1 -0
- package/dist/generative-ui/standard/map.d.mts +31 -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 +396 -0
- package/dist/generative-ui/standard/media.d.cts.map +1 -0
- package/dist/generative-ui/standard/media.d.mts +396 -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 +522 -0
- package/dist/generative-ui/standard/text.d.cts.map +1 -0
- package/dist/generative-ui/standard/text.d.mts +522 -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 +2 -2
- 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/generative-ui/base.ts +9 -0
- package/src/generative-ui/catalog/catalog-export.ts +478 -0
- package/src/generative-ui/catalog/catalog.ts +1167 -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 +14 -0
- package/src/generative-ui/catalog/refs.ts +87 -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 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.d.mts","names":[],"sources":["../../../src/generative-ui/standard/layout.ts"],"mappings":";;;;;;cAKa,SAAA,EAAS,CAAA,CAAA,QAAA,WAAA,CAAA,CAAA,SAAA,EAAA,CAAA,CAAA,SAAA;;cAGT,UAAA,EAAU,CAAA,CAAA,WAAA,CAAA,CAAA,CAAA,SAAA;AAAA,cAKV,WAAA,EAAW,CAAA,CAAA,QAAA,WAAA,CAAA,CAAA,OAAA;;;;;;;;;;;;;;;;;;;;;;cAiBX,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAwCP,YAAA,EAAY,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAGL,OAAA,EAAO,CAAA,CAAA,SAAA,KAAA,CAAA,CAAA,IAAA,CAAA,MAAA;;;;;cAMP,aAAA;EAAA;;yBAMH,CAAA,CAAA,SAAA,KAAA,CAAA,CAAA,IAAA,CAAA,MAAA;EAAA;AAAA;AAAA,KA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cACZ,UAAA,EAAU,CAAA,CAAA,SAAA;;;;;;;;cAiBV,aAAA,EAAa,CAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;cAkBb,kBAAA"}
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { child } from "../catalog/refs.mjs";
|
|
2
|
+
import { ALIGN, BORDER_COLORS, JUSTIFY, RADII, WRAP } from "./tokens.mjs";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/generative-ui/standard/layout.ts
|
|
6
|
+
/** A number is a count of 4px steps. A string is raw CSS. */
|
|
7
|
+
const sizeValue = z.union([z.number(), z.string()]);
|
|
8
|
+
/** The A2UI `weight`: how much of the free space of a Row or Column to take. */
|
|
9
|
+
const weightProp = z.number().optional().describe("flex-grow in a Row or Column");
|
|
10
|
+
const radiusValue = z.union([
|
|
11
|
+
z.enum(RADII),
|
|
12
|
+
z.number(),
|
|
13
|
+
z.string(),
|
|
14
|
+
z.object({
|
|
15
|
+
topLeft: z.string().optional(),
|
|
16
|
+
topRight: z.string().optional(),
|
|
17
|
+
bottomLeft: z.string().optional(),
|
|
18
|
+
bottomRight: z.string().optional()
|
|
19
|
+
})
|
|
20
|
+
]);
|
|
21
|
+
/**
|
|
22
|
+
* The layout props of every container. Spread them into a props schema:
|
|
23
|
+
* `z.object({ ...layoutProps, variant: ... })`. The children of a container
|
|
24
|
+
* are a slot, not a prop.
|
|
25
|
+
*/
|
|
26
|
+
const layoutProps = {
|
|
27
|
+
align: z.enum(ALIGN).optional(),
|
|
28
|
+
justify: z.enum(JUSTIFY).optional(),
|
|
29
|
+
wrap: z.enum(WRAP).optional(),
|
|
30
|
+
gap: sizeValue.optional().describe("4px steps when a number"),
|
|
31
|
+
rowGap: sizeValue.optional(),
|
|
32
|
+
columnGap: sizeValue.optional(),
|
|
33
|
+
padding: sizeValue.optional().describe("4px steps when a number"),
|
|
34
|
+
background: z.string().optional().describe("Leave it unset. A surface token such as surface, surface-secondary, info, success, warning, danger, discovery, or one with -solid, or a CSS color. Only one summary panel in a Card uses \"surface-secondary\""),
|
|
35
|
+
border: z.boolean().optional(),
|
|
36
|
+
borderColor: z.enum(BORDER_COLORS).optional(),
|
|
37
|
+
radius: radiusValue.optional(),
|
|
38
|
+
width: sizeValue.optional(),
|
|
39
|
+
height: sizeValue.optional(),
|
|
40
|
+
minWidth: sizeValue.optional(),
|
|
41
|
+
maxWidth: sizeValue.optional(),
|
|
42
|
+
minHeight: sizeValue.optional(),
|
|
43
|
+
maxHeight: sizeValue.optional(),
|
|
44
|
+
flex: z.number().optional(),
|
|
45
|
+
weight: weightProp,
|
|
46
|
+
aspectRatio: z.string().optional(),
|
|
47
|
+
scrollable: z.boolean().optional(),
|
|
48
|
+
clip: z.boolean().optional(),
|
|
49
|
+
shadow: z.boolean().optional(),
|
|
50
|
+
inline: z.boolean().optional(),
|
|
51
|
+
role: z.string().optional().describe("ARIA role"),
|
|
52
|
+
flush: z.boolean().optional().describe("No padding"),
|
|
53
|
+
minSize: sizeValue.optional().describe("Minimum width and height"),
|
|
54
|
+
maxSize: sizeValue.optional().describe("Maximum width and height"),
|
|
55
|
+
disableAutoSpacing: z.boolean().optional().describe("No default gap between children")
|
|
56
|
+
};
|
|
57
|
+
const layoutSchema = z.object(layoutProps);
|
|
58
|
+
/** The arguments of a click or visibility event: none. */
|
|
59
|
+
const NO_ARGS = z.object({});
|
|
60
|
+
/**
|
|
61
|
+
* The `onVisible` event of every container: sent once, the first time the
|
|
62
|
+
* container scrolls into view.
|
|
63
|
+
*/
|
|
64
|
+
const VISIBLE_EVENT = { onVisible: {
|
|
65
|
+
description: "Sent once, the first time the container scrolls into view. Use it to load more content lazily.",
|
|
66
|
+
parameters: NO_ARGS
|
|
67
|
+
} };
|
|
68
|
+
/** The slot of every container: a list of children or a template. */
|
|
69
|
+
const CHILDREN_SLOT = { children: "multiple" };
|
|
70
|
+
const boxSchema = z.object({
|
|
71
|
+
...layoutProps,
|
|
72
|
+
direction: z.enum(["col", "row"]).optional().describe("Default \"col\"")
|
|
73
|
+
});
|
|
74
|
+
const gridSchema = z.object({
|
|
75
|
+
...layoutProps,
|
|
76
|
+
columns: z.union([z.number(), z.string()]).optional().describe("Column count or CSS template. Default 2"),
|
|
77
|
+
minChildWidth: sizeValue.optional(),
|
|
78
|
+
rows: z.union([z.number(), z.string()]).optional()
|
|
79
|
+
});
|
|
80
|
+
const gridItemSchema = z.object({
|
|
81
|
+
...layoutProps,
|
|
82
|
+
span: z.number().optional(),
|
|
83
|
+
rowSpan: z.number().optional()
|
|
84
|
+
});
|
|
85
|
+
const cardSchema = z.object({
|
|
86
|
+
...layoutProps,
|
|
87
|
+
variant: z.enum([
|
|
88
|
+
"default",
|
|
89
|
+
"outline",
|
|
90
|
+
"section",
|
|
91
|
+
"soft",
|
|
92
|
+
"elevated",
|
|
93
|
+
"transparent"
|
|
94
|
+
]).optional(),
|
|
95
|
+
shadowStyle: z.enum([
|
|
96
|
+
"none",
|
|
97
|
+
"sm",
|
|
98
|
+
"md"
|
|
99
|
+
]).optional().describe("Overrides the shadow of the variant"),
|
|
100
|
+
size: z.enum([
|
|
101
|
+
"sm",
|
|
102
|
+
"md",
|
|
103
|
+
"lg"
|
|
104
|
+
]).optional().describe("The padding preset: 8, 16 or 24px. Default \"md\"")
|
|
105
|
+
});
|
|
106
|
+
const flowSchema = z.object({
|
|
107
|
+
...layoutProps,
|
|
108
|
+
columns: z.number().optional(),
|
|
109
|
+
rows: z.number().optional(),
|
|
110
|
+
layout: z.enum(["pack", "fixed"]).optional().describe("Default \"pack\"")
|
|
111
|
+
});
|
|
112
|
+
const flowItemSchema = z.object({
|
|
113
|
+
...layoutProps,
|
|
114
|
+
span: z.number().optional(),
|
|
115
|
+
rowSpan: z.number().optional(),
|
|
116
|
+
aspectRatio: z.string().optional().describe("Default \"1 / 1\""),
|
|
117
|
+
aspectMode: z.enum(["soft", "fixed"]).optional()
|
|
118
|
+
});
|
|
119
|
+
const carouselSchema = z.object({
|
|
120
|
+
...layoutProps,
|
|
121
|
+
label: z.string().optional().describe("A short name of the carousel for screen readers"),
|
|
122
|
+
visibleItems: z.number().optional(),
|
|
123
|
+
showArrows: z.boolean().optional().describe("Default true"),
|
|
124
|
+
activeIndex: z.number().optional().describe("The index of the slide in view. Bind it with { \"@path\": \"/x\" } to read or set it"),
|
|
125
|
+
previousLabel: z.string().optional().describe("Default \"Previous\""),
|
|
126
|
+
nextLabel: z.string().optional().describe("Default \"Next\""),
|
|
127
|
+
snap: z.enum([
|
|
128
|
+
"none",
|
|
129
|
+
"proximity",
|
|
130
|
+
"mandatory"
|
|
131
|
+
]).optional(),
|
|
132
|
+
snapAlign: z.enum([
|
|
133
|
+
"start",
|
|
134
|
+
"center",
|
|
135
|
+
"end"
|
|
136
|
+
]).optional()
|
|
137
|
+
});
|
|
138
|
+
const CAROUSEL_MEDIA_SIZES = [
|
|
139
|
+
"sm",
|
|
140
|
+
"md",
|
|
141
|
+
"lg"
|
|
142
|
+
];
|
|
143
|
+
const carouselMediaItemSchema = z.object({
|
|
144
|
+
...layoutProps,
|
|
145
|
+
url: z.string().describe("Image URL"),
|
|
146
|
+
description: z.string().optional().describe("What the image shows, for screen readers"),
|
|
147
|
+
size: z.enum(CAROUSEL_MEDIA_SIZES).optional().describe("The width: \"sm\" 160px, \"md\" 240px, \"lg\" 320px. Default \"md\""),
|
|
148
|
+
aspectRatio: z.string().optional().describe("Default \"4 / 3\""),
|
|
149
|
+
href: z.string().optional().describe("Opens this URL in a new tab"),
|
|
150
|
+
lightbox: z.boolean().optional().describe("Default true: a click opens all slides full-screen")
|
|
151
|
+
});
|
|
152
|
+
const spacerSchema = z.object({ minSize: sizeValue.optional() });
|
|
153
|
+
const tabsSchema = z.object({
|
|
154
|
+
tabs: z.array(z.object({
|
|
155
|
+
title: z.string().describe("The tab title"),
|
|
156
|
+
child: child("The id of the panel component")
|
|
157
|
+
})).describe("One entry per tab"),
|
|
158
|
+
selectedIndex: z.number().optional().describe("The open tab. Default 0. Bind it with { \"@path\": \"/x\" } to read it"),
|
|
159
|
+
weight: weightProp
|
|
160
|
+
});
|
|
161
|
+
const dividerSchema = z.object({
|
|
162
|
+
axis: z.enum(["horizontal", "vertical"]).optional().describe("Default \"horizontal\""),
|
|
163
|
+
weight: weightProp,
|
|
164
|
+
color: z.enum(BORDER_COLORS).optional(),
|
|
165
|
+
size: z.number().optional(),
|
|
166
|
+
spacing: sizeValue.optional(),
|
|
167
|
+
flush: z.boolean().optional()
|
|
168
|
+
});
|
|
169
|
+
/**
|
|
170
|
+
* The standard layout components, without their framework components:
|
|
171
|
+
* containers, Spacer and Divider. Every container has a "multiple"
|
|
172
|
+
* `children` slot, so it takes a list of child ids or a template
|
|
173
|
+
* `{ componentId, path }`.
|
|
174
|
+
*/
|
|
175
|
+
const layoutDeclarations = {
|
|
176
|
+
Box: {
|
|
177
|
+
description: "A flex container. It stacks its children in a column (direction \"row\" puts them in a row). Use it to group children with gap, padding, border, radius or background.",
|
|
178
|
+
props: boxSchema,
|
|
179
|
+
events: VISIBLE_EVENT,
|
|
180
|
+
slots: CHILDREN_SLOT
|
|
181
|
+
},
|
|
182
|
+
Column: {
|
|
183
|
+
description: "A vertical flex container. Its default gap already separates sections, so do not add padding, background or a Spacer for space.",
|
|
184
|
+
props: layoutSchema,
|
|
185
|
+
events: VISIBLE_EVENT,
|
|
186
|
+
slots: CHILDREN_SLOT
|
|
187
|
+
},
|
|
188
|
+
Row: {
|
|
189
|
+
description: "A horizontal flex container. Label and value pair: justify \"spaceBetween\", a Caption left and a Text with fontWeight \"medium\" right. Buttons go in a Row at the bottom of a Card: one variant \"primary\", the others default or \"borderless\".",
|
|
190
|
+
props: layoutSchema,
|
|
191
|
+
events: VISIBLE_EVENT,
|
|
192
|
+
slots: CHILDREN_SLOT
|
|
193
|
+
},
|
|
194
|
+
Grid: {
|
|
195
|
+
description: "A CSS grid container. On a narrow screen, its columns collapse towards one column.",
|
|
196
|
+
props: gridSchema,
|
|
197
|
+
events: VISIBLE_EVENT,
|
|
198
|
+
slots: CHILDREN_SLOT
|
|
199
|
+
},
|
|
200
|
+
GridItem: {
|
|
201
|
+
description: "A cell of a Grid, with an optional span. A span that covers all rendered columns fills the row.",
|
|
202
|
+
props: gridItemSchema,
|
|
203
|
+
events: VISIBLE_EVENT,
|
|
204
|
+
slots: CHILDREN_SLOT
|
|
205
|
+
},
|
|
206
|
+
Card: {
|
|
207
|
+
description: "A bordered panel, only for an interactive panel (controls, a form, a configurator); tables, charts and text need none. Give it a Title and a Caption. Separate groups with a Divider or the gap, never a nested Card or bordered Box. Variant \"section\": no box; \"outline\": always a box. In markdown mode, without controls it renders as \"section\" unless variant or border is set.",
|
|
208
|
+
props: cardSchema,
|
|
209
|
+
events: VISIBLE_EVENT,
|
|
210
|
+
slots: {
|
|
211
|
+
child: "single",
|
|
212
|
+
children: "multiple"
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
Flow: {
|
|
216
|
+
description: "A masonry-like grid that packs cells of different sizes. Put FlowItem children in it.",
|
|
217
|
+
props: flowSchema,
|
|
218
|
+
events: VISIBLE_EVENT,
|
|
219
|
+
slots: CHILDREN_SLOT
|
|
220
|
+
},
|
|
221
|
+
FlowItem: {
|
|
222
|
+
description: "A cell of a Flow, with an optional span.",
|
|
223
|
+
props: flowItemSchema,
|
|
224
|
+
events: VISIBLE_EVENT,
|
|
225
|
+
slots: CHILDREN_SLOT
|
|
226
|
+
},
|
|
227
|
+
Carousel: {
|
|
228
|
+
description: "A horizontally scrolling row that snaps to its CarouselItem or CarouselMediaItem children, with arrows. Bind activeIndex to read or set the slide in view.",
|
|
229
|
+
props: carouselSchema,
|
|
230
|
+
events: VISIBLE_EVENT,
|
|
231
|
+
slots: CHILDREN_SLOT,
|
|
232
|
+
writable: ["activeIndex"]
|
|
233
|
+
},
|
|
234
|
+
CarouselItem: {
|
|
235
|
+
description: "A slide of a Carousel.",
|
|
236
|
+
props: layoutSchema,
|
|
237
|
+
events: VISIBLE_EVENT,
|
|
238
|
+
slots: CHILDREN_SLOT
|
|
239
|
+
},
|
|
240
|
+
CarouselMediaItem: {
|
|
241
|
+
description: "A Carousel slide: an image with its children (a Caption, a Text) under it. size \"sm\" 160px, \"md\" 240px (default), \"lg\" 320px wide. A click opens all slides full-screen, unless href or onClick is set.",
|
|
242
|
+
props: carouselMediaItemSchema,
|
|
243
|
+
events: {
|
|
244
|
+
...VISIBLE_EVENT,
|
|
245
|
+
onClick: {
|
|
246
|
+
description: "Sent when the user clicks the image. It replaces the full-screen view.",
|
|
247
|
+
parameters: NO_ARGS
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
slots: CHILDREN_SLOT
|
|
251
|
+
},
|
|
252
|
+
Spacer: {
|
|
253
|
+
description: "Flexible empty space. You almost never need it: use the default gap.",
|
|
254
|
+
props: spacerSchema
|
|
255
|
+
},
|
|
256
|
+
Divider: {
|
|
257
|
+
description: "A line between two groups: horizontal, or vertical with axis \"vertical\" in a Row.",
|
|
258
|
+
props: dividerSchema
|
|
259
|
+
},
|
|
260
|
+
Tabs: {
|
|
261
|
+
description: "Tabs that show one panel at a time. Each tab has a title and the id of its panel component: \"tabs\":[{\"title\":\"Specs\",\"child\":\"specs\"}].",
|
|
262
|
+
props: tabsSchema,
|
|
263
|
+
writable: ["selectedIndex"]
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
//#endregion
|
|
268
|
+
export { CAROUSEL_MEDIA_SIZES, CHILDREN_SLOT, NO_ARGS, VISIBLE_EVENT, boxSchema, cardSchema, carouselMediaItemSchema, carouselSchema, dividerSchema, flowItemSchema, flowSchema, gridItemSchema, gridSchema, layoutDeclarations, layoutProps, radiusValue, sizeValue, spacerSchema, tabsSchema, weightProp };
|
|
269
|
+
//# sourceMappingURL=layout.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.mjs","names":[],"sources":["../../../src/generative-ui/standard/layout.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { child } from \"../catalog/refs\";\nimport { ALIGN, BORDER_COLORS, JUSTIFY, RADII, WRAP } from \"./tokens\";\n\n/** A number is a count of 4px steps. A string is raw CSS. */\nexport const sizeValue = z.union([z.number(), z.string()]);\n\n/** The A2UI `weight`: how much of the free space of a Row or Column to take. */\nexport const weightProp = z\n .number()\n .optional()\n .describe(\"flex-grow in a Row or Column\");\n\nexport const radiusValue = z.union([\n z.enum(RADII),\n z.number(),\n z.string(),\n z.object({\n topLeft: z.string().optional(),\n topRight: z.string().optional(),\n bottomLeft: z.string().optional(),\n bottomRight: z.string().optional(),\n }),\n]);\n\n/**\n * The layout props of every container. Spread them into a props schema:\n * `z.object({ ...layoutProps, variant: ... })`. The children of a container\n * are a slot, not a prop.\n */\nexport const layoutProps = {\n align: z.enum(ALIGN).optional(),\n justify: z.enum(JUSTIFY).optional(),\n wrap: z.enum(WRAP).optional(),\n gap: sizeValue.optional().describe(\"4px steps when a number\"),\n rowGap: sizeValue.optional(),\n columnGap: sizeValue.optional(),\n padding: sizeValue.optional().describe(\"4px steps when a number\"),\n background: z\n .string()\n .optional()\n .describe(\n 'Leave it unset. A surface token such as surface, surface-secondary, info, success, warning, danger, discovery, or one with -solid, or a CSS color. Only one summary panel in a Card uses \"surface-secondary\"',\n ),\n border: z.boolean().optional(),\n borderColor: z.enum(BORDER_COLORS).optional(),\n radius: radiusValue.optional(),\n width: sizeValue.optional(),\n height: sizeValue.optional(),\n minWidth: sizeValue.optional(),\n maxWidth: sizeValue.optional(),\n minHeight: sizeValue.optional(),\n maxHeight: sizeValue.optional(),\n flex: z.number().optional(),\n weight: weightProp,\n aspectRatio: z.string().optional(),\n scrollable: z.boolean().optional(),\n clip: z.boolean().optional(),\n shadow: z.boolean().optional(),\n inline: z.boolean().optional(),\n role: z.string().optional().describe(\"ARIA role\"),\n flush: z.boolean().optional().describe(\"No padding\"),\n minSize: sizeValue.optional().describe(\"Minimum width and height\"),\n maxSize: sizeValue.optional().describe(\"Maximum width and height\"),\n disableAutoSpacing: z\n .boolean()\n .optional()\n .describe(\"No default gap between children\"),\n};\n\nconst layoutSchema = z.object(layoutProps);\n\n/** The arguments of a click or visibility event: none. */\nexport const NO_ARGS = z.object({});\n\n/**\n * The `onVisible` event of every container: sent once, the first time the\n * container scrolls into view.\n */\nexport const VISIBLE_EVENT = {\n onVisible: {\n description:\n \"Sent once, the first time the container scrolls into view. Use it to load more content lazily.\",\n parameters: NO_ARGS,\n },\n} as const;\n\nexport type LayoutProps = z.output<typeof layoutSchema>;\n\n/** The slot of every container: a list of children or a template. */\nexport const CHILDREN_SLOT = { children: \"multiple\" } as const;\n\nexport const boxSchema = z.object({\n ...layoutProps,\n direction: z.enum([\"col\", \"row\"]).optional().describe('Default \"col\"'),\n});\nexport const gridSchema = z.object({\n ...layoutProps,\n columns: z\n .union([z.number(), z.string()])\n .optional()\n .describe(\"Column count or CSS template. Default 2\"),\n minChildWidth: sizeValue.optional(),\n rows: z.union([z.number(), z.string()]).optional(),\n});\nexport const gridItemSchema = z.object({\n ...layoutProps,\n span: z.number().optional(),\n rowSpan: z.number().optional(),\n});\nexport const cardSchema = z.object({\n ...layoutProps,\n variant: z\n .enum([\"default\", \"outline\", \"section\", \"soft\", \"elevated\", \"transparent\"])\n .optional(),\n shadowStyle: z\n .enum([\"none\", \"sm\", \"md\"])\n .optional()\n .describe(\"Overrides the shadow of the variant\"),\n size: z\n .enum([\"sm\", \"md\", \"lg\"])\n .optional()\n .describe('The padding preset: 8, 16 or 24px. Default \"md\"'),\n});\nexport const flowSchema = z.object({\n ...layoutProps,\n columns: z.number().optional(),\n rows: z.number().optional(),\n layout: z.enum([\"pack\", \"fixed\"]).optional().describe('Default \"pack\"'),\n});\nexport const flowItemSchema = z.object({\n ...layoutProps,\n span: z.number().optional(),\n rowSpan: z.number().optional(),\n aspectRatio: z.string().optional().describe('Default \"1 / 1\"'),\n aspectMode: z.enum([\"soft\", \"fixed\"]).optional(),\n});\nexport const carouselSchema = z.object({\n ...layoutProps,\n label: z\n .string()\n .optional()\n .describe(\"A short name of the carousel for screen readers\"),\n visibleItems: z.number().optional(),\n showArrows: z.boolean().optional().describe(\"Default true\"),\n activeIndex: z\n .number()\n .optional()\n .describe(\n 'The index of the slide in view. Bind it with { \"@path\": \"/x\" } to read or set it',\n ),\n previousLabel: z.string().optional().describe('Default \"Previous\"'),\n nextLabel: z.string().optional().describe('Default \"Next\"'),\n snap: z.enum([\"none\", \"proximity\", \"mandatory\"]).optional(),\n snapAlign: z.enum([\"start\", \"center\", \"end\"]).optional(),\n});\nexport const CAROUSEL_MEDIA_SIZES = [\"sm\", \"md\", \"lg\"] as const;\nexport const carouselMediaItemSchema = z.object({\n ...layoutProps,\n url: z.string().describe(\"Image URL\"),\n description: z\n .string()\n .optional()\n .describe(\"What the image shows, for screen readers\"),\n size: z\n .enum(CAROUSEL_MEDIA_SIZES)\n .optional()\n .describe('The width: \"sm\" 160px, \"md\" 240px, \"lg\" 320px. Default \"md\"'),\n aspectRatio: z.string().optional().describe('Default \"4 / 3\"'),\n href: z.string().optional().describe(\"Opens this URL in a new tab\"),\n lightbox: z\n .boolean()\n .optional()\n .describe(\"Default true: a click opens all slides full-screen\"),\n});\nexport const spacerSchema = z.object({ minSize: sizeValue.optional() });\nexport const tabsSchema = z.object({\n tabs: z\n .array(\n z.object({\n title: z.string().describe(\"The tab title\"),\n child: child(\"The id of the panel component\"),\n }),\n )\n .describe(\"One entry per tab\"),\n selectedIndex: z\n .number()\n .optional()\n .describe(\n 'The open tab. Default 0. Bind it with { \"@path\": \"/x\" } to read it',\n ),\n weight: weightProp,\n});\nexport const dividerSchema = z.object({\n axis: z\n .enum([\"horizontal\", \"vertical\"])\n .optional()\n .describe('Default \"horizontal\"'),\n weight: weightProp,\n color: z.enum(BORDER_COLORS).optional(),\n size: z.number().optional(),\n spacing: sizeValue.optional(),\n flush: z.boolean().optional(),\n});\n\n/**\n * The standard layout components, without their framework components:\n * containers, Spacer and Divider. Every container has a \"multiple\"\n * `children` slot, so it takes a list of child ids or a template\n * `{ componentId, path }`.\n */\nexport const layoutDeclarations = {\n Box: {\n description:\n 'A flex container. It stacks its children in a column (direction \"row\" puts them in a row). Use it to group children with gap, padding, border, radius or background.',\n props: boxSchema,\n events: VISIBLE_EVENT,\n slots: CHILDREN_SLOT,\n },\n Column: {\n description:\n \"A vertical flex container. Its default gap already separates sections, so do not add padding, background or a Spacer for space.\",\n props: layoutSchema,\n events: VISIBLE_EVENT,\n slots: CHILDREN_SLOT,\n },\n Row: {\n description:\n 'A horizontal flex container. Label and value pair: justify \"spaceBetween\", a Caption left and a Text with fontWeight \"medium\" right. Buttons go in a Row at the bottom of a Card: one variant \"primary\", the others default or \"borderless\".',\n props: layoutSchema,\n events: VISIBLE_EVENT,\n slots: CHILDREN_SLOT,\n },\n Grid: {\n description:\n \"A CSS grid container. On a narrow screen, its columns collapse towards one column.\",\n props: gridSchema,\n events: VISIBLE_EVENT,\n slots: CHILDREN_SLOT,\n },\n GridItem: {\n description:\n \"A cell of a Grid, with an optional span. A span that covers all rendered columns fills the row.\",\n props: gridItemSchema,\n events: VISIBLE_EVENT,\n slots: CHILDREN_SLOT,\n },\n Card: {\n description:\n 'A bordered panel, only for an interactive panel (controls, a form, a configurator); tables, charts and text need none. Give it a Title and a Caption. Separate groups with a Divider or the gap, never a nested Card or bordered Box. Variant \"section\": no box; \"outline\": always a box. In markdown mode, without controls it renders as \"section\" unless variant or border is set.',\n props: cardSchema,\n events: VISIBLE_EVENT,\n slots: { child: \"single\", children: \"multiple\" } as const,\n },\n Flow: {\n description:\n \"A masonry-like grid that packs cells of different sizes. Put FlowItem children in it.\",\n props: flowSchema,\n events: VISIBLE_EVENT,\n slots: CHILDREN_SLOT,\n },\n FlowItem: {\n description: \"A cell of a Flow, with an optional span.\",\n props: flowItemSchema,\n events: VISIBLE_EVENT,\n slots: CHILDREN_SLOT,\n },\n Carousel: {\n description:\n \"A horizontally scrolling row that snaps to its CarouselItem or CarouselMediaItem children, with arrows. Bind activeIndex to read or set the slide in view.\",\n props: carouselSchema,\n events: VISIBLE_EVENT,\n slots: CHILDREN_SLOT,\n writable: [\"activeIndex\"] as const,\n },\n CarouselItem: {\n description: \"A slide of a Carousel.\",\n props: layoutSchema,\n events: VISIBLE_EVENT,\n slots: CHILDREN_SLOT,\n },\n CarouselMediaItem: {\n description:\n 'A Carousel slide: an image with its children (a Caption, a Text) under it. size \"sm\" 160px, \"md\" 240px (default), \"lg\" 320px wide. A click opens all slides full-screen, unless href or onClick is set.',\n props: carouselMediaItemSchema,\n events: {\n ...VISIBLE_EVENT,\n onClick: {\n description:\n \"Sent when the user clicks the image. It replaces the full-screen view.\",\n parameters: NO_ARGS,\n },\n },\n slots: CHILDREN_SLOT,\n },\n Spacer: {\n description:\n \"Flexible empty space. You almost never need it: use the default gap.\",\n props: spacerSchema,\n },\n Divider: {\n description:\n 'A line between two groups: horizontal, or vertical with axis \"vertical\" in a Row.',\n props: dividerSchema,\n },\n Tabs: {\n description:\n 'Tabs that show one panel at a time. Each tab has a title and the id of its panel component: \"tabs\":[{\"title\":\"Specs\",\"child\":\"specs\"}].',\n props: tabsSchema,\n writable: [\"selectedIndex\"] as const,\n },\n};\n"],"mappings":";;;;;;AAKA,MAAa,YAAY,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC;;AAG1D,MAAa,aAAa,EACvB,QAAQ,CACR,UAAU,CACV,SAAS,+BAA+B;AAE3C,MAAa,cAAc,EAAE,MAAM;CACjC,EAAE,KAAK,MAAM;CACb,EAAE,QAAQ;CACV,EAAE,QAAQ;CACV,EAAE,OAAO;EACP,SAAS,EAAE,QAAQ,CAAC,UAAU;EAC9B,UAAU,EAAE,QAAQ,CAAC,UAAU;EAC/B,YAAY,EAAE,QAAQ,CAAC,UAAU;EACjC,aAAa,EAAE,QAAQ,CAAC,UAAU;EACnC,CAAC;CACH,CAAC;;;;;;AAOF,MAAa,cAAc;CACzB,OAAO,EAAE,KAAK,MAAM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E;EACF,OAAO;EACR;CACD,MAAM;EACJ,aACE;EACF,OAAO;EACP,UAAU,CAAC,gBAAgB;EAC5B;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
let zod = require("zod");
|
|
3
|
+
|
|
4
|
+
//#region src/generative-ui/standard/map.ts
|
|
5
|
+
const mapMarker = zod.z.object({
|
|
6
|
+
label: zod.z.string(),
|
|
7
|
+
lat: zod.z.number(),
|
|
8
|
+
lng: zod.z.number(),
|
|
9
|
+
category: zod.z.string().optional(),
|
|
10
|
+
icon: zod.z.string().optional()
|
|
11
|
+
});
|
|
12
|
+
const mapSchema = zod.z.object({
|
|
13
|
+
markers: zod.z.array(mapMarker).optional(),
|
|
14
|
+
route: zod.z.boolean().optional().describe("Draws a line through the markers in order"),
|
|
15
|
+
selected: zod.z.string().optional().describe("The label of the selected marker. Bind it with { \"@path\": \"/x\" } to read the choice of the user"),
|
|
16
|
+
height: zod.z.number().optional().describe("Pixels. Default 240"),
|
|
17
|
+
zoom: zod.z.number().optional().describe("With two or more markers, only the highest zoom of the fit"),
|
|
18
|
+
center: zod.z.object({
|
|
19
|
+
lat: zod.z.number(),
|
|
20
|
+
lng: zod.z.number()
|
|
21
|
+
}).optional()
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
//#endregion
|
|
25
|
+
exports.mapMarker = mapMarker;
|
|
26
|
+
exports.mapSchema = mapSchema;
|
|
27
|
+
//# sourceMappingURL=map.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.cjs","names":["z"],"sources":["../../../src/generative-ui/standard/map.ts"],"sourcesContent":["import { z } from \"zod\";\n\n// ---- Schema ----\n\nexport const mapMarker = z.object({\n label: z.string(),\n lat: z.number(),\n lng: z.number(),\n category: z.string().optional(),\n icon: z.string().optional(),\n});\nexport type MapMarker = z.output<typeof mapMarker>;\n\nexport const mapSchema = z.object({\n markers: z.array(mapMarker).optional(),\n route: z\n .boolean()\n .optional()\n .describe(\"Draws a line through the markers in order\"),\n selected: z\n .string()\n .optional()\n .describe(\n 'The label of the selected marker. Bind it with { \"@path\": \"/x\" } to read the choice of the user',\n ),\n height: z.number().optional().describe(\"Pixels. Default 240\"),\n zoom: z\n .number()\n .optional()\n .describe(\"With two or more markers, only the highest zoom of the fit\"),\n center: z.object({ lat: z.number(), lng: z.number() }).optional(),\n});\n"],"mappings":";;;;AAIA,MAAa,YAAYA,MAAE,OAAO;CAChC,OAAOA,MAAE,QAAQ;CACjB,KAAKA,MAAE,QAAQ;CACf,KAAKA,MAAE,QAAQ;CACf,UAAUA,MAAE,QAAQ,CAAC,UAAU;CAC/B,MAAMA,MAAE,QAAQ,CAAC,UAAU;CAC5B,CAAC;AAGF,MAAa,YAAYA,MAAE,OAAO;CAChC,SAASA,MAAE,MAAM,UAAU,CAAC,UAAU;CACtC,OAAOA,MACJ,SAAS,CACT,UAAU,CACV,SAAS,4CAA4C;CACxD,UAAUA,MACP,QAAQ,CACR,UAAU,CACV,SACC,sGACD;CACH,QAAQA,MAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,sBAAsB;CAC7D,MAAMA,MACH,QAAQ,CACR,UAAU,CACV,SAAS,6DAA6D;CACzE,QAAQA,MAAE,OAAO;EAAE,KAAKA,MAAE,QAAQ;EAAE,KAAKA,MAAE,QAAQ;EAAE,CAAC,CAAC,UAAU;CAClE,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/generative-ui/standard/map.d.ts
|
|
4
|
+
declare const mapMarker: z.ZodObject<{
|
|
5
|
+
label: z.ZodString;
|
|
6
|
+
lat: z.ZodNumber;
|
|
7
|
+
lng: z.ZodNumber;
|
|
8
|
+
category: z.ZodOptional<z.ZodString>;
|
|
9
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
type MapMarker = z.output<typeof mapMarker>;
|
|
12
|
+
declare const mapSchema: z.ZodObject<{
|
|
13
|
+
markers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
14
|
+
label: z.ZodString;
|
|
15
|
+
lat: z.ZodNumber;
|
|
16
|
+
lng: z.ZodNumber;
|
|
17
|
+
category: z.ZodOptional<z.ZodString>;
|
|
18
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>>>;
|
|
20
|
+
route: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
selected: z.ZodOptional<z.ZodString>;
|
|
22
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
zoom: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
center: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
lat: z.ZodNumber;
|
|
26
|
+
lng: z.ZodNumber;
|
|
27
|
+
}, z.core.$strip>>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { MapMarker, mapMarker, mapSchema };
|
|
31
|
+
//# sourceMappingURL=map.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.d.cts","names":[],"sources":["../../../src/generative-ui/standard/map.ts"],"mappings":";;;cAIa,SAAA,EAAS,CAAA,CAAA,SAAA;;;;;;;KAOV,SAAA,GAAY,CAAA,CAAE,MAAA,QAAc,SAAA;AAAA,cAE3B,SAAA,EAAS,CAAA,CAAA,SAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/generative-ui/standard/map.d.ts
|
|
4
|
+
declare const mapMarker: z.ZodObject<{
|
|
5
|
+
label: z.ZodString;
|
|
6
|
+
lat: z.ZodNumber;
|
|
7
|
+
lng: z.ZodNumber;
|
|
8
|
+
category: z.ZodOptional<z.ZodString>;
|
|
9
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
type MapMarker = z.output<typeof mapMarker>;
|
|
12
|
+
declare const mapSchema: z.ZodObject<{
|
|
13
|
+
markers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
14
|
+
label: z.ZodString;
|
|
15
|
+
lat: z.ZodNumber;
|
|
16
|
+
lng: z.ZodNumber;
|
|
17
|
+
category: z.ZodOptional<z.ZodString>;
|
|
18
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>>>;
|
|
20
|
+
route: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
selected: z.ZodOptional<z.ZodString>;
|
|
22
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
zoom: z.ZodOptional<z.ZodNumber>;
|
|
24
|
+
center: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
lat: z.ZodNumber;
|
|
26
|
+
lng: z.ZodNumber;
|
|
27
|
+
}, z.core.$strip>>;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { MapMarker, mapMarker, mapSchema };
|
|
31
|
+
//# sourceMappingURL=map.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.d.mts","names":[],"sources":["../../../src/generative-ui/standard/map.ts"],"mappings":";;;cAIa,SAAA,EAAS,CAAA,CAAA,SAAA;;;;;;;KAOV,SAAA,GAAY,CAAA,CAAE,MAAA,QAAc,SAAA;AAAA,cAE3B,SAAA,EAAS,CAAA,CAAA,SAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/generative-ui/standard/map.ts
|
|
4
|
+
const mapMarker = z.object({
|
|
5
|
+
label: z.string(),
|
|
6
|
+
lat: z.number(),
|
|
7
|
+
lng: z.number(),
|
|
8
|
+
category: z.string().optional(),
|
|
9
|
+
icon: z.string().optional()
|
|
10
|
+
});
|
|
11
|
+
const mapSchema = z.object({
|
|
12
|
+
markers: z.array(mapMarker).optional(),
|
|
13
|
+
route: z.boolean().optional().describe("Draws a line through the markers in order"),
|
|
14
|
+
selected: z.string().optional().describe("The label of the selected marker. Bind it with { \"@path\": \"/x\" } to read the choice of the user"),
|
|
15
|
+
height: z.number().optional().describe("Pixels. Default 240"),
|
|
16
|
+
zoom: z.number().optional().describe("With two or more markers, only the highest zoom of the fit"),
|
|
17
|
+
center: z.object({
|
|
18
|
+
lat: z.number(),
|
|
19
|
+
lng: z.number()
|
|
20
|
+
}).optional()
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { mapMarker, mapSchema };
|
|
25
|
+
//# sourceMappingURL=map.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map.mjs","names":[],"sources":["../../../src/generative-ui/standard/map.ts"],"sourcesContent":["import { z } from \"zod\";\n\n// ---- Schema ----\n\nexport const mapMarker = z.object({\n label: z.string(),\n lat: z.number(),\n lng: z.number(),\n category: z.string().optional(),\n icon: z.string().optional(),\n});\nexport type MapMarker = z.output<typeof mapMarker>;\n\nexport const mapSchema = z.object({\n markers: z.array(mapMarker).optional(),\n route: z\n .boolean()\n .optional()\n .describe(\"Draws a line through the markers in order\"),\n selected: z\n .string()\n .optional()\n .describe(\n 'The label of the selected marker. Bind it with { \"@path\": \"/x\" } to read the choice of the user',\n ),\n height: z.number().optional().describe(\"Pixels. Default 240\"),\n zoom: z\n .number()\n .optional()\n .describe(\"With two or more markers, only the highest zoom of the fit\"),\n center: z.object({ lat: z.number(), lng: z.number() }).optional(),\n});\n"],"mappings":";;;AAIA,MAAa,YAAY,EAAE,OAAO;CAChC,OAAO,EAAE,QAAQ;CACjB,KAAK,EAAE,QAAQ;CACf,KAAK,EAAE,QAAQ;CACf,UAAU,EAAE,QAAQ,CAAC,UAAU;CAC/B,MAAM,EAAE,QAAQ,CAAC,UAAU;CAC5B,CAAC;AAGF,MAAa,YAAY,EAAE,OAAO;CAChC,SAAS,EAAE,MAAM,UAAU,CAAC,UAAU;CACtC,OAAO,EACJ,SAAS,CACT,UAAU,CACV,SAAS,4CAA4C;CACxD,UAAU,EACP,QAAQ,CACR,UAAU,CACV,SACC,sGACD;CACH,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,sBAAsB;CAC7D,MAAM,EACH,QAAQ,CACR,UAAU,CACV,SAAS,6DAA6D;CACzE,QAAQ,EAAE,OAAO;EAAE,KAAK,EAAE,QAAQ;EAAE,KAAK,EAAE,QAAQ;EAAE,CAAC,CAAC,UAAU;CAClE,CAAC"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_tokens = require('./tokens.cjs');
|
|
3
|
+
const require_layout = require('./layout.cjs');
|
|
4
|
+
let zod = require("zod");
|
|
5
|
+
|
|
6
|
+
//#region src/generative-ui/standard/media.ts
|
|
7
|
+
const colorProp = zod.z.string().optional();
|
|
8
|
+
const ICON_SIZES = [
|
|
9
|
+
"sm",
|
|
10
|
+
"md",
|
|
11
|
+
"lg",
|
|
12
|
+
"xl"
|
|
13
|
+
];
|
|
14
|
+
const IMAGE_VARIANTS = [
|
|
15
|
+
"icon",
|
|
16
|
+
"avatar",
|
|
17
|
+
"smallFeature",
|
|
18
|
+
"mediumFeature",
|
|
19
|
+
"largeFeature",
|
|
20
|
+
"header"
|
|
21
|
+
];
|
|
22
|
+
const imageSchema = zod.z.object({
|
|
23
|
+
url: zod.z.string().describe("Image URL"),
|
|
24
|
+
description: zod.z.string().optional().describe("What the image shows, for screen readers. Leave it unset only for a decorative image"),
|
|
25
|
+
variant: zod.z.enum(IMAGE_VARIANTS).optional().describe("The size: \"icon\" 24px, \"avatar\" 40px round, \"smallFeature\" 160px wide, \"largeFeature\" and \"header\" full width. Default \"mediumFeature\": the natural size"),
|
|
26
|
+
weight: require_layout.weightProp,
|
|
27
|
+
aspectRatio: zod.z.string().optional(),
|
|
28
|
+
fit: zod.z.enum([
|
|
29
|
+
"cover",
|
|
30
|
+
"contain",
|
|
31
|
+
"fill",
|
|
32
|
+
"none",
|
|
33
|
+
"scaleDown"
|
|
34
|
+
]).optional().describe("CSS object-fit. Default \"cover\""),
|
|
35
|
+
radius: require_layout.radiusValue.optional(),
|
|
36
|
+
width: require_layout.sizeValue.optional(),
|
|
37
|
+
height: require_layout.sizeValue.optional(),
|
|
38
|
+
maxWidth: require_layout.sizeValue.optional(),
|
|
39
|
+
maxHeight: require_layout.sizeValue.optional(),
|
|
40
|
+
minWidth: require_layout.sizeValue.optional(),
|
|
41
|
+
minHeight: require_layout.sizeValue.optional(),
|
|
42
|
+
background: zod.z.string().optional(),
|
|
43
|
+
frame: zod.z.boolean().optional(),
|
|
44
|
+
position: zod.z.string().optional().describe("CSS object-position, for example \"top\" or \"50% 20%\""),
|
|
45
|
+
hideOnFailure: zod.z.boolean().optional().describe("Default false"),
|
|
46
|
+
fallback: zod.z.string().optional().describe("Text shown in place of the image when it does not load"),
|
|
47
|
+
hoverZoom: zod.z.boolean().optional().describe("A slight zoom on hover"),
|
|
48
|
+
lightbox: zod.z.boolean().optional().describe("Default true: a click opens the image full-screen"),
|
|
49
|
+
actionOverlay: zod.z.object({
|
|
50
|
+
label: zod.z.string(),
|
|
51
|
+
icon: zod.z.string().optional().describe("Lucide icon name"),
|
|
52
|
+
href: zod.z.string().optional().describe("Opens this URL in a new tab")
|
|
53
|
+
}).optional().describe("A button over the bottom-right corner of the image. Without href, it sends onOverlayClick")
|
|
54
|
+
});
|
|
55
|
+
const iconSchema = zod.z.object({
|
|
56
|
+
name: zod.z.union([zod.z.string(), zod.z.object({ svgPath: zod.z.string() })]).describe("A Lucide icon name in kebab-case (\"arrow-right\"), an A2UI icon name (\"arrowBack\"), or { \"svgPath\" } on a 24px grid"),
|
|
57
|
+
label: zod.z.string().optional().describe("What the icon means, for screen readers. Leave it unset when text next to the icon says the same"),
|
|
58
|
+
size: zod.z.union([zod.z.enum(ICON_SIZES), zod.z.number()]).optional().describe("Default \"md\""),
|
|
59
|
+
color: colorProp,
|
|
60
|
+
inline: zod.z.boolean().optional().describe("Default false"),
|
|
61
|
+
strokeWeight: zod.z.enum(require_tokens.WEIGHTS).optional().describe("The stroke width"),
|
|
62
|
+
weight: require_layout.weightProp
|
|
63
|
+
});
|
|
64
|
+
const faviconSchema = zod.z.object({
|
|
65
|
+
url: zod.z.string(),
|
|
66
|
+
alt: zod.z.string().optional(),
|
|
67
|
+
size: zod.z.number().optional().describe("Pixels. Default 16"),
|
|
68
|
+
inline: zod.z.boolean().optional().describe("Default false"),
|
|
69
|
+
frame: zod.z.boolean().optional().describe("Default false")
|
|
70
|
+
});
|
|
71
|
+
const svgSchema = zod.z.object({
|
|
72
|
+
viewBox: zod.z.string().optional(),
|
|
73
|
+
label: zod.z.string().optional().describe("What the drawing shows, for screen readers. Leave it unset for a decorative drawing"),
|
|
74
|
+
width: require_layout.sizeValue.optional(),
|
|
75
|
+
height: require_layout.sizeValue.optional(),
|
|
76
|
+
size: require_layout.sizeValue.optional(),
|
|
77
|
+
color: colorProp.describe("Default \"prose\""),
|
|
78
|
+
fill: colorProp.describe("Default \"currentColor\""),
|
|
79
|
+
stroke: colorProp,
|
|
80
|
+
strokeWidth: zod.z.number().optional(),
|
|
81
|
+
strokeLinecap: zod.z.enum([
|
|
82
|
+
"butt",
|
|
83
|
+
"round",
|
|
84
|
+
"square"
|
|
85
|
+
]).optional(),
|
|
86
|
+
strokeLinejoin: zod.z.enum([
|
|
87
|
+
"miter",
|
|
88
|
+
"round",
|
|
89
|
+
"bevel"
|
|
90
|
+
]).optional(),
|
|
91
|
+
preserveAspectRatio: zod.z.string().optional(),
|
|
92
|
+
paths: zod.z.array(zod.z.object({
|
|
93
|
+
d: zod.z.string(),
|
|
94
|
+
fill: colorProp,
|
|
95
|
+
stroke: colorProp,
|
|
96
|
+
strokeWidth: zod.z.number().optional()
|
|
97
|
+
})).optional(),
|
|
98
|
+
circles: zod.z.array(zod.z.object({
|
|
99
|
+
cx: zod.z.number(),
|
|
100
|
+
cy: zod.z.number(),
|
|
101
|
+
r: zod.z.number(),
|
|
102
|
+
fill: colorProp,
|
|
103
|
+
stroke: colorProp
|
|
104
|
+
})).optional(),
|
|
105
|
+
rects: zod.z.array(zod.z.object({
|
|
106
|
+
x: zod.z.number(),
|
|
107
|
+
y: zod.z.number(),
|
|
108
|
+
width: zod.z.number(),
|
|
109
|
+
height: zod.z.number(),
|
|
110
|
+
rx: zod.z.number().optional(),
|
|
111
|
+
fill: colorProp,
|
|
112
|
+
stroke: colorProp
|
|
113
|
+
})).optional(),
|
|
114
|
+
lines: zod.z.array(zod.z.object({
|
|
115
|
+
x1: zod.z.number(),
|
|
116
|
+
y1: zod.z.number(),
|
|
117
|
+
x2: zod.z.number(),
|
|
118
|
+
y2: zod.z.number(),
|
|
119
|
+
stroke: colorProp
|
|
120
|
+
})).optional(),
|
|
121
|
+
texts: zod.z.array(zod.z.object({
|
|
122
|
+
x: zod.z.number(),
|
|
123
|
+
y: zod.z.number(),
|
|
124
|
+
text: zod.z.string(),
|
|
125
|
+
size: zod.z.number().optional(),
|
|
126
|
+
fill: colorProp,
|
|
127
|
+
anchor: zod.z.enum([
|
|
128
|
+
"start",
|
|
129
|
+
"middle",
|
|
130
|
+
"end"
|
|
131
|
+
]).optional()
|
|
132
|
+
})).optional()
|
|
133
|
+
});
|
|
134
|
+
const captionTrack = zod.z.object({
|
|
135
|
+
url: zod.z.string().describe("The URL of a WebVTT file"),
|
|
136
|
+
language: zod.z.string().optional().describe("BCP 47, for example \"en\""),
|
|
137
|
+
label: zod.z.string().optional().describe("Shown in the captions menu"),
|
|
138
|
+
kind: zod.z.enum([
|
|
139
|
+
"subtitles",
|
|
140
|
+
"captions",
|
|
141
|
+
"descriptions"
|
|
142
|
+
]).optional()
|
|
143
|
+
});
|
|
144
|
+
const videoSchema = zod.z.object({
|
|
145
|
+
url: zod.z.string().describe("The URL of a video file, or of a YouTube video or short. A page on another video site shows as a link"),
|
|
146
|
+
posterUrl: zod.z.string().optional().describe("The image shown before the video plays"),
|
|
147
|
+
title: zod.z.string().optional().describe("Names the video for screen readers"),
|
|
148
|
+
captions: zod.z.array(captionTrack).optional().describe("Caption tracks of a video file"),
|
|
149
|
+
aspectRatio: zod.z.string().optional().describe("Default \"16 / 9\""),
|
|
150
|
+
width: require_layout.sizeValue.optional().describe("Default \"100%\""),
|
|
151
|
+
maxWidth: require_layout.sizeValue.optional().describe("Default \"100%\""),
|
|
152
|
+
weight: require_layout.weightProp
|
|
153
|
+
});
|
|
154
|
+
const audioPlayerSchema = zod.z.object({
|
|
155
|
+
url: zod.z.string().describe("The URL of the audio file"),
|
|
156
|
+
description: zod.z.string().optional().describe("A title or summary of the audio, shown above the player"),
|
|
157
|
+
weight: require_layout.weightProp
|
|
158
|
+
});
|
|
159
|
+
const htmlViewSchema = zod.z.object({
|
|
160
|
+
html: zod.z.string(),
|
|
161
|
+
height: require_layout.sizeValue.optional().describe("Pixels when a number. Default 360"),
|
|
162
|
+
width: require_layout.sizeValue.optional().describe("Default \"100%\""),
|
|
163
|
+
title: zod.z.string().optional()
|
|
164
|
+
});
|
|
165
|
+
/**
|
|
166
|
+
* The standard media components, without their framework components. Each
|
|
167
|
+
* framework adds its components with `withComponents`.
|
|
168
|
+
*/
|
|
169
|
+
const mediaDeclarations = {
|
|
170
|
+
Image: {
|
|
171
|
+
description: "An image from a URL. A click opens it full-screen. Set description to say what the image shows, unless it is only decoration.",
|
|
172
|
+
props: imageSchema,
|
|
173
|
+
events: { onOverlayClick: {
|
|
174
|
+
description: "Sent when the user clicks the actionOverlay button and it has no href.",
|
|
175
|
+
parameters: require_layout.NO_ARGS
|
|
176
|
+
} }
|
|
177
|
+
},
|
|
178
|
+
Icon: {
|
|
179
|
+
description: "A Lucide icon by kebab-case name (for example \"arrow-right\"), or an A2UI icon name (for example \"arrowBack\"). Set label when no text next to the icon says what it means.",
|
|
180
|
+
props: iconSchema
|
|
181
|
+
},
|
|
182
|
+
Favicon: {
|
|
183
|
+
description: "The favicon of the site at a URL.",
|
|
184
|
+
props: faviconSchema
|
|
185
|
+
},
|
|
186
|
+
Svg: {
|
|
187
|
+
description: "A vector drawing from primitive shapes (paths, circles, rects, lines, texts). Colors take text color tokens or CSS colors.",
|
|
188
|
+
props: svgSchema
|
|
189
|
+
},
|
|
190
|
+
Video: {
|
|
191
|
+
description: "A video file URL (optional captions) or a YouTube link, privacy-enhanced: the poster shows until play. Other video sites show as a link. Set title.",
|
|
192
|
+
props: videoSchema
|
|
193
|
+
},
|
|
194
|
+
AudioPlayer: {
|
|
195
|
+
description: "An audio player for an audio file URL, with the description above it.",
|
|
196
|
+
props: audioPlayerSchema
|
|
197
|
+
},
|
|
198
|
+
HtmlView: {
|
|
199
|
+
description: "Raw HTML in a fully sandboxed iframe: no scripts, no same-origin access. Set title to name the content.",
|
|
200
|
+
props: htmlViewSchema
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
//#endregion
|
|
205
|
+
exports.ICON_SIZES = ICON_SIZES;
|
|
206
|
+
exports.IMAGE_VARIANTS = IMAGE_VARIANTS;
|
|
207
|
+
exports.audioPlayerSchema = audioPlayerSchema;
|
|
208
|
+
exports.faviconSchema = faviconSchema;
|
|
209
|
+
exports.htmlViewSchema = htmlViewSchema;
|
|
210
|
+
exports.iconSchema = iconSchema;
|
|
211
|
+
exports.imageSchema = imageSchema;
|
|
212
|
+
exports.mediaDeclarations = mediaDeclarations;
|
|
213
|
+
exports.svgSchema = svgSchema;
|
|
214
|
+
exports.videoSchema = videoSchema;
|
|
215
|
+
//# sourceMappingURL=media.cjs.map
|