cortena-ui 1.4.1 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { A2UIComponentSpec } from "./message.js";
3
- import { A2UICatalogue, A2UIGroup } from "./catalogue.js";
3
+ import { A2UIGroup } from "./catalogue.js";
4
4
  //#region src/a2ui/catalogue-doc.d.ts
5
5
  /** A JSON Schema object, as far as this module cares. */
6
6
  export type JsonSchema = Record<string, unknown>;
@@ -28,17 +28,5 @@ export interface A2UICatalogueDoc {
28
28
  generator: string;
29
29
  components: A2UIComponentDoc[];
30
30
  }
31
- /** Build the machine-readable catalogue document. */
32
- export declare function buildCatalogueDoc(catalogue?: A2UICatalogue): A2UICatalogueDoc;
33
- /**
34
- * Render the catalogue document as markdown.
35
- *
36
- * The output is written to be pasted into a system prompt: one table per
37
- * component listing every property with its type, whether it is required and
38
- * what it means, then a fenced example an agent can copy.
39
- */
40
- export declare function catalogueMarkdown(doc?: A2UICatalogueDoc): string;
41
- /** Turn an entry's example into the messages an agent would actually send. */
42
- export declare function exampleMessages(component: A2UIComponentDoc): unknown[];
43
31
  //#endregion
44
32
  //# sourceMappingURL=catalogue-doc.d.ts.map
@@ -2,6 +2,6 @@
2
2
  import { A2UIAction, A2UIActionSpec, A2UIBeginRendering, A2UIChildList, A2UIChildren, A2UIComponentSpec, A2UICreateSurface, A2UIDataBinding, A2UIDeleteSurface, A2UIFoldResult, A2UIMessage, A2UIMessageInput, A2UIPropertyValue, A2UISurface, A2UIUpdateComponents, A2UIUpdateDataModel, A2UI_DEFAULT_SURFACE_ID, A2UI_VERSION, foldMessages, getAtPointer, isDataBinding, parseA2UIMessages, pointerSegments, readAction, readChildren, readComponent, resolvePointer, resolveValue, setAtPointer } from "./message.js";
3
3
  import { A2UIColumn, A2UIErrorCard, A2UINodeInfo, A2UIResolvedAction, A2UIRow, A2UITableSource, A2UIView, A2UIViewProps } from "./views.js";
4
4
  import { A2UICatalogue, A2UICatalogueEntry, A2UIExample, A2UIGroup, A2UI_CATALOGUE_ID, catalogueNames, defaultCatalogue } from "./catalogue.js";
5
- import { A2UICatalogueDoc, A2UIComponentDoc, JsonSchema, buildCatalogueDoc, catalogueMarkdown, exampleMessages } from "./catalogue-doc.js";
5
+ import { A2UICatalogueDoc, A2UIComponentDoc, JsonSchema } from "./catalogue-doc.js";
6
6
  import { A2UIRenderer, A2UIRendererProps } from "./renderer.js";
7
- export { type A2UIAction, type A2UIActionSpec, type A2UIBeginRendering, type A2UICatalogue, type A2UICatalogueDoc, type A2UICatalogueEntry, type A2UIChildList, type A2UIChildren, type A2UIColumn, type A2UIComponentDoc, type A2UIComponentSpec, type A2UICreateSurface, type A2UIDataBinding, type A2UIDeleteSurface, A2UIErrorCard, type A2UIExample, type A2UIFoldResult, type A2UIGroup, type A2UIMessage, type A2UIMessageInput, type A2UINodeInfo, type A2UIPropertyValue, A2UIRenderer, type A2UIRendererProps, type A2UIResolvedAction, type A2UIRow, type A2UISurface, type A2UITableSource, type A2UIUpdateComponents, type A2UIUpdateDataModel, type A2UIView, type A2UIViewProps, A2UI_CATALOGUE_ID, A2UI_DEFAULT_SURFACE_ID, A2UI_VERSION, type JsonSchema, buildCatalogueDoc, catalogueMarkdown, catalogueNames, defaultCatalogue, exampleMessages, foldMessages, getAtPointer, isDataBinding, parseA2UIMessages, pointerSegments, readAction, readChildren, readComponent, resolvePointer, resolveValue, setAtPointer };
7
+ export { type A2UIAction, type A2UIActionSpec, type A2UIBeginRendering, type A2UICatalogue, type A2UICatalogueDoc, type A2UICatalogueEntry, type A2UIChildList, type A2UIChildren, type A2UIColumn, type A2UIComponentDoc, type A2UIComponentSpec, type A2UICreateSurface, type A2UIDataBinding, type A2UIDeleteSurface, A2UIErrorCard, type A2UIExample, type A2UIFoldResult, type A2UIGroup, type A2UIMessage, type A2UIMessageInput, type A2UINodeInfo, type A2UIPropertyValue, A2UIRenderer, type A2UIRendererProps, type A2UIResolvedAction, type A2UIRow, type A2UISurface, type A2UITableSource, type A2UIUpdateComponents, type A2UIUpdateDataModel, type A2UIView, type A2UIViewProps, A2UI_CATALOGUE_ID, A2UI_DEFAULT_SURFACE_ID, A2UI_VERSION, type JsonSchema, catalogueNames, defaultCatalogue, foldMessages, getAtPointer, isDataBinding, parseA2UIMessages, pointerSegments, readAction, readChildren, readComponent, resolvePointer, resolveValue, setAtPointer };
package/dist/a2ui.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  import { A2UIAction, A2UIActionSpec, A2UIBeginRendering, A2UIChildList, A2UIChildren, A2UIComponentSpec, A2UICreateSurface, A2UIDataBinding, A2UIDeleteSurface, A2UIFoldResult, A2UIMessage, A2UIMessageInput, A2UIPropertyValue, A2UISurface, A2UIUpdateComponents, A2UIUpdateDataModel, A2UI_DEFAULT_SURFACE_ID, A2UI_VERSION, foldMessages, getAtPointer, isDataBinding, parseA2UIMessages, pointerSegments, readAction, readChildren, readComponent, resolvePointer, resolveValue, setAtPointer } from "./a2ui/message.js";
3
3
  import { A2UIColumn, A2UIErrorCard, A2UINodeInfo, A2UIResolvedAction, A2UIRow, A2UITableSource, A2UIView, A2UIViewProps } from "./a2ui/views.js";
4
4
  import { A2UICatalogue, A2UICatalogueEntry, A2UIExample, A2UIGroup, A2UI_CATALOGUE_ID, catalogueNames, defaultCatalogue } from "./a2ui/catalogue.js";
5
- import { A2UICatalogueDoc, A2UIComponentDoc, JsonSchema, buildCatalogueDoc, catalogueMarkdown, exampleMessages } from "./a2ui/catalogue-doc.js";
5
+ import { A2UICatalogueDoc, A2UIComponentDoc, JsonSchema } from "./a2ui/catalogue-doc.js";
6
6
  import { A2UIRenderer, A2UIRendererProps } from "./a2ui/renderer.js";
7
7
  import "./a2ui/index.js";
8
- export { type A2UIAction, type A2UIActionSpec, type A2UIBeginRendering, type A2UICatalogue, type A2UICatalogueDoc, type A2UICatalogueEntry, type A2UIChildList, type A2UIChildren, type A2UIColumn, type A2UIComponentDoc, type A2UIComponentSpec, type A2UICreateSurface, type A2UIDataBinding, type A2UIDeleteSurface, A2UIErrorCard, type A2UIExample, type A2UIFoldResult, type A2UIGroup, type A2UIMessage, type A2UIMessageInput, type A2UINodeInfo, type A2UIPropertyValue, A2UIRenderer, type A2UIRendererProps, type A2UIResolvedAction, type A2UIRow, type A2UISurface, type A2UITableSource, type A2UIUpdateComponents, type A2UIUpdateDataModel, type A2UIView, type A2UIViewProps, A2UI_CATALOGUE_ID, A2UI_DEFAULT_SURFACE_ID, A2UI_VERSION, type JsonSchema, buildCatalogueDoc, catalogueMarkdown, catalogueNames, defaultCatalogue, exampleMessages, foldMessages, getAtPointer, isDataBinding, parseA2UIMessages, pointerSegments, readAction, readChildren, readComponent, resolvePointer, resolveValue, setAtPointer };
8
+ export { type A2UIAction, type A2UIActionSpec, type A2UIBeginRendering, type A2UICatalogue, type A2UICatalogueDoc, type A2UICatalogueEntry, type A2UIChildList, type A2UIChildren, type A2UIColumn, type A2UIComponentDoc, type A2UIComponentSpec, type A2UICreateSurface, type A2UIDataBinding, type A2UIDeleteSurface, A2UIErrorCard, type A2UIExample, type A2UIFoldResult, type A2UIGroup, type A2UIMessage, type A2UIMessageInput, type A2UINodeInfo, type A2UIPropertyValue, A2UIRenderer, type A2UIRendererProps, type A2UIResolvedAction, type A2UIRow, type A2UISurface, type A2UITableSource, type A2UIUpdateComponents, type A2UIUpdateDataModel, type A2UIView, type A2UIViewProps, A2UI_CATALOGUE_ID, A2UI_DEFAULT_SURFACE_ID, A2UI_VERSION, type JsonSchema, catalogueNames, defaultCatalogue, foldMessages, getAtPointer, isDataBinding, parseA2UIMessages, pointerSegments, readAction, readChildren, readComponent, resolvePointer, resolveValue, setAtPointer };
package/dist/a2ui.js CHANGED
@@ -2,6 +2,5 @@
2
2
  import { A2UIErrorCard } from "./a2ui/views.js";
3
3
  import { A2UI_CATALOGUE_ID, catalogueNames, defaultCatalogue } from "./a2ui/catalogue.js";
4
4
  import { A2UI_DEFAULT_SURFACE_ID, A2UI_VERSION, foldMessages, getAtPointer, isDataBinding, parseA2UIMessages, pointerSegments, readAction, readChildren, readComponent, resolvePointer, resolveValue, setAtPointer } from "./a2ui/message.js";
5
- import { buildCatalogueDoc, catalogueMarkdown, exampleMessages } from "./a2ui/catalogue-doc.js";
6
5
  import { A2UIRenderer } from "./a2ui/renderer.js";
7
- export { A2UIErrorCard, A2UIRenderer, A2UI_CATALOGUE_ID, A2UI_DEFAULT_SURFACE_ID, A2UI_VERSION, buildCatalogueDoc, catalogueMarkdown, catalogueNames, defaultCatalogue, exampleMessages, foldMessages, getAtPointer, isDataBinding, parseA2UIMessages, pointerSegments, readAction, readChildren, readComponent, resolvePointer, resolveValue, setAtPointer };
6
+ export { A2UIErrorCard, A2UIRenderer, A2UI_CATALOGUE_ID, A2UI_DEFAULT_SURFACE_ID, A2UI_VERSION, catalogueNames, defaultCatalogue, foldMessages, getAtPointer, isDataBinding, parseA2UIMessages, pointerSegments, readAction, readChildren, readComponent, resolvePointer, resolveValue, setAtPointer };
@@ -3,7 +3,7 @@ import { VariantProps } from "class-variance-authority";
3
3
  import * as React from "react";
4
4
  //#region src/components/badge.d.ts
5
5
  declare const badgeVariants: (props?: ({
6
- variant?: "default" | "success" | "warn" | "destructive" | "danger" | "info" | "warning" | "neutral" | "secondary" | "outline" | null | undefined;
6
+ variant?: "default" | "success" | "warning" | "warn" | "destructive" | "danger" | "info" | "neutral" | "secondary" | "outline" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  export interface BadgeProps extends React.ComponentProps<"span">, VariantProps<typeof badgeVariants> {}
9
9
  declare function Badge({ className, variant, ...props }: BadgeProps): React.JSX.Element;
@@ -21,7 +21,7 @@ import { Toast } from "@base-ui/react/toast";
21
21
  * `toastManager` to `Toaster` when you need to fire toasts outside React.
22
22
  */
23
23
  declare const toastVariants: (props?: ({
24
- variant?: "default" | "success" | "destructive" | "warning" | null | undefined;
24
+ variant?: "default" | "success" | "warning" | "destructive" | null | undefined;
25
25
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
26
26
  /** The Base UI toast manager: `{ toasts, add, close, update, promise }`. */
27
27
  declare const useToast: typeof Toast.useToastManager;
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ import { useDataTable } from "./components/data-table/use-data-table.js";
9
9
  import { ExportCell, ExportSheet, downloadCsv, downloadExcel, toCsv, toSheet } from "./components/data-table/export.js";
10
10
  import { A2UIColumn, A2UIErrorCard, A2UINodeInfo, A2UIResolvedAction, A2UIRow, A2UITableSource, A2UIView, A2UIViewProps } from "./a2ui/views.js";
11
11
  import { A2UICatalogue, A2UICatalogueEntry, A2UIExample, A2UIGroup, A2UI_CATALOGUE_ID, catalogueNames, defaultCatalogue } from "./a2ui/catalogue.js";
12
- import { A2UICatalogueDoc, A2UIComponentDoc, JsonSchema, buildCatalogueDoc, catalogueMarkdown, exampleMessages } from "./a2ui/catalogue-doc.js";
12
+ import { A2UICatalogueDoc, A2UIComponentDoc, JsonSchema } from "./a2ui/catalogue-doc.js";
13
13
  import { A2UIRenderer, A2UIRendererProps } from "./a2ui/renderer.js";
14
14
  import "./a2ui.js";
15
15
  import { ChartContainer, ChartContainerProps, ChartEmpty, ChartError, ChartLegendContent, ChartLegendContentProps, ChartLoading, ChartTooltipContent, ChartTooltipContentProps, seriesColor, useChart } from "./components/chart/container.js";
@@ -73,4 +73,4 @@ import { CodeRendererProps, Markdown, MarkdownComponents as Components, Markdown
73
73
  import "./markdown.js";
74
74
  import { SortableHandle, SortableHandleProps, SortableList, SortableListProps, SortableRenderState, SortableReorderDetails, arrayMove } from "./components/sortable-list.js";
75
75
  import "./sortable-list.js";
76
- export { type A2UIAction, type A2UIActionSpec, type A2UIBeginRendering, type A2UICatalogue, type A2UICatalogueDoc, type A2UICatalogueEntry, type A2UIChildList, type A2UIChildren, type A2UIColumn, type A2UIComponentDoc, type A2UIComponentSpec, type A2UICreateSurface, type A2UIDataBinding, type A2UIDeleteSurface, A2UIErrorCard, type A2UIExample, type A2UIFoldResult, type A2UIGroup, type A2UIMessage, type A2UIMessageInput, type A2UINodeInfo, type A2UIPropertyValue, A2UIRenderer, type A2UIRendererProps, type A2UIResolvedAction, type A2UIRow, type A2UISurface, type A2UITableSource, type A2UIUpdateComponents, type A2UIUpdateDataModel, type A2UIView, type A2UIViewProps, A2UI_CATALOGUE_ID, A2UI_DEFAULT_SURFACE_ID, A2UI_VERSION, type Accept, Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertIcon, type AlertProps, AlertTitle, Area, AreaChart, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Bar, BarChart, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, type BreadcrumbLinkProps, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonLink, type ButtonLinkProps, type ButtonProps, Calendar, CalendarDayButton, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, CartesianGrid, Cell, Chart, type ChartConfig, ChartContainer, type ChartContainerProps, type ChartDataFor, type ChartDay, ChartEmpty, type ChartEngine, ChartError, type ChartLabels, ChartLegend, ChartLegendContent, type ChartLegendContentProps, ChartLoading, type ChartMatrix, type ChartPoint, type ChartProps, type ChartRenderer, type ChartRow, type ChartScale, type ChartScales, type ChartSeries, type ChartSlice, ChartTooltip, ChartTooltipContent, type ChartTooltipContentProps, type ChartTree, type ChartType, Checkbox, type CheckboxProps, Chip, type ChipProps, type ClientSource, type CodeRendererProps, Combobox, ComboboxChip, type ComboboxChipProps, ComboboxChips, type ComboboxChipsProps, ComboboxClear, ComboboxCollection, ComboboxContent, type ComboboxContentProps, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, type ComboboxInputProps, ComboboxItem, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Command, CommandDialog, type CommandDialogProps, CommandEmpty, CommandGroup, CommandInput, CommandItem, type CommandItemProps, CommandList, CommandLoading, CommandSeparator, CommandShortcut, ComposedChart, type CortenaTheme, type CortenaThemeMessage, DEFAULT_THEME_STORAGE_KEY, type DataSource, DataTable, type DataTableCell, type DataTableColumn, type DataTableColumnDef, DataTableColumnHeader, type DataTableColumnHeaderProps, type DataTableColumnMeta, type DataTableEditable, type DataTableEditingCell, DataTableExportMenu, type DataTableExportMenuProps, DataTableFacetedFilter, type DataTableFacetedFilterOption, type DataTableFacetedFilterProps, type DataTableFeatures, type DataTableInstance, DataTablePagination, type DataTablePaginationMode, type DataTablePaginationProps, type DataTableProps, type DataTableRow, type DataTableState, type DataTableTable, DataTableToolbar, type DataTableToolbarProps, DataTableView, DataTableViewOptions, type DataTableViewOptionsProps, type DataTableViewProps, DateField, type DateFieldProps, DatePicker, type DatePickerProps, DateRangePicker, type DateRangePickerProps, Dialog, DialogBody, DialogClose, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, type DropdownMenuSubTriggerProps, DropdownMenuTrigger, Dropzone, type DropzoneProps, type DropzoneState, EmptyState, type EmptyStateProps, ErrorBanner, type ErrorBannerProps, type ExportCell, type ExportSheet, Field, FieldContent, FieldControl, type FieldControlProps, FieldDescription, type FieldDescriptionProps, FieldError, type FieldErrorItem, type FieldErrorProps, FieldGroup, FieldLabel, type FieldLabelProps, type FieldProps, Fieldset, FieldsetLegend, type FieldsetLegendProps, type FieldsetProps, FileList, type FileListProps, type FileRejection, Form, FormControl, type FormControlProps, FormDescription, type FormDescriptionProps, FormField, FormItem, type FormItemProps, FormLabel, type FormLabelProps, FormMessage, type FormMessageProps, Funnel, FunnelChart, Input, type InputProps, type JsonSchema, Kbd, Label, LabelList, type LabelProps, Line, LineChart, LoadingSkeleton, type LoadingSkeletonPreset, type LoadingSkeletonProps, Markdown, type Components as MarkdownComponents, type MarkdownProps, NIVO_TYPES, type NivoTheme, PageHeader, type PageHeaderProps, Pie, PieChart, PolarAngleAxis, PolarGrid, PolarRadiusAxis, Popover, PopoverClose, PopoverContent, type PopoverContentProps, PopoverDescription, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, type ProgressProps, ProgressTrack, ProgressValue, RECHARTS_TYPES, Radar, RadarChart, RadioGroup, RadioGroupItem, type RadioGroupItemProps, type RadioGroupProps, RechartsLegend, RechartsTooltip, ReferenceLine, type ResolvedCortenaTheme, ResponsiveContainer, Scatter, ScatterChart, ScrollArea, type ScrollAreaProps, ScrollBar, SectionCard, type SectionCardProps, Segmented, type SegmentedOption, type SegmentedProps, Select, SelectContent, type SelectContentProps, SelectGroup, SelectItem, SelectLabel, type SelectProps, SelectSeparator, SelectTrigger, type SelectTriggerProps, SelectValue, Separator, type SeparatorProps, type ServerSource, Sheet, SheetClose, SheetContent, type SheetContentProps, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, type SheetProps, SheetTitle, SheetTrigger, Skeleton, SortableHandle, type SortableHandleProps, SortableList, type SortableListProps, type SortableRenderState, type SortableReorderDetails, Spinner, type SpinnerProps, StatusDot, type StatusDotProps, type StatusDotTone, type SubmitHandler, Switch, type SwitchProps, THEME_MESSAGE_TYPE, type TableQuery, type TableResult, Tabs, TabsContent, TabsIndicator, TabsList, TabsTrigger, Textarea, type TextareaProps, Toast, type ToastProps, Toaster, type ToasterProps, Toolbar, ToolbarEnd, type ToolbarProps, ToolbarSeparator, ToolbarStart, Tooltip, TooltipContent, type TooltipContentProps, TooltipProvider, TooltipTrigger, type UseCortenaThemeOptions, type UseCortenaThemeResult, type UseDataTableOptions, type UseFormFieldReturn, type UseFormReturn, VIZ_SERIES_COUNT, XAxis, YAxis, alertVariants, applyStoredTheme, applyTheme, arrayMove, badgeVariants, buildCatalogueDoc, buttonVariants, catalogueMarkdown, catalogueNames, chartEngine, chartScales, chipVariants, cn, createColumnHelper, dataTableFeatures, defaultCatalogue, downloadCsv, downloadExcel, exampleMessages, fieldVariants, foldMessages, formatDateDefault, formatDateISO, formatDateLong, formatDateShort, formatFileSize, formatRelative, getAtPointer, getThemeInitScript, inputClassName, isDataBinding, labelVariants, markdownSanitizeSchema, parseA2UIMessages, parseDateDefault, parseDateISO, pointerSegments, readAction, readChildren, readComponent, readStoredTheme, resolveColor, resolvePointer, resolveValue, resolveVizSeries, seriesColor, setAtPointer, sheetVariants, textareaClassName, themeFromBackground, themeFromMessage, themeInitScript, toCsv, toHex, toSheet, toastVariants, useChart, useComboboxFilter, useCortenaTheme, useDataTable, useForm, useFormField, useToast, vizSeriesVars, vizVar, zodResolver };
76
+ export { type A2UIAction, type A2UIActionSpec, type A2UIBeginRendering, type A2UICatalogue, type A2UICatalogueDoc, type A2UICatalogueEntry, type A2UIChildList, type A2UIChildren, type A2UIColumn, type A2UIComponentDoc, type A2UIComponentSpec, type A2UICreateSurface, type A2UIDataBinding, type A2UIDeleteSurface, A2UIErrorCard, type A2UIExample, type A2UIFoldResult, type A2UIGroup, type A2UIMessage, type A2UIMessageInput, type A2UINodeInfo, type A2UIPropertyValue, A2UIRenderer, type A2UIRendererProps, type A2UIResolvedAction, type A2UIRow, type A2UISurface, type A2UITableSource, type A2UIUpdateComponents, type A2UIUpdateDataModel, type A2UIView, type A2UIViewProps, A2UI_CATALOGUE_ID, A2UI_DEFAULT_SURFACE_ID, A2UI_VERSION, type Accept, Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertIcon, type AlertProps, AlertTitle, Area, AreaChart, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Bar, BarChart, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, type BreadcrumbLinkProps, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonLink, type ButtonLinkProps, type ButtonProps, Calendar, CalendarDayButton, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, type CardProps, CardTitle, CartesianGrid, Cell, Chart, type ChartConfig, ChartContainer, type ChartContainerProps, type ChartDataFor, type ChartDay, ChartEmpty, type ChartEngine, ChartError, type ChartLabels, ChartLegend, ChartLegendContent, type ChartLegendContentProps, ChartLoading, type ChartMatrix, type ChartPoint, type ChartProps, type ChartRenderer, type ChartRow, type ChartScale, type ChartScales, type ChartSeries, type ChartSlice, ChartTooltip, ChartTooltipContent, type ChartTooltipContentProps, type ChartTree, type ChartType, Checkbox, type CheckboxProps, Chip, type ChipProps, type ClientSource, type CodeRendererProps, Combobox, ComboboxChip, type ComboboxChipProps, ComboboxChips, type ComboboxChipsProps, ComboboxClear, ComboboxCollection, ComboboxContent, type ComboboxContentProps, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, type ComboboxInputProps, ComboboxItem, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Command, CommandDialog, type CommandDialogProps, CommandEmpty, CommandGroup, CommandInput, CommandItem, type CommandItemProps, CommandList, CommandLoading, CommandSeparator, CommandShortcut, ComposedChart, type CortenaTheme, type CortenaThemeMessage, DEFAULT_THEME_STORAGE_KEY, type DataSource, DataTable, type DataTableCell, type DataTableColumn, type DataTableColumnDef, DataTableColumnHeader, type DataTableColumnHeaderProps, type DataTableColumnMeta, type DataTableEditable, type DataTableEditingCell, DataTableExportMenu, type DataTableExportMenuProps, DataTableFacetedFilter, type DataTableFacetedFilterOption, type DataTableFacetedFilterProps, type DataTableFeatures, type DataTableInstance, DataTablePagination, type DataTablePaginationMode, type DataTablePaginationProps, type DataTableProps, type DataTableRow, type DataTableState, type DataTableTable, DataTableToolbar, type DataTableToolbarProps, DataTableView, DataTableViewOptions, type DataTableViewOptionsProps, type DataTableViewProps, DateField, type DateFieldProps, DatePicker, type DatePickerProps, DateRangePicker, type DateRangePickerProps, Dialog, DialogBody, DialogClose, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, type DropdownMenuContentProps, DropdownMenuGroup, DropdownMenuItem, type DropdownMenuItemProps, DropdownMenuLabel, type DropdownMenuLabelProps, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, type DropdownMenuSubTriggerProps, DropdownMenuTrigger, Dropzone, type DropzoneProps, type DropzoneState, EmptyState, type EmptyStateProps, ErrorBanner, type ErrorBannerProps, type ExportCell, type ExportSheet, Field, FieldContent, FieldControl, type FieldControlProps, FieldDescription, type FieldDescriptionProps, FieldError, type FieldErrorItem, type FieldErrorProps, FieldGroup, FieldLabel, type FieldLabelProps, type FieldProps, Fieldset, FieldsetLegend, type FieldsetLegendProps, type FieldsetProps, FileList, type FileListProps, type FileRejection, Form, FormControl, type FormControlProps, FormDescription, type FormDescriptionProps, FormField, FormItem, type FormItemProps, FormLabel, type FormLabelProps, FormMessage, type FormMessageProps, Funnel, FunnelChart, Input, type InputProps, type JsonSchema, Kbd, Label, LabelList, type LabelProps, Line, LineChart, LoadingSkeleton, type LoadingSkeletonPreset, type LoadingSkeletonProps, Markdown, type Components as MarkdownComponents, type MarkdownProps, NIVO_TYPES, type NivoTheme, PageHeader, type PageHeaderProps, Pie, PieChart, PolarAngleAxis, PolarGrid, PolarRadiusAxis, Popover, PopoverClose, PopoverContent, type PopoverContentProps, PopoverDescription, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, type ProgressProps, ProgressTrack, ProgressValue, RECHARTS_TYPES, Radar, RadarChart, RadioGroup, RadioGroupItem, type RadioGroupItemProps, type RadioGroupProps, RechartsLegend, RechartsTooltip, ReferenceLine, type ResolvedCortenaTheme, ResponsiveContainer, Scatter, ScatterChart, ScrollArea, type ScrollAreaProps, ScrollBar, SectionCard, type SectionCardProps, Segmented, type SegmentedOption, type SegmentedProps, Select, SelectContent, type SelectContentProps, SelectGroup, SelectItem, SelectLabel, type SelectProps, SelectSeparator, SelectTrigger, type SelectTriggerProps, SelectValue, Separator, type SeparatorProps, type ServerSource, Sheet, SheetClose, SheetContent, type SheetContentProps, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, type SheetProps, SheetTitle, SheetTrigger, Skeleton, SortableHandle, type SortableHandleProps, SortableList, type SortableListProps, type SortableRenderState, type SortableReorderDetails, Spinner, type SpinnerProps, StatusDot, type StatusDotProps, type StatusDotTone, type SubmitHandler, Switch, type SwitchProps, THEME_MESSAGE_TYPE, type TableQuery, type TableResult, Tabs, TabsContent, TabsIndicator, TabsList, TabsTrigger, Textarea, type TextareaProps, Toast, type ToastProps, Toaster, type ToasterProps, Toolbar, ToolbarEnd, type ToolbarProps, ToolbarSeparator, ToolbarStart, Tooltip, TooltipContent, type TooltipContentProps, TooltipProvider, TooltipTrigger, type UseCortenaThemeOptions, type UseCortenaThemeResult, type UseDataTableOptions, type UseFormFieldReturn, type UseFormReturn, VIZ_SERIES_COUNT, XAxis, YAxis, alertVariants, applyStoredTheme, applyTheme, arrayMove, badgeVariants, buttonVariants, catalogueNames, chartEngine, chartScales, chipVariants, cn, createColumnHelper, dataTableFeatures, defaultCatalogue, downloadCsv, downloadExcel, fieldVariants, foldMessages, formatDateDefault, formatDateISO, formatDateLong, formatDateShort, formatFileSize, formatRelative, getAtPointer, getThemeInitScript, inputClassName, isDataBinding, labelVariants, markdownSanitizeSchema, parseA2UIMessages, parseDateDefault, parseDateISO, pointerSegments, readAction, readChildren, readComponent, readStoredTheme, resolveColor, resolvePointer, resolveValue, resolveVizSeries, seriesColor, setAtPointer, sheetVariants, textareaClassName, themeFromBackground, themeFromMessage, themeInitScript, toCsv, toHex, toSheet, toastVariants, useChart, useComboboxFilter, useCortenaTheme, useDataTable, useForm, useFormField, useToast, vizSeriesVars, vizVar, zodResolver };
package/dist/index.js CHANGED
@@ -61,7 +61,6 @@ import { Markdown, markdownSanitizeSchema } from "./components/markdown.js";
61
61
  import { A2UIErrorCard } from "./a2ui/views.js";
62
62
  import { A2UI_CATALOGUE_ID, catalogueNames, defaultCatalogue } from "./a2ui/catalogue.js";
63
63
  import { A2UI_DEFAULT_SURFACE_ID, A2UI_VERSION, foldMessages, getAtPointer, isDataBinding, parseA2UIMessages, pointerSegments, readAction, readChildren, readComponent, resolvePointer, resolveValue, setAtPointer } from "./a2ui/message.js";
64
- import { buildCatalogueDoc, catalogueMarkdown, exampleMessages } from "./a2ui/catalogue-doc.js";
65
64
  import { A2UIRenderer } from "./a2ui/renderer.js";
66
65
  import { SortableHandle, SortableList, arrayMove } from "./components/sortable-list.js";
67
- export { A2UIErrorCard, A2UIRenderer, A2UI_CATALOGUE_ID, A2UI_DEFAULT_SURFACE_ID, A2UI_VERSION, Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertIcon, AlertTitle, Area, AreaChart, Avatar, AvatarFallback, AvatarImage, Badge, Bar, BarChart, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonLink, Calendar, CalendarDayButton, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CartesianGrid, Cell, Chart, ChartContainer, ChartEmpty, ChartError, ChartLegend, ChartLegendContent, ChartLoading, ChartTooltip, ChartTooltipContent, Checkbox, Chip, Combobox, ComboboxChip, ComboboxChips, ComboboxClear, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandLoading, CommandSeparator, CommandShortcut, ComposedChart, DEFAULT_THEME_STORAGE_KEY, DataTable, DataTableColumnHeader, DataTableExportMenu, DataTableFacetedFilter, DataTablePagination, DataTableToolbar, DataTableView, DataTableViewOptions, DateField, DatePicker, DateRangePicker, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Dropzone, EmptyState, ErrorBanner, Field, FieldContent, FieldControl, FieldDescription, FieldError, FieldGroup, FieldLabel, Fieldset, FieldsetLegend, FileList, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Funnel, FunnelChart, Input, Kbd, Label, LabelList, Line, LineChart, LoadingSkeleton, Markdown, NIVO_TYPES, PageHeader, Pie, PieChart, PolarAngleAxis, PolarGrid, PolarRadiusAxis, Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, RECHARTS_TYPES, Radar, RadarChart, RadioGroup, RadioGroupItem, RechartsLegend, RechartsTooltip, ReferenceLine, ResponsiveContainer, Scatter, ScatterChart, ScrollArea, ScrollBar, SectionCard, Segmented, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, SortableHandle, SortableList, Spinner, StatusDot, Switch, THEME_MESSAGE_TYPE, Tabs, TabsContent, TabsIndicator, TabsList, TabsTrigger, Textarea, Toast, Toaster, Toolbar, ToolbarEnd, ToolbarSeparator, ToolbarStart, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VIZ_SERIES_COUNT, XAxis, YAxis, alertVariants, applyStoredTheme, applyTheme, arrayMove, badgeVariants, buildCatalogueDoc, buttonVariants, catalogueMarkdown, catalogueNames, chartEngine, chartScales, chipVariants, cn, createColumnHelper, dataTableFeatures, defaultCatalogue, downloadCsv, downloadExcel, exampleMessages, fieldVariants, foldMessages, formatDateDefault, formatDateISO, formatDateLong, formatDateShort, formatFileSize, formatRelative, getAtPointer, getThemeInitScript, inputClassName, isDataBinding, labelVariants, markdownSanitizeSchema, parseA2UIMessages, parseDateDefault, parseDateISO, pointerSegments, readAction, readChildren, readComponent, readStoredTheme, resolveColor, resolvePointer, resolveValue, resolveVizSeries, seriesColor, setAtPointer, sheetVariants, textareaClassName, themeFromBackground, themeFromMessage, themeInitScript, toCsv, toHex, toSheet, toastVariants, useChart, useComboboxFilter, useCortenaTheme, useDataTable, useForm, useFormField, useToast, vizSeriesVars, vizVar, zodResolver };
66
+ export { A2UIErrorCard, A2UIRenderer, A2UI_CATALOGUE_ID, A2UI_DEFAULT_SURFACE_ID, A2UI_VERSION, Accordion, AccordionContent, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertIcon, AlertTitle, Area, AreaChart, Avatar, AvatarFallback, AvatarImage, Badge, Bar, BarChart, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, ButtonLink, Calendar, CalendarDayButton, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CartesianGrid, Cell, Chart, ChartContainer, ChartEmpty, ChartError, ChartLegend, ChartLegendContent, ChartLoading, ChartTooltip, ChartTooltipContent, Checkbox, Chip, Combobox, ComboboxChip, ComboboxChips, ComboboxClear, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxValue, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandLoading, CommandSeparator, CommandShortcut, ComposedChart, DEFAULT_THEME_STORAGE_KEY, DataTable, DataTableColumnHeader, DataTableExportMenu, DataTableFacetedFilter, DataTablePagination, DataTableToolbar, DataTableView, DataTableViewOptions, DateField, DatePicker, DateRangePicker, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Dropzone, EmptyState, ErrorBanner, Field, FieldContent, FieldControl, FieldDescription, FieldError, FieldGroup, FieldLabel, Fieldset, FieldsetLegend, FileList, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, Funnel, FunnelChart, Input, Kbd, Label, LabelList, Line, LineChart, LoadingSkeleton, Markdown, NIVO_TYPES, PageHeader, Pie, PieChart, PolarAngleAxis, PolarGrid, PolarRadiusAxis, Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, Progress, ProgressIndicator, ProgressLabel, ProgressTrack, ProgressValue, RECHARTS_TYPES, Radar, RadarChart, RadioGroup, RadioGroupItem, RechartsLegend, RechartsTooltip, ReferenceLine, ResponsiveContainer, Scatter, ScatterChart, ScrollArea, ScrollBar, SectionCard, Segmented, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, Skeleton, SortableHandle, SortableList, Spinner, StatusDot, Switch, THEME_MESSAGE_TYPE, Tabs, TabsContent, TabsIndicator, TabsList, TabsTrigger, Textarea, Toast, Toaster, Toolbar, ToolbarEnd, ToolbarSeparator, ToolbarStart, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, VIZ_SERIES_COUNT, XAxis, YAxis, alertVariants, applyStoredTheme, applyTheme, arrayMove, badgeVariants, buttonVariants, catalogueNames, chartEngine, chartScales, chipVariants, cn, createColumnHelper, dataTableFeatures, defaultCatalogue, downloadCsv, downloadExcel, fieldVariants, foldMessages, formatDateDefault, formatDateISO, formatDateLong, formatDateShort, formatFileSize, formatRelative, getAtPointer, getThemeInitScript, inputClassName, isDataBinding, labelVariants, markdownSanitizeSchema, parseA2UIMessages, parseDateDefault, parseDateISO, pointerSegments, readAction, readChildren, readComponent, readStoredTheme, resolveColor, resolvePointer, resolveValue, resolveVizSeries, seriesColor, setAtPointer, sheetVariants, textareaClassName, themeFromBackground, themeFromMessage, themeInitScript, toCsv, toHex, toSheet, toastVariants, useChart, useComboboxFilter, useCortenaTheme, useDataTable, useForm, useFormField, useToast, vizSeriesVars, vizVar, zodResolver };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortena-ui",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "Cortena UI — the shared React component library for cortenaweb and every Cortena extension. shadcn over Base UI, styled entirely from cortena-design tokens.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
package/src/a2ui/index.ts CHANGED
@@ -24,7 +24,12 @@ export {
24
24
  defaultCatalogue,
25
25
  } from "./catalogue";
26
26
  export type { A2UICatalogue, A2UICatalogueEntry, A2UIExample, A2UIGroup } from "./catalogue";
27
- export { buildCatalogueDoc, catalogueMarkdown, exampleMessages } from "./catalogue-doc";
27
+ // The catalogue doc generator is a build-time tool (`pnpm a2ui:catalogue`
28
+ // loads it from source) and the one place that needs zod 4's `toJSONSchema`.
29
+ // It is not exported from the runtime entry: a consumer whose lockfile
30
+ // resolves the zod peer to 3.x must still bundle this package, and a bundler
31
+ // that checks ESM exports (Next's webpack) fails the build on a namespace
32
+ // member that does not exist rather than trusting the runtime guard.
28
33
  export type { A2UICatalogueDoc, A2UIComponentDoc, JsonSchema } from "./catalogue-doc";
29
34
  export {
30
35
  A2UI_DEFAULT_SURFACE_ID,
@@ -1,169 +0,0 @@
1
- "use client";
2
- import { A2UI_CATALOGUE_ID, defaultCatalogue } from "./catalogue.js";
3
- import { A2UI_VERSION } from "./message.js";
4
- import { z } from "zod";
5
- //#region src/a2ui/catalogue-doc.ts
6
- /**
7
- * Catalogue documentation generator.
8
- *
9
- * Emits a machine-readable description of the catalogue — every component's
10
- * name, group, summary, property schema, events and a worked example — plus a
11
- * markdown rendering of the same thing.
12
- *
13
- * This exists so the "Rich Content" system-prompt section can be *generated*
14
- * from the catalogue rather than written beside it (DESIGN-34). A prompt that
15
- * describes a component the renderer does not have, or omits one it does, is
16
- * the failure `05-agent-ui.md` calls out; the only way to prevent it is for
17
- * both to come from one object.
18
- *
19
- * `pnpm a2ui:catalogue` writes `dist-a2ui/catalogue.json` and `.md`.
20
- */
21
- /**
22
- * zod 4 ships `toJSONSchema`; zod 3 does not.
23
- *
24
- * The package's zod peer allows both, so this is checked rather than assumed —
25
- * emitting `{}` for every component would produce a doc that passes every test
26
- * and teaches an agent nothing, which is the silent-success failure this whole
27
- * package's lint exists to avoid.
28
- */
29
- function toJsonSchema(schema) {
30
- const converter = z.toJSONSchema;
31
- if (typeof converter !== "function") throw new Error("Generating the A2UI catalogue doc needs zod 4 (z.toJSONSchema). The installed zod is 3.x.");
32
- return converter(schema, {
33
- io: "input",
34
- unrepresentable: "any"
35
- });
36
- }
37
- /** Build the machine-readable catalogue document. */
38
- function buildCatalogueDoc(catalogue = defaultCatalogue) {
39
- const components = Object.values(catalogue).map((entry) => {
40
- const schema = toJsonSchema(entry.props);
41
- const properties = schema.properties ?? {};
42
- const required = Array.isArray(schema.required) ? schema.required : [];
43
- return {
44
- name: entry.name,
45
- group: entry.group,
46
- summary: entry.summary,
47
- children: entry.children,
48
- events: [...entry.events],
49
- props: properties,
50
- required,
51
- example: {
52
- components: entry.example.components,
53
- ...entry.example.data ? { data: entry.example.data } : {}
54
- }
55
- };
56
- }).sort((a, b) => a.name.localeCompare(b.name));
57
- return {
58
- catalogueId: A2UI_CATALOGUE_ID,
59
- protocol: A2UI_VERSION,
60
- generator: "cortena-ui/a2ui",
61
- components
62
- };
63
- }
64
- const GROUP_ORDER = [
65
- "layout",
66
- "text",
67
- "input",
68
- "feedback",
69
- "data"
70
- ];
71
- const GROUP_TITLE = {
72
- layout: "Layout",
73
- text: "Text and media",
74
- input: "Inputs and actions",
75
- feedback: "Feedback",
76
- data: "Data"
77
- };
78
- /** One-line type summary for a JSON Schema property, for the markdown table. */
79
- function describeType(schema) {
80
- if (typeof schema !== "object" || schema === null) return "any";
81
- const node = schema;
82
- if (Array.isArray(node.enum)) return node.enum.map((value) => JSON.stringify(value)).join(" \\| ");
83
- if (Array.isArray(node.anyOf) || Array.isArray(node.oneOf)) return (node.anyOf ?? node.oneOf).map((option) => describeType(option)).join(" \\| ");
84
- if (node.const !== void 0) return JSON.stringify(node.const);
85
- if (node.type === "array") return `${describeType(node.items)}[]`;
86
- if (typeof node.type === "string") return node.type;
87
- if (Array.isArray(node.type)) return node.type.join(" \\| ");
88
- return "any";
89
- }
90
- function escapeCell(text) {
91
- return text.replace(/\|/g, "\\|").replace(/\n+/g, " ").trim();
92
- }
93
- /**
94
- * Render the catalogue document as markdown.
95
- *
96
- * The output is written to be pasted into a system prompt: one table per
97
- * component listing every property with its type, whether it is required and
98
- * what it means, then a fenced example an agent can copy.
99
- */
100
- function catalogueMarkdown(doc = buildCatalogueDoc()) {
101
- const lines = [];
102
- lines.push("# A2UI catalogue — cortena-ui");
103
- lines.push("");
104
- lines.push(`Protocol \`${doc.protocol}\`, catalogue \`${doc.catalogueId}\`. Generated from the catalogue definition in \`cortena-ui\`; do not edit by hand.`);
105
- lines.push("");
106
- lines.push("A surface is described by three message kinds: `createSurface` names it, `updateComponents` sends the component tree, `updateDataModel` sends the data those components bind to. Any property may be a literal or a `{ \"path\": \"/pointer\" }` binding into the data model. A component takes children through `children`, either a list of ids or `{ \"componentId\": \"…\", \"path\": \"/items\" }` to repeat one component per array item.");
107
- lines.push("");
108
- lines.push(`${doc.components.length} components:`);
109
- lines.push("");
110
- for (const group of GROUP_ORDER) {
111
- const inGroup = doc.components.filter((component) => component.group === group);
112
- if (inGroup.length === 0) continue;
113
- lines.push(`## ${GROUP_TITLE[group]}`);
114
- lines.push("");
115
- for (const component of inGroup) {
116
- lines.push(`### ${component.name}`);
117
- lines.push("");
118
- lines.push(component.summary);
119
- lines.push("");
120
- lines.push(`Children: ${component.children === "many" ? "yes" : "no"}. Events: ${component.events.length > 0 ? component.events.map((e) => `\`${e}\``).join(", ") : "none"}.`);
121
- lines.push("");
122
- const propertyNames = Object.keys(component.props);
123
- if (propertyNames.length > 0) {
124
- lines.push("| Property | Type | Required | Description |");
125
- lines.push("| --- | --- | --- | --- |");
126
- for (const name of propertyNames) {
127
- const schema = component.props[name];
128
- const description = typeof schema?.description === "string" ? schema.description : "";
129
- lines.push(`| \`${name}\` | ${escapeCell(describeType(schema))} | ${component.required.includes(name) ? "yes" : "no"} | ${escapeCell(description)} |`);
130
- }
131
- lines.push("");
132
- }
133
- lines.push("```json");
134
- lines.push(JSON.stringify(exampleMessages(component), null, 2));
135
- lines.push("```");
136
- lines.push("");
137
- }
138
- }
139
- return `${lines.join("\n").trimEnd()}\n`;
140
- }
141
- /** Turn an entry's example into the messages an agent would actually send. */
142
- function exampleMessages(component) {
143
- const messages = [{
144
- version: "v0.9",
145
- createSurface: {
146
- surfaceId: "demo",
147
- root: component.example.components[0]?.id ?? "root"
148
- }
149
- }, {
150
- version: "v0.9",
151
- updateComponents: {
152
- surfaceId: "demo",
153
- components: component.example.components
154
- }
155
- }];
156
- if (component.example.data) messages.push({
157
- version: "v0.9",
158
- updateDataModel: {
159
- surfaceId: "demo",
160
- path: "/",
161
- value: component.example.data
162
- }
163
- });
164
- return messages;
165
- }
166
- //#endregion
167
- export { buildCatalogueDoc, catalogueMarkdown, exampleMessages };
168
-
169
- //# sourceMappingURL=catalogue-doc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"catalogue-doc.js","names":[],"sources":["../../src/a2ui/catalogue-doc.ts"],"sourcesContent":["/**\n * Catalogue documentation generator.\n *\n * Emits a machine-readable description of the catalogue — every component's\n * name, group, summary, property schema, events and a worked example — plus a\n * markdown rendering of the same thing.\n *\n * This exists so the \"Rich Content\" system-prompt section can be *generated*\n * from the catalogue rather than written beside it (DESIGN-34). A prompt that\n * describes a component the renderer does not have, or omits one it does, is\n * the failure `05-agent-ui.md` calls out; the only way to prevent it is for\n * both to come from one object.\n *\n * `pnpm a2ui:catalogue` writes `dist-a2ui/catalogue.json` and `.md`.\n */\n\nimport { z } from \"zod\";\nimport { A2UI_CATALOGUE_ID, defaultCatalogue, type A2UICatalogue, type A2UIGroup } from \"./catalogue\";\nimport { A2UI_VERSION, type A2UIComponentSpec } from \"./message\";\n\n/** A JSON Schema object, as far as this module cares. */\nexport type JsonSchema = Record<string, unknown>;\n\nexport interface A2UIComponentDoc {\n name: string;\n group: A2UIGroup;\n summary: string;\n /** Whether the component takes a `children` list. */\n children: \"none\" | \"many\";\n /** Event names the component raises through `onAction`. */\n events: string[];\n /** JSON Schema of the resolved properties, derived from the zod schema. */\n props: JsonSchema;\n /** Property names that must be present. */\n required: string[];\n /** A complete, renderable example: the components and any data they bind to. */\n example: { components: A2UIComponentSpec[]; data?: Record<string, unknown> };\n}\n\nexport interface A2UICatalogueDoc {\n catalogueId: string;\n protocol: string;\n generator: string;\n components: A2UIComponentDoc[];\n}\n\n/**\n * zod 4 ships `toJSONSchema`; zod 3 does not.\n *\n * The package's zod peer allows both, so this is checked rather than assumed —\n * emitting `{}` for every component would produce a doc that passes every test\n * and teaches an agent nothing, which is the silent-success failure this whole\n * package's lint exists to avoid.\n */\nfunction toJsonSchema(schema: z.ZodType<unknown>): JsonSchema {\n const converter = (z as unknown as { toJSONSchema?: (s: unknown, o?: unknown) => JsonSchema })\n .toJSONSchema;\n if (typeof converter !== \"function\") {\n throw new Error(\n \"Generating the A2UI catalogue doc needs zod 4 (z.toJSONSchema). The installed zod is 3.x.\",\n );\n }\n return converter(schema, { io: \"input\", unrepresentable: \"any\" });\n}\n\n/** Build the machine-readable catalogue document. */\nexport function buildCatalogueDoc(catalogue: A2UICatalogue = defaultCatalogue): A2UICatalogueDoc {\n const components = Object.values(catalogue)\n .map((entry): A2UIComponentDoc => {\n const schema = toJsonSchema(entry.props as unknown as z.ZodType<unknown>);\n const properties = (schema.properties ?? {}) as JsonSchema;\n const required = Array.isArray(schema.required) ? (schema.required as string[]) : [];\n return {\n name: entry.name,\n group: entry.group,\n summary: entry.summary,\n children: entry.children,\n events: [...entry.events],\n props: properties,\n required,\n example: {\n components: entry.example.components,\n ...(entry.example.data ? { data: entry.example.data } : {}),\n },\n };\n })\n .sort((a, b) => a.name.localeCompare(b.name));\n\n return {\n catalogueId: A2UI_CATALOGUE_ID,\n protocol: A2UI_VERSION,\n generator: \"cortena-ui/a2ui\",\n components,\n };\n}\n\nconst GROUP_ORDER: A2UIGroup[] = [\"layout\", \"text\", \"input\", \"feedback\", \"data\"];\n\nconst GROUP_TITLE: Record<A2UIGroup, string> = {\n layout: \"Layout\",\n text: \"Text and media\",\n input: \"Inputs and actions\",\n feedback: \"Feedback\",\n data: \"Data\",\n};\n\n/** One-line type summary for a JSON Schema property, for the markdown table. */\nfunction describeType(schema: unknown): string {\n if (typeof schema !== \"object\" || schema === null) {\n return \"any\";\n }\n const node = schema as JsonSchema;\n if (Array.isArray(node.enum)) {\n return node.enum.map((value) => JSON.stringify(value)).join(\" \\\\| \");\n }\n if (Array.isArray(node.anyOf) || Array.isArray(node.oneOf)) {\n const options = (node.anyOf ?? node.oneOf) as unknown[];\n return options.map((option) => describeType(option)).join(\" \\\\| \");\n }\n if (node.const !== undefined) {\n return JSON.stringify(node.const);\n }\n if (node.type === \"array\") {\n return `${describeType(node.items)}[]`;\n }\n if (typeof node.type === \"string\") {\n return node.type;\n }\n if (Array.isArray(node.type)) {\n return node.type.join(\" \\\\| \");\n }\n return \"any\";\n}\n\nfunction escapeCell(text: string): string {\n return text.replace(/\\|/g, \"\\\\|\").replace(/\\n+/g, \" \").trim();\n}\n\n/**\n * Render the catalogue document as markdown.\n *\n * The output is written to be pasted into a system prompt: one table per\n * component listing every property with its type, whether it is required and\n * what it means, then a fenced example an agent can copy.\n */\nexport function catalogueMarkdown(doc: A2UICatalogueDoc = buildCatalogueDoc()): string {\n const lines: string[] = [];\n lines.push(\"# A2UI catalogue — cortena-ui\");\n lines.push(\"\");\n lines.push(\n `Protocol \\`${doc.protocol}\\`, catalogue \\`${doc.catalogueId}\\`. Generated from the catalogue definition in \\`cortena-ui\\`; do not edit by hand.`,\n );\n lines.push(\"\");\n lines.push(\n \"A surface is described by three message kinds: `createSurface` names it, `updateComponents` sends the component tree, `updateDataModel` sends the data those components bind to. Any property may be a literal or a `{ \\\"path\\\": \\\"/pointer\\\" }` binding into the data model. A component takes children through `children`, either a list of ids or `{ \\\"componentId\\\": \\\"…\\\", \\\"path\\\": \\\"/items\\\" }` to repeat one component per array item.\",\n );\n lines.push(\"\");\n lines.push(`${doc.components.length} components:`);\n lines.push(\"\");\n\n for (const group of GROUP_ORDER) {\n const inGroup = doc.components.filter((component) => component.group === group);\n if (inGroup.length === 0) {\n continue;\n }\n lines.push(`## ${GROUP_TITLE[group]}`);\n lines.push(\"\");\n for (const component of inGroup) {\n lines.push(`### ${component.name}`);\n lines.push(\"\");\n lines.push(component.summary);\n lines.push(\"\");\n lines.push(\n `Children: ${component.children === \"many\" ? \"yes\" : \"no\"}. Events: ${\n component.events.length > 0 ? component.events.map((e) => `\\`${e}\\``).join(\", \") : \"none\"\n }.`,\n );\n lines.push(\"\");\n const propertyNames = Object.keys(component.props);\n if (propertyNames.length > 0) {\n lines.push(\"| Property | Type | Required | Description |\");\n lines.push(\"| --- | --- | --- | --- |\");\n for (const name of propertyNames) {\n const schema = component.props[name] as JsonSchema | undefined;\n const description =\n typeof schema?.description === \"string\" ? schema.description : \"\";\n lines.push(\n `| \\`${name}\\` | ${escapeCell(describeType(schema))} | ${\n component.required.includes(name) ? \"yes\" : \"no\"\n } | ${escapeCell(description)} |`,\n );\n }\n lines.push(\"\");\n }\n lines.push(\"```json\");\n lines.push(JSON.stringify(exampleMessages(component), null, 2));\n lines.push(\"```\");\n lines.push(\"\");\n }\n }\n return `${lines.join(\"\\n\").trimEnd()}\\n`;\n}\n\n/** Turn an entry's example into the messages an agent would actually send. */\nexport function exampleMessages(component: A2UIComponentDoc): unknown[] {\n const root = component.example.components[0]?.id ?? \"root\";\n const messages: unknown[] = [\n { version: \"v0.9\", createSurface: { surfaceId: \"demo\", root } },\n { version: \"v0.9\", updateComponents: { surfaceId: \"demo\", components: component.example.components } },\n ];\n if (component.example.data) {\n messages.push({\n version: \"v0.9\",\n updateDataModel: { surfaceId: \"demo\", path: \"/\", value: component.example.data },\n });\n }\n return messages;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,SAAS,aAAa,QAAwC;CAC5D,MAAM,YAAa,EAChB;CACH,IAAI,OAAO,cAAc,YACvB,MAAM,IAAI,MACR,2FACF;CAEF,OAAO,UAAU,QAAQ;EAAE,IAAI;EAAS,iBAAiB;CAAM,CAAC;AAClE;;AAGA,SAAgB,kBAAkB,YAA2B,kBAAoC;CAC/F,MAAM,aAAa,OAAO,OAAO,SAAS,CAAC,CACxC,KAAK,UAA4B;EAChC,MAAM,SAAS,aAAa,MAAM,KAAsC;EACxE,MAAM,aAAc,OAAO,cAAc,CAAC;EAC1C,MAAM,WAAW,MAAM,QAAQ,OAAO,QAAQ,IAAK,OAAO,WAAwB,CAAC;EACnF,OAAO;GACL,MAAM,MAAM;GACZ,OAAO,MAAM;GACb,SAAS,MAAM;GACf,UAAU,MAAM;GAChB,QAAQ,CAAC,GAAG,MAAM,MAAM;GACxB,OAAO;GACP;GACA,SAAS;IACP,YAAY,MAAM,QAAQ;IAC1B,GAAI,MAAM,QAAQ,OAAO,EAAE,MAAM,MAAM,QAAQ,KAAK,IAAI,CAAC;GAC3D;EACF;CACF,CAAC,CAAC,CACD,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC;CAE9C,OAAO;EACL,aAAa;EACb,UAAU;EACV,WAAW;EACX;CACF;AACF;AAEA,MAAM,cAA2B;CAAC;CAAU;CAAQ;CAAS;CAAY;AAAM;AAE/E,MAAM,cAAyC;CAC7C,QAAQ;CACR,MAAM;CACN,OAAO;CACP,UAAU;CACV,MAAM;AACR;;AAGA,SAAS,aAAa,QAAyB;CAC7C,IAAI,OAAO,WAAW,YAAY,WAAW,MAC3C,OAAO;CAET,MAAM,OAAO;CACb,IAAI,MAAM,QAAQ,KAAK,IAAI,GACzB,OAAO,KAAK,KAAK,KAAK,UAAU,KAAK,UAAU,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO;CAErE,IAAI,MAAM,QAAQ,KAAK,KAAK,KAAK,MAAM,QAAQ,KAAK,KAAK,GAEvD,QADiB,KAAK,SAAS,KAAK,MAAA,CACrB,KAAK,WAAW,aAAa,MAAM,CAAC,CAAC,CAAC,KAAK,OAAO;CAEnE,IAAI,KAAK,UAAU,KAAA,GACjB,OAAO,KAAK,UAAU,KAAK,KAAK;CAElC,IAAI,KAAK,SAAS,SAChB,OAAO,GAAG,aAAa,KAAK,KAAK,EAAE;CAErC,IAAI,OAAO,KAAK,SAAS,UACvB,OAAO,KAAK;CAEd,IAAI,MAAM,QAAQ,KAAK,IAAI,GACzB,OAAO,KAAK,KAAK,KAAK,OAAO;CAE/B,OAAO;AACT;AAEA,SAAS,WAAW,MAAsB;CACxC,OAAO,KAAK,QAAQ,OAAO,KAAK,CAAC,CAAC,QAAQ,QAAQ,GAAG,CAAC,CAAC,KAAK;AAC9D;;;;;;;;AASA,SAAgB,kBAAkB,MAAwB,kBAAkB,GAAW;CACrF,MAAM,QAAkB,CAAC;CACzB,MAAM,KAAK,+BAA+B;CAC1C,MAAM,KAAK,EAAE;CACb,MAAM,KACJ,cAAc,IAAI,SAAS,kBAAkB,IAAI,YAAY,oFAC/D;CACA,MAAM,KAAK,EAAE;CACb,MAAM,KACJ,ibACF;CACA,MAAM,KAAK,EAAE;CACb,MAAM,KAAK,GAAG,IAAI,WAAW,OAAO,aAAa;CACjD,MAAM,KAAK,EAAE;CAEb,KAAK,MAAM,SAAS,aAAa;EAC/B,MAAM,UAAU,IAAI,WAAW,QAAQ,cAAc,UAAU,UAAU,KAAK;EAC9E,IAAI,QAAQ,WAAW,GACrB;EAEF,MAAM,KAAK,MAAM,YAAY,QAAQ;EACrC,MAAM,KAAK,EAAE;EACb,KAAK,MAAM,aAAa,SAAS;GAC/B,MAAM,KAAK,OAAO,UAAU,MAAM;GAClC,MAAM,KAAK,EAAE;GACb,MAAM,KAAK,UAAU,OAAO;GAC5B,MAAM,KAAK,EAAE;GACb,MAAM,KACJ,aAAa,UAAU,aAAa,SAAS,QAAQ,KAAK,YACxD,UAAU,OAAO,SAAS,IAAI,UAAU,OAAO,KAAK,MAAM,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,IAAI,IAAI,OACpF,EACH;GACA,MAAM,KAAK,EAAE;GACb,MAAM,gBAAgB,OAAO,KAAK,UAAU,KAAK;GACjD,IAAI,cAAc,SAAS,GAAG;IAC5B,MAAM,KAAK,8CAA8C;IACzD,MAAM,KAAK,2BAA2B;IACtC,KAAK,MAAM,QAAQ,eAAe;KAChC,MAAM,SAAS,UAAU,MAAM;KAC/B,MAAM,cACJ,OAAO,QAAQ,gBAAgB,WAAW,OAAO,cAAc;KACjE,MAAM,KACJ,OAAO,KAAK,OAAO,WAAW,aAAa,MAAM,CAAC,EAAE,KAClD,UAAU,SAAS,SAAS,IAAI,IAAI,QAAQ,KAC7C,KAAK,WAAW,WAAW,EAAE,GAChC;IACF;IACA,MAAM,KAAK,EAAE;GACf;GACA,MAAM,KAAK,SAAS;GACpB,MAAM,KAAK,KAAK,UAAU,gBAAgB,SAAS,GAAG,MAAM,CAAC,CAAC;GAC9D,MAAM,KAAK,KAAK;GAChB,MAAM,KAAK,EAAE;EACf;CACF;CACA,OAAO,GAAG,MAAM,KAAK,IAAI,CAAC,CAAC,QAAQ,EAAE;AACvC;;AAGA,SAAgB,gBAAgB,WAAwC;CAEtE,MAAM,WAAsB,CAC1B;EAAE,SAAS;EAAQ,eAAe;GAAE,WAAW;GAAQ,MAF5C,UAAU,QAAQ,WAAW,EAAE,EAAE,MAAM;EAEU;CAAE,GAC9D;EAAE,SAAS;EAAQ,kBAAkB;GAAE,WAAW;GAAQ,YAAY,UAAU,QAAQ;EAAW;CAAE,CACvG;CACA,IAAI,UAAU,QAAQ,MACpB,SAAS,KAAK;EACZ,SAAS;EACT,iBAAiB;GAAE,WAAW;GAAQ,MAAM;GAAK,OAAO,UAAU,QAAQ;EAAK;CACjF,CAAC;CAEH,OAAO;AACT"}