@copilotkit/a2ui-renderer 1.60.2 → 1.61.1
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/dist/web-components/_virtual/_rolldown/runtime.cjs +19 -0
- package/dist/web-components/_virtual/_rolldown/runtime.mjs +18 -0
- package/dist/web-components/a2ui-types.d.cts +23 -0
- package/dist/web-components/a2ui-types.d.cts.map +1 -0
- package/dist/web-components/a2ui-types.d.mts +23 -0
- package/dist/web-components/a2ui-types.d.mts.map +1 -0
- package/dist/web-components/adapter.cjs +33 -0
- package/dist/web-components/adapter.cjs.map +1 -0
- package/dist/web-components/adapter.d.cts +12 -0
- package/dist/web-components/adapter.d.cts.map +1 -0
- package/dist/web-components/adapter.d.mts +12 -0
- package/dist/web-components/adapter.d.mts.map +1 -0
- package/dist/web-components/adapter.mjs +32 -0
- package/dist/web-components/adapter.mjs.map +1 -0
- package/dist/web-components/bound-component.cjs +71 -0
- package/dist/web-components/bound-component.cjs.map +1 -0
- package/dist/web-components/bound-component.d.cts +44 -0
- package/dist/web-components/bound-component.d.cts.map +1 -0
- package/dist/web-components/bound-component.d.mts +44 -0
- package/dist/web-components/bound-component.d.mts.map +1 -0
- package/dist/web-components/bound-component.mjs +71 -0
- package/dist/web-components/bound-component.mjs.map +1 -0
- package/dist/web-components/catalog/basic/audio-player.cjs +32 -0
- package/dist/web-components/catalog/basic/audio-player.cjs.map +1 -0
- package/dist/web-components/catalog/basic/audio-player.d.cts +8 -0
- package/dist/web-components/catalog/basic/audio-player.d.cts.map +1 -0
- package/dist/web-components/catalog/basic/audio-player.d.mts +8 -0
- package/dist/web-components/catalog/basic/audio-player.d.mts.map +1 -0
- package/dist/web-components/catalog/basic/audio-player.mjs +32 -0
- package/dist/web-components/catalog/basic/audio-player.mjs.map +1 -0
- package/dist/web-components/catalog/basic/button.cjs +33 -0
- package/dist/web-components/catalog/basic/button.cjs.map +1 -0
- package/dist/web-components/catalog/basic/button.d.cts +8 -0
- package/dist/web-components/catalog/basic/button.d.cts.map +1 -0
- package/dist/web-components/catalog/basic/button.d.mts +8 -0
- package/dist/web-components/catalog/basic/button.d.mts.map +1 -0
- package/dist/web-components/catalog/basic/button.mjs +33 -0
- package/dist/web-components/catalog/basic/button.mjs.map +1 -0
- package/dist/web-components/catalog/basic/card.cjs +23 -0
- package/dist/web-components/catalog/basic/card.cjs.map +1 -0
- package/dist/web-components/catalog/basic/card.d.cts +8 -0
- package/dist/web-components/catalog/basic/card.d.cts.map +1 -0
- package/dist/web-components/catalog/basic/card.d.mts +8 -0
- package/dist/web-components/catalog/basic/card.d.mts.map +1 -0
- package/dist/web-components/catalog/basic/card.mjs +23 -0
- package/dist/web-components/catalog/basic/card.mjs.map +1 -0
- package/dist/web-components/catalog/basic/check-box.cjs +50 -0
- package/dist/web-components/catalog/basic/check-box.cjs.map +1 -0
- package/dist/web-components/catalog/basic/check-box.d.cts +8 -0
- package/dist/web-components/catalog/basic/check-box.d.cts.map +1 -0
- package/dist/web-components/catalog/basic/check-box.d.mts +8 -0
- package/dist/web-components/catalog/basic/check-box.d.mts.map +1 -0
- package/dist/web-components/catalog/basic/check-box.mjs +50 -0
- package/dist/web-components/catalog/basic/check-box.mjs.map +1 -0
- package/dist/web-components/catalog/basic/choice-picker.cjs +90 -0
- package/dist/web-components/catalog/basic/choice-picker.cjs.map +1 -0
- package/dist/web-components/catalog/basic/choice-picker.d.cts +8 -0
- package/dist/web-components/catalog/basic/choice-picker.d.cts.map +1 -0
- package/dist/web-components/catalog/basic/choice-picker.d.mts +8 -0
- package/dist/web-components/catalog/basic/choice-picker.d.mts.map +1 -0
- package/dist/web-components/catalog/basic/choice-picker.mjs +90 -0
- package/dist/web-components/catalog/basic/choice-picker.mjs.map +1 -0
- package/dist/web-components/catalog/basic/column.cjs +27 -0
- package/dist/web-components/catalog/basic/column.cjs.map +1 -0
- package/dist/web-components/catalog/basic/column.d.cts +8 -0
- package/dist/web-components/catalog/basic/column.d.cts.map +1 -0
- package/dist/web-components/catalog/basic/column.d.mts +8 -0
- package/dist/web-components/catalog/basic/column.d.mts.map +1 -0
- package/dist/web-components/catalog/basic/column.mjs +27 -0
- package/dist/web-components/catalog/basic/column.mjs.map +1 -0
- package/dist/web-components/catalog/basic/components.cjs +44 -0
- package/dist/web-components/catalog/basic/components.cjs.map +1 -0
- package/dist/web-components/catalog/basic/components.d.cts +19 -0
- package/dist/web-components/catalog/basic/components.d.mts +19 -0
- package/dist/web-components/catalog/basic/components.mjs +44 -0
- package/dist/web-components/catalog/basic/components.mjs.map +1 -0
- package/dist/web-components/catalog/basic/date-time-input.cjs +50 -0
- package/dist/web-components/catalog/basic/date-time-input.cjs.map +1 -0
- package/dist/web-components/catalog/basic/date-time-input.d.cts +8 -0
- package/dist/web-components/catalog/basic/date-time-input.d.cts.map +1 -0
- package/dist/web-components/catalog/basic/date-time-input.d.mts +8 -0
- package/dist/web-components/catalog/basic/date-time-input.d.mts.map +1 -0
- package/dist/web-components/catalog/basic/date-time-input.mjs +50 -0
- package/dist/web-components/catalog/basic/date-time-input.mjs.map +1 -0
- package/dist/web-components/catalog/basic/divider.cjs +21 -0
- package/dist/web-components/catalog/basic/divider.cjs.map +1 -0
- package/dist/web-components/catalog/basic/divider.d.cts +8 -0
- package/dist/web-components/catalog/basic/divider.d.cts.map +1 -0
- package/dist/web-components/catalog/basic/divider.d.mts +8 -0
- package/dist/web-components/catalog/basic/divider.d.mts.map +1 -0
- package/dist/web-components/catalog/basic/divider.mjs +21 -0
- package/dist/web-components/catalog/basic/divider.mjs.map +1 -0
- package/dist/web-components/catalog/basic/icon.cjs +29 -0
- package/dist/web-components/catalog/basic/icon.cjs.map +1 -0
- package/dist/web-components/catalog/basic/icon.d.cts +8 -0
- package/dist/web-components/catalog/basic/icon.d.cts.map +1 -0
- package/dist/web-components/catalog/basic/icon.d.mts +8 -0
- package/dist/web-components/catalog/basic/icon.d.mts.map +1 -0
- package/dist/web-components/catalog/basic/icon.mjs +29 -0
- package/dist/web-components/catalog/basic/icon.mjs.map +1 -0
- package/dist/web-components/catalog/basic/ids.cjs +11 -0
- package/dist/web-components/catalog/basic/ids.cjs.map +1 -0
- package/dist/web-components/catalog/basic/ids.mjs +10 -0
- package/dist/web-components/catalog/basic/ids.mjs.map +1 -0
- package/dist/web-components/catalog/basic/image.cjs +42 -0
- package/dist/web-components/catalog/basic/image.cjs.map +1 -0
- package/dist/web-components/catalog/basic/image.d.cts +8 -0
- package/dist/web-components/catalog/basic/image.d.cts.map +1 -0
- package/dist/web-components/catalog/basic/image.d.mts +8 -0
- package/dist/web-components/catalog/basic/image.d.mts.map +1 -0
- package/dist/web-components/catalog/basic/image.mjs +42 -0
- package/dist/web-components/catalog/basic/image.mjs.map +1 -0
- package/dist/web-components/catalog/basic/index.cjs +31 -0
- package/dist/web-components/catalog/basic/index.cjs.map +1 -0
- package/dist/web-components/catalog/basic/index.d.cts +29 -0
- package/dist/web-components/catalog/basic/index.d.cts.map +1 -0
- package/dist/web-components/catalog/basic/index.d.mts +29 -0
- package/dist/web-components/catalog/basic/index.d.mts.map +1 -0
- package/dist/web-components/catalog/basic/index.mjs +30 -0
- package/dist/web-components/catalog/basic/index.mjs.map +1 -0
- package/dist/web-components/catalog/basic/list.cjs +31 -0
- package/dist/web-components/catalog/basic/list.cjs.map +1 -0
- package/dist/web-components/catalog/basic/list.d.cts +8 -0
- package/dist/web-components/catalog/basic/list.d.cts.map +1 -0
- package/dist/web-components/catalog/basic/list.d.mts +8 -0
- package/dist/web-components/catalog/basic/list.d.mts.map +1 -0
- package/dist/web-components/catalog/basic/list.mjs +31 -0
- package/dist/web-components/catalog/basic/list.mjs.map +1 -0
- package/dist/web-components/catalog/basic/modal.cjs +80 -0
- package/dist/web-components/catalog/basic/modal.cjs.map +1 -0
- package/dist/web-components/catalog/basic/modal.d.cts +8 -0
- package/dist/web-components/catalog/basic/modal.d.cts.map +1 -0
- package/dist/web-components/catalog/basic/modal.d.mts +8 -0
- package/dist/web-components/catalog/basic/modal.d.mts.map +1 -0
- package/dist/web-components/catalog/basic/modal.mjs +80 -0
- package/dist/web-components/catalog/basic/modal.mjs.map +1 -0
- package/dist/web-components/catalog/basic/row.cjs +27 -0
- package/dist/web-components/catalog/basic/row.cjs.map +1 -0
- package/dist/web-components/catalog/basic/row.d.cts +8 -0
- package/dist/web-components/catalog/basic/row.d.cts.map +1 -0
- package/dist/web-components/catalog/basic/row.d.mts +8 -0
- package/dist/web-components/catalog/basic/row.d.mts.map +1 -0
- package/dist/web-components/catalog/basic/row.mjs +27 -0
- package/dist/web-components/catalog/basic/row.mjs.map +1 -0
- package/dist/web-components/catalog/basic/slider.cjs +44 -0
- package/dist/web-components/catalog/basic/slider.cjs.map +1 -0
- package/dist/web-components/catalog/basic/slider.d.cts +8 -0
- package/dist/web-components/catalog/basic/slider.d.cts.map +1 -0
- package/dist/web-components/catalog/basic/slider.d.mts +8 -0
- package/dist/web-components/catalog/basic/slider.d.mts.map +1 -0
- package/dist/web-components/catalog/basic/slider.mjs +44 -0
- package/dist/web-components/catalog/basic/slider.mjs.map +1 -0
- package/dist/web-components/catalog/basic/tabs.cjs +58 -0
- package/dist/web-components/catalog/basic/tabs.cjs.map +1 -0
- package/dist/web-components/catalog/basic/tabs.d.cts +8 -0
- package/dist/web-components/catalog/basic/tabs.d.cts.map +1 -0
- package/dist/web-components/catalog/basic/tabs.d.mts +8 -0
- package/dist/web-components/catalog/basic/tabs.d.mts.map +1 -0
- package/dist/web-components/catalog/basic/tabs.mjs +58 -0
- package/dist/web-components/catalog/basic/tabs.mjs.map +1 -0
- package/dist/web-components/catalog/basic/text-field.cjs +60 -0
- package/dist/web-components/catalog/basic/text-field.cjs.map +1 -0
- package/dist/web-components/catalog/basic/text-field.d.cts +8 -0
- package/dist/web-components/catalog/basic/text-field.d.cts.map +1 -0
- package/dist/web-components/catalog/basic/text-field.d.mts +8 -0
- package/dist/web-components/catalog/basic/text-field.d.mts.map +1 -0
- package/dist/web-components/catalog/basic/text-field.mjs +60 -0
- package/dist/web-components/catalog/basic/text-field.mjs.map +1 -0
- package/dist/web-components/catalog/basic/text.cjs +36 -0
- package/dist/web-components/catalog/basic/text.cjs.map +1 -0
- package/dist/web-components/catalog/basic/text.d.cts +8 -0
- package/dist/web-components/catalog/basic/text.d.cts.map +1 -0
- package/dist/web-components/catalog/basic/text.d.mts +8 -0
- package/dist/web-components/catalog/basic/text.d.mts.map +1 -0
- package/dist/web-components/catalog/basic/text.mjs +36 -0
- package/dist/web-components/catalog/basic/text.mjs.map +1 -0
- package/dist/web-components/catalog/basic/utils.cjs +48 -0
- package/dist/web-components/catalog/basic/utils.cjs.map +1 -0
- package/dist/web-components/catalog/basic/utils.d.cts +1 -0
- package/dist/web-components/catalog/basic/utils.d.mts +1 -0
- package/dist/web-components/catalog/basic/utils.mjs +41 -0
- package/dist/web-components/catalog/basic/utils.mjs.map +1 -0
- package/dist/web-components/catalog/basic/video.cjs +22 -0
- package/dist/web-components/catalog/basic/video.cjs.map +1 -0
- package/dist/web-components/catalog/basic/video.d.cts +8 -0
- package/dist/web-components/catalog/basic/video.d.cts.map +1 -0
- package/dist/web-components/catalog/basic/video.d.mts +8 -0
- package/dist/web-components/catalog/basic/video.d.mts.map +1 -0
- package/dist/web-components/catalog/basic/video.mjs +22 -0
- package/dist/web-components/catalog/basic/video.mjs.map +1 -0
- package/dist/web-components/catalog/children.cjs +17 -0
- package/dist/web-components/catalog/children.cjs.map +1 -0
- package/dist/web-components/catalog/children.mjs +16 -0
- package/dist/web-components/catalog/children.mjs.map +1 -0
- package/dist/web-components/catalog/minimal/button.cjs +38 -0
- package/dist/web-components/catalog/minimal/button.cjs.map +1 -0
- package/dist/web-components/catalog/minimal/button.d.cts +284 -0
- package/dist/web-components/catalog/minimal/button.d.cts.map +1 -0
- package/dist/web-components/catalog/minimal/button.d.mts +284 -0
- package/dist/web-components/catalog/minimal/button.d.mts.map +1 -0
- package/dist/web-components/catalog/minimal/button.mjs +36 -0
- package/dist/web-components/catalog/minimal/button.mjs.map +1 -0
- package/dist/web-components/catalog/minimal/column.cjs +50 -0
- package/dist/web-components/catalog/minimal/column.cjs.map +1 -0
- package/dist/web-components/catalog/minimal/column.d.cts +68 -0
- package/dist/web-components/catalog/minimal/column.d.cts.map +1 -0
- package/dist/web-components/catalog/minimal/column.d.mts +68 -0
- package/dist/web-components/catalog/minimal/column.d.mts.map +1 -0
- package/dist/web-components/catalog/minimal/column.mjs +48 -0
- package/dist/web-components/catalog/minimal/column.mjs.map +1 -0
- package/dist/web-components/catalog/minimal/components.cjs +18 -0
- package/dist/web-components/catalog/minimal/components.cjs.map +1 -0
- package/dist/web-components/catalog/minimal/components.d.cts +12 -0
- package/dist/web-components/catalog/minimal/components.d.cts.map +1 -0
- package/dist/web-components/catalog/minimal/components.d.mts +12 -0
- package/dist/web-components/catalog/minimal/components.d.mts.map +1 -0
- package/dist/web-components/catalog/minimal/components.mjs +18 -0
- package/dist/web-components/catalog/minimal/components.mjs.map +1 -0
- package/dist/web-components/catalog/minimal/index.cjs +49 -0
- package/dist/web-components/catalog/minimal/index.cjs.map +1 -0
- package/dist/web-components/catalog/minimal/index.d.cts +17 -0
- package/dist/web-components/catalog/minimal/index.d.cts.map +1 -0
- package/dist/web-components/catalog/minimal/index.d.mts +17 -0
- package/dist/web-components/catalog/minimal/index.d.mts.map +1 -0
- package/dist/web-components/catalog/minimal/index.mjs +43 -0
- package/dist/web-components/catalog/minimal/index.mjs.map +1 -0
- package/dist/web-components/catalog/minimal/row.cjs +49 -0
- package/dist/web-components/catalog/minimal/row.cjs.map +1 -0
- package/dist/web-components/catalog/minimal/row.d.cts +68 -0
- package/dist/web-components/catalog/minimal/row.d.cts.map +1 -0
- package/dist/web-components/catalog/minimal/row.d.mts +68 -0
- package/dist/web-components/catalog/minimal/row.d.mts.map +1 -0
- package/dist/web-components/catalog/minimal/row.mjs +47 -0
- package/dist/web-components/catalog/minimal/row.mjs.map +1 -0
- package/dist/web-components/catalog/minimal/text-field.cjs +74 -0
- package/dist/web-components/catalog/minimal/text-field.cjs.map +1 -0
- package/dist/web-components/catalog/minimal/text-field.d.cts +164 -0
- package/dist/web-components/catalog/minimal/text-field.d.cts.map +1 -0
- package/dist/web-components/catalog/minimal/text-field.d.mts +164 -0
- package/dist/web-components/catalog/minimal/text-field.d.mts.map +1 -0
- package/dist/web-components/catalog/minimal/text-field.mjs +72 -0
- package/dist/web-components/catalog/minimal/text-field.mjs.map +1 -0
- package/dist/web-components/catalog/minimal/text.cjs +40 -0
- package/dist/web-components/catalog/minimal/text.cjs.map +1 -0
- package/dist/web-components/catalog/minimal/text.d.cts +92 -0
- package/dist/web-components/catalog/minimal/text.d.cts.map +1 -0
- package/dist/web-components/catalog/minimal/text.d.mts +92 -0
- package/dist/web-components/catalog/minimal/text.d.mts.map +1 -0
- package/dist/web-components/catalog/minimal/text.mjs +38 -0
- package/dist/web-components/catalog/minimal/text.mjs.map +1 -0
- package/dist/web-components/catalog/minimal/utils.cjs +26 -0
- package/dist/web-components/catalog/minimal/utils.cjs.map +1 -0
- package/dist/web-components/catalog/minimal/utils.mjs +24 -0
- package/dist/web-components/catalog/minimal/utils.mjs.map +1 -0
- package/dist/web-components/create-catalog.cjs +143 -0
- package/dist/web-components/create-catalog.cjs.map +1 -0
- package/dist/web-components/create-catalog.d.cts +44 -0
- package/dist/web-components/create-catalog.d.cts.map +1 -0
- package/dist/web-components/create-catalog.d.mts +44 -0
- package/dist/web-components/create-catalog.d.mts.map +1 -0
- package/dist/web-components/create-catalog.mjs +137 -0
- package/dist/web-components/create-catalog.mjs.map +1 -0
- package/dist/web-components/define.cjs +24 -0
- package/dist/web-components/define.cjs.map +1 -0
- package/dist/web-components/define.d.cts +19 -0
- package/dist/web-components/define.d.cts.map +1 -0
- package/dist/web-components/define.d.mts +19 -0
- package/dist/web-components/define.d.mts.map +1 -0
- package/dist/web-components/define.mjs +17 -0
- package/dist/web-components/define.mjs.map +1 -0
- package/dist/web-components/index.cjs +78 -0
- package/dist/web-components/index.d.cts +30 -0
- package/dist/web-components/index.d.mts +30 -0
- package/dist/web-components/index.mjs +29 -0
- package/dist/web-components/node.cjs +94 -0
- package/dist/web-components/node.cjs.map +1 -0
- package/dist/web-components/node.d.cts +33 -0
- package/dist/web-components/node.d.cts.map +1 -0
- package/dist/web-components/node.d.mts +33 -0
- package/dist/web-components/node.d.mts.map +1 -0
- package/dist/web-components/node.mjs +94 -0
- package/dist/web-components/node.mjs.map +1 -0
- package/dist/web-components/surface.cjs +314 -0
- package/dist/web-components/surface.cjs.map +1 -0
- package/dist/web-components/surface.d.cts +43 -0
- package/dist/web-components/surface.d.cts.map +1 -0
- package/dist/web-components/surface.d.mts +43 -0
- package/dist/web-components/surface.d.mts.map +1 -0
- package/dist/web-components/surface.mjs +314 -0
- package/dist/web-components/surface.mjs.map +1 -0
- package/dist/web-components/types.d.cts +45 -0
- package/dist/web-components/types.d.cts.map +1 -0
- package/dist/web-components/types.d.mts +45 -0
- package/dist/web-components/types.d.mts.map +1 -0
- package/package.json +38 -3
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createLitComponent } from "../../adapter.mjs";
|
|
2
|
+
import { html } from "lit";
|
|
3
|
+
import { CommonSchemas } from "@a2ui/web_core/v0_9";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
//#region src/web-components/catalog/minimal/text.ts
|
|
7
|
+
const TextSchema = z.object({
|
|
8
|
+
text: CommonSchemas.DynamicString,
|
|
9
|
+
variant: z.enum([
|
|
10
|
+
"h1",
|
|
11
|
+
"h2",
|
|
12
|
+
"h3",
|
|
13
|
+
"h4",
|
|
14
|
+
"h5",
|
|
15
|
+
"caption",
|
|
16
|
+
"body"
|
|
17
|
+
]).optional()
|
|
18
|
+
});
|
|
19
|
+
const TextApiDef = {
|
|
20
|
+
name: "Text",
|
|
21
|
+
schema: TextSchema
|
|
22
|
+
};
|
|
23
|
+
const Text = createLitComponent(TextApiDef, ({ props }) => {
|
|
24
|
+
const text = props.text ?? "";
|
|
25
|
+
switch (props.variant) {
|
|
26
|
+
case "h1": return html`<h1>${text}</h1>`;
|
|
27
|
+
case "h2": return html`<h2>${text}</h2>`;
|
|
28
|
+
case "h3": return html`<h3>${text}</h3>`;
|
|
29
|
+
case "h4": return html`<h4>${text}</h4>`;
|
|
30
|
+
case "h5": return html`<h5>${text}</h5>`;
|
|
31
|
+
case "caption": return html`<small>${text}</small>`;
|
|
32
|
+
default: return html`<span>${text}</span>`;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { Text, TextApiDef, TextSchema };
|
|
38
|
+
//# sourceMappingURL=text.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.mjs","names":[],"sources":["../../../../src/web-components/catalog/minimal/text.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { CommonSchemas } from \"@a2ui/web_core/v0_9\";\nimport { z } from \"zod\";\nimport { createLitComponent } from \"../../adapter\";\n\nexport const TextSchema = z.object({\n text: CommonSchemas.DynamicString,\n variant: z.enum([\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"caption\", \"body\"]).optional(),\n});\n\nexport const TextApiDef = {\n name: \"Text\",\n schema: TextSchema,\n};\n\nexport const Text = createLitComponent(TextApiDef, ({ props }) => {\n const text = props.text ?? \"\";\n switch (props.variant) {\n case \"h1\":\n return html`<h1>${text}</h1>`;\n case \"h2\":\n return html`<h2>${text}</h2>`;\n case \"h3\":\n return html`<h3>${text}</h3>`;\n case \"h4\":\n return html`<h4>${text}</h4>`;\n case \"h5\":\n return html`<h5>${text}</h5>`;\n case \"caption\":\n return html`<small>${text}</small>`;\n case \"body\":\n default:\n return html`<span>${text}</span>`;\n }\n});\n"],"mappings":";;;;;;AAKA,MAAa,aAAa,EAAE,OAAO;CACjC,MAAM,cAAc;CACpB,SAAS,EAAE,KAAK;EAAC;EAAM;EAAM;EAAM;EAAM;EAAM;EAAW;EAAO,CAAC,CAAC,UAAU;CAC9E,CAAC;AAEF,MAAa,aAAa;CACxB,MAAM;CACN,QAAQ;CACT;AAED,MAAa,OAAO,mBAAmB,aAAa,EAAE,YAAY;CAChE,MAAM,OAAO,MAAM,QAAQ;AAC3B,SAAQ,MAAM,SAAd;EACE,KAAK,KACH,QAAO,IAAI,OAAO,KAAK;EACzB,KAAK,KACH,QAAO,IAAI,OAAO,KAAK;EACzB,KAAK,KACH,QAAO,IAAI,OAAO,KAAK;EACzB,KAAK,KACH,QAAO,IAAI,OAAO,KAAK;EACzB,KAAK,KACH,QAAO,IAAI,OAAO,KAAK;EACzB,KAAK,UACH,QAAO,IAAI,UAAU,KAAK;EAE5B,QACE,QAAO,IAAI,SAAS,KAAK;;EAE7B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/web-components/catalog/minimal/utils.ts
|
|
3
|
+
const mapJustify = (justify) => {
|
|
4
|
+
switch (justify) {
|
|
5
|
+
case "center": return "center";
|
|
6
|
+
case "end": return "flex-end";
|
|
7
|
+
case "spaceAround": return "space-around";
|
|
8
|
+
case "spaceBetween": return "space-between";
|
|
9
|
+
case "spaceEvenly": return "space-evenly";
|
|
10
|
+
case "stretch": return "stretch";
|
|
11
|
+
default: return "flex-start";
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const mapAlign = (align) => {
|
|
15
|
+
switch (align) {
|
|
16
|
+
case "start": return "flex-start";
|
|
17
|
+
case "center": return "center";
|
|
18
|
+
case "end": return "flex-end";
|
|
19
|
+
default: return "stretch";
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
exports.mapAlign = mapAlign;
|
|
25
|
+
exports.mapJustify = mapJustify;
|
|
26
|
+
//# sourceMappingURL=utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":[],"sources":["../../../../src/web-components/catalog/minimal/utils.ts"],"sourcesContent":["export const mapJustify = (justify?: string): string => {\n switch (justify) {\n case \"center\":\n return \"center\";\n case \"end\":\n return \"flex-end\";\n case \"spaceAround\":\n return \"space-around\";\n case \"spaceBetween\":\n return \"space-between\";\n case \"spaceEvenly\":\n return \"space-evenly\";\n case \"stretch\":\n return \"stretch\";\n case \"start\":\n default:\n return \"flex-start\";\n }\n};\n\nexport const mapAlign = (align?: string): string => {\n switch (align) {\n case \"start\":\n return \"flex-start\";\n case \"center\":\n return \"center\";\n case \"end\":\n return \"flex-end\";\n case \"stretch\":\n default:\n return \"stretch\";\n }\n};\n"],"mappings":";;AAAA,MAAa,cAAc,YAA6B;AACtD,SAAQ,SAAR;EACE,KAAK,SACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,KAAK,cACH,QAAO;EACT,KAAK,eACH,QAAO;EACT,KAAK,cACH,QAAO;EACT,KAAK,UACH,QAAO;EAET,QACE,QAAO;;;AAIb,MAAa,YAAY,UAA2B;AAClD,SAAQ,OAAR;EACE,KAAK,QACH,QAAO;EACT,KAAK,SACH,QAAO;EACT,KAAK,MACH,QAAO;EAET,QACE,QAAO"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/web-components/catalog/minimal/utils.ts
|
|
2
|
+
const mapJustify = (justify) => {
|
|
3
|
+
switch (justify) {
|
|
4
|
+
case "center": return "center";
|
|
5
|
+
case "end": return "flex-end";
|
|
6
|
+
case "spaceAround": return "space-around";
|
|
7
|
+
case "spaceBetween": return "space-between";
|
|
8
|
+
case "spaceEvenly": return "space-evenly";
|
|
9
|
+
case "stretch": return "stretch";
|
|
10
|
+
default: return "flex-start";
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const mapAlign = (align) => {
|
|
14
|
+
switch (align) {
|
|
15
|
+
case "start": return "flex-start";
|
|
16
|
+
case "center": return "center";
|
|
17
|
+
case "end": return "flex-end";
|
|
18
|
+
default: return "stretch";
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { mapAlign, mapJustify };
|
|
24
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":[],"sources":["../../../../src/web-components/catalog/minimal/utils.ts"],"sourcesContent":["export const mapJustify = (justify?: string): string => {\n switch (justify) {\n case \"center\":\n return \"center\";\n case \"end\":\n return \"flex-end\";\n case \"spaceAround\":\n return \"space-around\";\n case \"spaceBetween\":\n return \"space-between\";\n case \"spaceEvenly\":\n return \"space-evenly\";\n case \"stretch\":\n return \"stretch\";\n case \"start\":\n default:\n return \"flex-start\";\n }\n};\n\nexport const mapAlign = (align?: string): string => {\n switch (align) {\n case \"start\":\n return \"flex-start\";\n case \"center\":\n return \"center\";\n case \"end\":\n return \"flex-end\";\n case \"stretch\":\n default:\n return \"stretch\";\n }\n};\n"],"mappings":";AAAA,MAAa,cAAc,YAA6B;AACtD,SAAQ,SAAR;EACE,KAAK,SACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,KAAK,cACH,QAAO;EACT,KAAK,eACH,QAAO;EACT,KAAK,cACH,QAAO;EACT,KAAK,UACH,QAAO;EAET,QACE,QAAO;;;AAIb,MAAa,YAAY,UAA2B;AAClD,SAAQ,OAAR;EACE,KAAK,QACH,QAAO;EACT,KAAK,SACH,QAAO;EACT,KAAK,MACH,QAAO;EAET,QACE,QAAO"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
const require_adapter = require('./adapter.cjs');
|
|
2
|
+
const require_index = require('./catalog/basic/index.cjs');
|
|
3
|
+
let _a2ui_web_core_v0_9 = require("@a2ui/web_core/v0_9");
|
|
4
|
+
let zod_to_json_schema = require("zod-to-json-schema");
|
|
5
|
+
|
|
6
|
+
//#region src/web-components/create-catalog.ts
|
|
7
|
+
const BASIC_CATALOG_ID = "https://a2ui.org/specification/v0_9/basic_catalog.json";
|
|
8
|
+
/**
|
|
9
|
+
* Context description used to identify the A2UI component schema in RunAgentInput.context.
|
|
10
|
+
* Must match the constant in @ag-ui/a2ui-middleware so the middleware can overwrite
|
|
11
|
+
* a frontend-provided schema with a server-side one.
|
|
12
|
+
*/
|
|
13
|
+
const A2UI_SCHEMA_CONTEXT_DESCRIPTION = "A2UI Component Schema — available components for generating UI surfaces. Use these component names and properties when creating A2UI operations.";
|
|
14
|
+
function createCatalog(definitions, renderers, options) {
|
|
15
|
+
const catalogId = options?.catalogId ?? "copilotkit://custom-catalog";
|
|
16
|
+
const customComponents = [];
|
|
17
|
+
for (const [name, def] of Object.entries(definitions)) {
|
|
18
|
+
const api = {
|
|
19
|
+
name,
|
|
20
|
+
schema: def.props
|
|
21
|
+
};
|
|
22
|
+
const renderer = renderers[name];
|
|
23
|
+
if (renderer === void 0) throw new Error(`Missing renderer for component "${name}"`);
|
|
24
|
+
customComponents.push(require_adapter.createLitComponent(api, ({ props, buildChild, context }) => renderer({
|
|
25
|
+
props,
|
|
26
|
+
children: buildChild,
|
|
27
|
+
dispatch: (action) => context.dispatchAction(action)
|
|
28
|
+
})));
|
|
29
|
+
}
|
|
30
|
+
return new _a2ui_web_core_v0_9.Catalog(catalogId, options?.includeBasicCatalog === true ? [...Array.from(require_index.basicCatalog.components.values()), ...customComponents] : customComponents, options?.includeBasicCatalog === true ? Array.from(require_index.basicCatalog.functions.values()) : []);
|
|
31
|
+
}
|
|
32
|
+
function extractSchema(definitions) {
|
|
33
|
+
return Object.entries(definitions).map(([name, def]) => ({
|
|
34
|
+
name,
|
|
35
|
+
description: def.description,
|
|
36
|
+
props: zodSchemaToSimpleObject(def.props)
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
function zodSchemaToSimpleObject(schema) {
|
|
40
|
+
const shape = schema.shape;
|
|
41
|
+
const properties = {};
|
|
42
|
+
for (const [key, value] of Object.entries(shape)) {
|
|
43
|
+
const zodValue = value;
|
|
44
|
+
properties[key] = {
|
|
45
|
+
type: zodValue._def?.typeName ?? "unknown",
|
|
46
|
+
...zodValue.description ? { description: zodValue.description } : {}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
type: "object",
|
|
51
|
+
properties
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function createA2UICatalog(components, options) {
|
|
55
|
+
const definitions = {};
|
|
56
|
+
const renderers = {};
|
|
57
|
+
for (const [name, def] of Object.entries(components)) {
|
|
58
|
+
definitions[name] = {
|
|
59
|
+
props: def.props,
|
|
60
|
+
description: def.description
|
|
61
|
+
};
|
|
62
|
+
renderers[name] = def.render;
|
|
63
|
+
}
|
|
64
|
+
return createCatalog(definitions, renderers, options);
|
|
65
|
+
}
|
|
66
|
+
function extractA2UISchema(components) {
|
|
67
|
+
const definitions = {};
|
|
68
|
+
for (const [name, def] of Object.entries(components)) definitions[name] = {
|
|
69
|
+
props: def.props,
|
|
70
|
+
description: def.description
|
|
71
|
+
};
|
|
72
|
+
return extractSchema(definitions);
|
|
73
|
+
}
|
|
74
|
+
function isCatalogContextValue(value) {
|
|
75
|
+
return typeof value === "object" && value !== null && "id" in value && typeof value.id === "string" && "components" in value && value.components instanceof Map;
|
|
76
|
+
}
|
|
77
|
+
function resolveCatalog(catalog) {
|
|
78
|
+
return isCatalogContextValue(catalog) ? catalog : require_index.basicCatalog;
|
|
79
|
+
}
|
|
80
|
+
function toJsonSchema(schema, options) {
|
|
81
|
+
return (0, zod_to_json_schema.zodToJsonSchema)(schema, options);
|
|
82
|
+
}
|
|
83
|
+
function extendsBasicCatalog(catalog) {
|
|
84
|
+
for (const name of require_index.basicCatalog.components.keys()) if (!catalog.components.has(name)) return false;
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
function getCustomComponentNames(catalog) {
|
|
88
|
+
const custom = [];
|
|
89
|
+
for (const name of catalog.components.keys()) if (!require_index.basicCatalog.components.has(name)) custom.push(name);
|
|
90
|
+
return custom;
|
|
91
|
+
}
|
|
92
|
+
function buildCatalogContextValue(catalog) {
|
|
93
|
+
const resolved = resolveCatalog(catalog);
|
|
94
|
+
const lines = ["Available A2UI catalog:"];
|
|
95
|
+
if (resolved.id === BASIC_CATALOG_ID) {
|
|
96
|
+
lines.push(`- ${resolved.id} (basic catalog)`);
|
|
97
|
+
return lines.join("\n");
|
|
98
|
+
}
|
|
99
|
+
const isSuperset = extendsBasicCatalog(resolved);
|
|
100
|
+
const customNames = getCustomComponentNames(resolved);
|
|
101
|
+
lines.push(`- ${resolved.id}`);
|
|
102
|
+
if (isSuperset) lines.push(" Extends the basic catalog with all standard components plus:");
|
|
103
|
+
else {
|
|
104
|
+
lines.push(" Custom catalog (does NOT include all basic components).");
|
|
105
|
+
lines.push(" Custom components:");
|
|
106
|
+
}
|
|
107
|
+
for (const name of customNames) {
|
|
108
|
+
const component = resolved.components.get(name);
|
|
109
|
+
if (!component) continue;
|
|
110
|
+
const jsonSchema = toJsonSchema(component.schema);
|
|
111
|
+
lines.push(` - ${name}:`);
|
|
112
|
+
lines.push(` ${JSON.stringify(jsonSchema, null, 2).split("\n").join("\n ")}`);
|
|
113
|
+
}
|
|
114
|
+
return lines.join("\n");
|
|
115
|
+
}
|
|
116
|
+
function extractCatalogComponentSchemas(catalog) {
|
|
117
|
+
const resolved = resolveCatalog(catalog);
|
|
118
|
+
const components = {};
|
|
119
|
+
for (const [name, comp] of resolved.components) {
|
|
120
|
+
const zodSchema = toJsonSchema(comp.schema, { target: "jsonSchema2019-09" });
|
|
121
|
+
components[name] = { allOf: [{ $ref: "common_types.json#/$defs/ComponentCommon" }, {
|
|
122
|
+
properties: {
|
|
123
|
+
component: { const: name },
|
|
124
|
+
...zodSchema.properties
|
|
125
|
+
},
|
|
126
|
+
required: ["component", ...zodSchema.required ?? []]
|
|
127
|
+
}] };
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
catalogId: resolved.id,
|
|
131
|
+
components
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
//#endregion
|
|
136
|
+
exports.A2UI_SCHEMA_CONTEXT_DESCRIPTION = A2UI_SCHEMA_CONTEXT_DESCRIPTION;
|
|
137
|
+
exports.buildCatalogContextValue = buildCatalogContextValue;
|
|
138
|
+
exports.createA2UICatalog = createA2UICatalog;
|
|
139
|
+
exports.createCatalog = createCatalog;
|
|
140
|
+
exports.extractA2UISchema = extractA2UISchema;
|
|
141
|
+
exports.extractCatalogComponentSchemas = extractCatalogComponentSchemas;
|
|
142
|
+
exports.extractSchema = extractSchema;
|
|
143
|
+
//# sourceMappingURL=create-catalog.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-catalog.cjs","names":["createLitComponent","Catalog","basicCatalog"],"sources":["../../src/web-components/create-catalog.ts"],"sourcesContent":["import type { z } from \"zod\";\nimport type { ZodObject, ZodRawShape, ZodTypeAny } from \"zod\";\nimport { Catalog } from \"@a2ui/web_core/v0_9\";\nimport type { ComponentApi } from \"@a2ui/web_core/v0_9\";\nimport { zodToJsonSchema } from \"zod-to-json-schema\";\nimport { basicCatalog } from \"./catalog/basic\";\nimport { createLitComponent } from \"./adapter\";\nimport type {\n CatalogComponentDefinition,\n CatalogDefinitions,\n CatalogRenderers,\n ComponentRenderer,\n LitComponentImplementation,\n RendererProps,\n} from \"./types\";\n\nconst BASIC_CATALOG_ID =\n \"https://a2ui.org/specification/v0_9/basic_catalog.json\";\n\ntype CatalogContextComponent = {\n schema: unknown;\n};\n\ntype CatalogContextValue = {\n id: string;\n components: ReadonlyMap<string, CatalogContextComponent>;\n};\n\n/**\n * Context description used to identify the A2UI component schema in RunAgentInput.context.\n * Must match the constant in @ag-ui/a2ui-middleware so the middleware can overwrite\n * a frontend-provided schema with a server-side one.\n */\nexport const A2UI_SCHEMA_CONTEXT_DESCRIPTION =\n \"A2UI Component Schema — available components for generating UI surfaces. Use these component names and properties when creating A2UI operations.\";\n\nexport type {\n CatalogComponentDefinition,\n CatalogDefinitions,\n CatalogRenderers,\n ComponentRenderer,\n RendererProps,\n} from \"./types\";\n\nexport function createCatalog<D extends CatalogDefinitions>(\n definitions: D,\n renderers: CatalogRenderers<D>,\n options?: {\n catalogId?: string;\n includeBasicCatalog?: boolean;\n },\n): Catalog<LitComponentImplementation> {\n const catalogId = options?.catalogId ?? \"copilotkit://custom-catalog\";\n const customComponents: LitComponentImplementation[] = [];\n\n for (const [name, def] of Object.entries(definitions)) {\n const api: ComponentApi = {\n name,\n schema: def.props,\n };\n const renderer = (renderers as Record<string, ComponentRenderer<any>>)[\n name\n ];\n if (renderer === undefined) {\n throw new Error(`Missing renderer for component \"${name}\"`);\n }\n customComponents.push(\n createLitComponent(api, ({ props, buildChild, context }) =>\n renderer({\n props,\n children: buildChild,\n dispatch: (action: unknown) => context.dispatchAction(action),\n }),\n ),\n );\n }\n\n const components =\n options?.includeBasicCatalog === true\n ? [...Array.from(basicCatalog.components.values()), ...customComponents]\n : customComponents;\n const functions =\n options?.includeBasicCatalog === true\n ? Array.from(basicCatalog.functions.values())\n : [];\n\n return new Catalog<LitComponentImplementation>(\n catalogId,\n components,\n functions,\n );\n}\n\nexport function extractSchema(definitions: CatalogDefinitions): Array<{\n name: string;\n description?: string;\n props?: Record<string, unknown>;\n}> {\n return Object.entries(definitions).map(([name, def]) => ({\n name,\n description: def.description,\n props: zodSchemaToSimpleObject(def.props),\n }));\n}\n\nfunction zodSchemaToSimpleObject(\n schema: ZodObject<any>,\n): Record<string, unknown> {\n const shape = schema.shape;\n const properties: Record<string, { type: string; description?: string }> = {};\n for (const [key, value] of Object.entries(shape)) {\n const zodValue = value as any;\n properties[key] = {\n type: zodValue._def?.typeName ?? \"unknown\",\n ...(zodValue.description ? { description: zodValue.description } : {}),\n };\n }\n return { type: \"object\", properties };\n}\n\nexport interface A2UIComponentDefinition<T extends ZodRawShape = ZodRawShape> {\n props: ZodObject<T>;\n description?: string;\n render: (props: RendererProps<z.infer<ZodObject<T>>>) => unknown;\n}\n\nexport type A2UIComponentMap = Record<string, A2UIComponentDefinition<any>>;\n\nexport function createA2UICatalog(\n components: A2UIComponentMap,\n options?: {\n catalogId?: string;\n includeBasicCatalog?: boolean;\n },\n): Catalog<LitComponentImplementation> {\n const definitions: CatalogDefinitions = {};\n const renderers: Record<string, ComponentRenderer<any>> = {};\n\n for (const [name, def] of Object.entries(components)) {\n definitions[name] = { props: def.props, description: def.description };\n renderers[name] = def.render as ComponentRenderer<any>;\n }\n\n return createCatalog(definitions, renderers as any, options);\n}\n\nexport function extractA2UISchema(components: A2UIComponentMap): Array<{\n name: string;\n description?: string;\n props?: Record<string, unknown>;\n}> {\n const definitions: CatalogDefinitions = {};\n for (const [name, def] of Object.entries(components)) {\n definitions[name] = { props: def.props, description: def.description };\n }\n return extractSchema(definitions);\n}\n\nfunction isCatalogContextValue(value: unknown): value is CatalogContextValue {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"id\" in value &&\n typeof value.id === \"string\" &&\n \"components\" in value &&\n value.components instanceof Map\n );\n}\n\nfunction resolveCatalog(catalog?: unknown): CatalogContextValue {\n return isCatalogContextValue(catalog) ? catalog : basicCatalog;\n}\n\nfunction toJsonSchema(\n schema: unknown,\n options?: Parameters<typeof zodToJsonSchema>[1],\n): ReturnType<typeof zodToJsonSchema> {\n return zodToJsonSchema(schema as ZodTypeAny, options);\n}\n\nfunction extendsBasicCatalog(catalog: CatalogContextValue): boolean {\n for (const name of basicCatalog.components.keys()) {\n if (!catalog.components.has(name)) {\n return false;\n }\n }\n return true;\n}\n\nfunction getCustomComponentNames(catalog: CatalogContextValue): string[] {\n const custom: string[] = [];\n for (const name of catalog.components.keys()) {\n if (!basicCatalog.components.has(name)) {\n custom.push(name);\n }\n }\n return custom;\n}\n\nexport function buildCatalogContextValue(catalog?: unknown): string {\n const resolved = resolveCatalog(catalog);\n const lines: string[] = [\"Available A2UI catalog:\"];\n\n if (resolved.id === BASIC_CATALOG_ID) {\n lines.push(`- ${resolved.id} (basic catalog)`);\n return lines.join(\"\\n\");\n }\n\n const isSuperset = extendsBasicCatalog(resolved);\n const customNames = getCustomComponentNames(resolved);\n\n lines.push(`- ${resolved.id}`);\n if (isSuperset) {\n lines.push(\n \" Extends the basic catalog with all standard components plus:\",\n );\n } else {\n lines.push(\" Custom catalog (does NOT include all basic components).\");\n lines.push(\" Custom components:\");\n }\n\n for (const name of customNames) {\n const component = resolved.components.get(name);\n if (!component) continue;\n const jsonSchema = toJsonSchema(component.schema);\n lines.push(` - ${name}:`);\n lines.push(\n ` ${JSON.stringify(jsonSchema, null, 2).split(\"\\n\").join(\"\\n \")}`,\n );\n }\n\n return lines.join(\"\\n\");\n}\n\nexport interface InlineCatalogSchema {\n catalogId: string;\n components: Record<string, Record<string, unknown>>;\n}\n\nexport function extractCatalogComponentSchemas(\n catalog?: unknown,\n): InlineCatalogSchema {\n const resolved = resolveCatalog(catalog);\n const components: Record<string, Record<string, unknown>> = {};\n for (const [name, comp] of resolved.components) {\n const zodSchema = toJsonSchema(comp.schema, {\n target: \"jsonSchema2019-09\",\n }) as { properties?: Record<string, unknown>; required?: string[] };\n components[name] = {\n allOf: [\n { $ref: \"common_types.json#/$defs/ComponentCommon\" },\n {\n properties: {\n component: { const: name },\n ...zodSchema.properties,\n },\n required: [\"component\", ...(zodSchema.required ?? [])],\n },\n ],\n };\n }\n return { catalogId: resolved.id, components };\n}\n"],"mappings":";;;;;;AAgBA,MAAM,mBACJ;;;;;;AAgBF,MAAa,kCACX;AAUF,SAAgB,cACd,aACA,WACA,SAIqC;CACrC,MAAM,YAAY,SAAS,aAAa;CACxC,MAAM,mBAAiD,EAAE;AAEzD,MAAK,MAAM,CAAC,MAAM,QAAQ,OAAO,QAAQ,YAAY,EAAE;EACrD,MAAM,MAAoB;GACxB;GACA,QAAQ,IAAI;GACb;EACD,MAAM,WAAY,UAChB;AAEF,MAAI,aAAa,OACf,OAAM,IAAI,MAAM,mCAAmC,KAAK,GAAG;AAE7D,mBAAiB,KACfA,mCAAmB,MAAM,EAAE,OAAO,YAAY,cAC5C,SAAS;GACP;GACA,UAAU;GACV,WAAW,WAAoB,QAAQ,eAAe,OAAO;GAC9D,CAAC,CACH,CACF;;AAYH,QAAO,IAAIC,4BACT,WATA,SAAS,wBAAwB,OAC7B,CAAC,GAAG,MAAM,KAAKC,2BAAa,WAAW,QAAQ,CAAC,EAAE,GAAG,iBAAiB,GACtE,kBAEJ,SAAS,wBAAwB,OAC7B,MAAM,KAAKA,2BAAa,UAAU,QAAQ,CAAC,GAC3C,EAAE,CAMP;;AAGH,SAAgB,cAAc,aAI3B;AACD,QAAO,OAAO,QAAQ,YAAY,CAAC,KAAK,CAAC,MAAM,UAAU;EACvD;EACA,aAAa,IAAI;EACjB,OAAO,wBAAwB,IAAI,MAAM;EAC1C,EAAE;;AAGL,SAAS,wBACP,QACyB;CACzB,MAAM,QAAQ,OAAO;CACrB,MAAM,aAAqE,EAAE;AAC7E,MAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,EAAE;EAChD,MAAM,WAAW;AACjB,aAAW,OAAO;GAChB,MAAM,SAAS,MAAM,YAAY;GACjC,GAAI,SAAS,cAAc,EAAE,aAAa,SAAS,aAAa,GAAG,EAAE;GACtE;;AAEH,QAAO;EAAE,MAAM;EAAU;EAAY;;AAWvC,SAAgB,kBACd,YACA,SAIqC;CACrC,MAAM,cAAkC,EAAE;CAC1C,MAAM,YAAoD,EAAE;AAE5D,MAAK,MAAM,CAAC,MAAM,QAAQ,OAAO,QAAQ,WAAW,EAAE;AACpD,cAAY,QAAQ;GAAE,OAAO,IAAI;GAAO,aAAa,IAAI;GAAa;AACtE,YAAU,QAAQ,IAAI;;AAGxB,QAAO,cAAc,aAAa,WAAkB,QAAQ;;AAG9D,SAAgB,kBAAkB,YAI/B;CACD,MAAM,cAAkC,EAAE;AAC1C,MAAK,MAAM,CAAC,MAAM,QAAQ,OAAO,QAAQ,WAAW,CAClD,aAAY,QAAQ;EAAE,OAAO,IAAI;EAAO,aAAa,IAAI;EAAa;AAExE,QAAO,cAAc,YAAY;;AAGnC,SAAS,sBAAsB,OAA8C;AAC3E,QACE,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,OAAO,MAAM,OAAO,YACpB,gBAAgB,SAChB,MAAM,sBAAsB;;AAIhC,SAAS,eAAe,SAAwC;AAC9D,QAAO,sBAAsB,QAAQ,GAAG,UAAUA;;AAGpD,SAAS,aACP,QACA,SACoC;AACpC,gDAAuB,QAAsB,QAAQ;;AAGvD,SAAS,oBAAoB,SAAuC;AAClE,MAAK,MAAM,QAAQA,2BAAa,WAAW,MAAM,CAC/C,KAAI,CAAC,QAAQ,WAAW,IAAI,KAAK,CAC/B,QAAO;AAGX,QAAO;;AAGT,SAAS,wBAAwB,SAAwC;CACvE,MAAM,SAAmB,EAAE;AAC3B,MAAK,MAAM,QAAQ,QAAQ,WAAW,MAAM,CAC1C,KAAI,CAACA,2BAAa,WAAW,IAAI,KAAK,CACpC,QAAO,KAAK,KAAK;AAGrB,QAAO;;AAGT,SAAgB,yBAAyB,SAA2B;CAClE,MAAM,WAAW,eAAe,QAAQ;CACxC,MAAM,QAAkB,CAAC,0BAA0B;AAEnD,KAAI,SAAS,OAAO,kBAAkB;AACpC,QAAM,KAAK,KAAK,SAAS,GAAG,kBAAkB;AAC9C,SAAO,MAAM,KAAK,KAAK;;CAGzB,MAAM,aAAa,oBAAoB,SAAS;CAChD,MAAM,cAAc,wBAAwB,SAAS;AAErD,OAAM,KAAK,KAAK,SAAS,KAAK;AAC9B,KAAI,WACF,OAAM,KACJ,iEACD;MACI;AACL,QAAM,KAAK,4DAA4D;AACvE,QAAM,KAAK,uBAAuB;;AAGpC,MAAK,MAAM,QAAQ,aAAa;EAC9B,MAAM,YAAY,SAAS,WAAW,IAAI,KAAK;AAC/C,MAAI,CAAC,UAAW;EAChB,MAAM,aAAa,aAAa,UAAU,OAAO;AACjD,QAAM,KAAK,OAAO,KAAK,GAAG;AAC1B,QAAM,KACJ,OAAO,KAAK,UAAU,YAAY,MAAM,EAAE,CAAC,MAAM,KAAK,CAAC,KAAK,SAAS,GACtE;;AAGH,QAAO,MAAM,KAAK,KAAK;;AAQzB,SAAgB,+BACd,SACqB;CACrB,MAAM,WAAW,eAAe,QAAQ;CACxC,MAAM,aAAsD,EAAE;AAC9D,MAAK,MAAM,CAAC,MAAM,SAAS,SAAS,YAAY;EAC9C,MAAM,YAAY,aAAa,KAAK,QAAQ,EAC1C,QAAQ,qBACT,CAAC;AACF,aAAW,QAAQ,EACjB,OAAO,CACL,EAAE,MAAM,4CAA4C,EACpD;GACE,YAAY;IACV,WAAW,EAAE,OAAO,MAAM;IAC1B,GAAG,UAAU;IACd;GACD,UAAU,CAAC,aAAa,GAAI,UAAU,YAAY,EAAE,CAAE;GACvD,CACF,EACF;;AAEH,QAAO;EAAE,WAAW,SAAS;EAAI;EAAY"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CatalogComponentDefinition, CatalogDefinitions, CatalogRenderers, ComponentRenderer, LitComponentImplementation, RendererProps } from "./types.cjs";
|
|
2
|
+
import { Catalog } from "@a2ui/web_core/v0_9";
|
|
3
|
+
import { ZodObject, ZodRawShape, z } from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/web-components/create-catalog.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Context description used to identify the A2UI component schema in RunAgentInput.context.
|
|
8
|
+
* Must match the constant in @ag-ui/a2ui-middleware so the middleware can overwrite
|
|
9
|
+
* a frontend-provided schema with a server-side one.
|
|
10
|
+
*/
|
|
11
|
+
declare const A2UI_SCHEMA_CONTEXT_DESCRIPTION = "A2UI Component Schema \u2014 available components for generating UI surfaces. Use these component names and properties when creating A2UI operations.";
|
|
12
|
+
declare function createCatalog<D extends CatalogDefinitions>(definitions: D, renderers: CatalogRenderers<D>, options?: {
|
|
13
|
+
catalogId?: string;
|
|
14
|
+
includeBasicCatalog?: boolean;
|
|
15
|
+
}): Catalog<LitComponentImplementation>;
|
|
16
|
+
declare function extractSchema(definitions: CatalogDefinitions): Array<{
|
|
17
|
+
name: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
props?: Record<string, unknown>;
|
|
20
|
+
}>;
|
|
21
|
+
interface A2UIComponentDefinition<T extends ZodRawShape = ZodRawShape> {
|
|
22
|
+
props: ZodObject<T>;
|
|
23
|
+
description?: string;
|
|
24
|
+
render: (props: RendererProps<z.infer<ZodObject<T>>>) => unknown;
|
|
25
|
+
}
|
|
26
|
+
type A2UIComponentMap = Record<string, A2UIComponentDefinition<any>>;
|
|
27
|
+
declare function createA2UICatalog(components: A2UIComponentMap, options?: {
|
|
28
|
+
catalogId?: string;
|
|
29
|
+
includeBasicCatalog?: boolean;
|
|
30
|
+
}): Catalog<LitComponentImplementation>;
|
|
31
|
+
declare function extractA2UISchema(components: A2UIComponentMap): Array<{
|
|
32
|
+
name: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
props?: Record<string, unknown>;
|
|
35
|
+
}>;
|
|
36
|
+
declare function buildCatalogContextValue(catalog?: unknown): string;
|
|
37
|
+
interface InlineCatalogSchema {
|
|
38
|
+
catalogId: string;
|
|
39
|
+
components: Record<string, Record<string, unknown>>;
|
|
40
|
+
}
|
|
41
|
+
declare function extractCatalogComponentSchemas(catalog?: unknown): InlineCatalogSchema;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { A2UIComponentDefinition, A2UIComponentMap, A2UI_SCHEMA_CONTEXT_DESCRIPTION, buildCatalogContextValue, createA2UICatalog, createCatalog, extractA2UISchema, extractCatalogComponentSchemas, extractSchema };
|
|
44
|
+
//# sourceMappingURL=create-catalog.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-catalog.d.cts","names":[],"sources":["../../src/web-components/create-catalog.ts"],"mappings":";;;;;;AAiCA;;;;cAAa,+BAAA;AAAA,iBAWG,aAAA,WAAwB,kBAAA,CAAA,CACtC,WAAA,EAAa,CAAA,EACb,SAAA,EAAW,gBAAA,CAAiB,CAAA,GAC5B,OAAA;EACE,SAAA;EACA,mBAAA;AAAA,IAED,OAAA,CAAQ,0BAAA;AAAA,iBA0CK,aAAA,CAAc,WAAA,EAAa,kBAAA,GAAqB,KAAA;EAC9D,IAAA;EACA,WAAA;EACA,KAAA,GAAQ,MAAA;AAAA;AAAA,UAwBO,uBAAA,WAAkC,WAAA,GAAc,WAAA;EAC/D,KAAA,EAAO,SAAA,CAAU,CAAA;EACjB,WAAA;EACA,MAAA,GAAS,KAAA,EAAO,aAAA,CAAc,CAAA,CAAE,KAAA,CAAM,SAAA,CAAU,CAAA;AAAA;AAAA,KAGtC,gBAAA,GAAmB,MAAA,SAAe,uBAAA;AAAA,iBAE9B,iBAAA,CACd,UAAA,EAAY,gBAAA,EACZ,OAAA;EACE,SAAA;EACA,mBAAA;AAAA,IAED,OAAA,CAAQ,0BAAA;AAAA,iBAYK,iBAAA,CAAkB,UAAA,EAAY,gBAAA,GAAmB,KAAA;EAC/D,IAAA;EACA,WAAA;EACA,KAAA,GAAQ,MAAA;AAAA;AAAA,iBAkDM,wBAAA,CAAyB,OAAA;AAAA,UAmCxB,mBAAA;EACf,SAAA;EACA,UAAA,EAAY,MAAA,SAAe,MAAA;AAAA;AAAA,iBAGb,8BAAA,CACd,OAAA,aACC,mBAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CatalogComponentDefinition, CatalogDefinitions, CatalogRenderers, ComponentRenderer, LitComponentImplementation, RendererProps } from "./types.mjs";
|
|
2
|
+
import { Catalog } from "@a2ui/web_core/v0_9";
|
|
3
|
+
import { ZodObject, ZodRawShape, z } from "zod";
|
|
4
|
+
|
|
5
|
+
//#region src/web-components/create-catalog.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Context description used to identify the A2UI component schema in RunAgentInput.context.
|
|
8
|
+
* Must match the constant in @ag-ui/a2ui-middleware so the middleware can overwrite
|
|
9
|
+
* a frontend-provided schema with a server-side one.
|
|
10
|
+
*/
|
|
11
|
+
declare const A2UI_SCHEMA_CONTEXT_DESCRIPTION = "A2UI Component Schema \u2014 available components for generating UI surfaces. Use these component names and properties when creating A2UI operations.";
|
|
12
|
+
declare function createCatalog<D extends CatalogDefinitions>(definitions: D, renderers: CatalogRenderers<D>, options?: {
|
|
13
|
+
catalogId?: string;
|
|
14
|
+
includeBasicCatalog?: boolean;
|
|
15
|
+
}): Catalog<LitComponentImplementation>;
|
|
16
|
+
declare function extractSchema(definitions: CatalogDefinitions): Array<{
|
|
17
|
+
name: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
props?: Record<string, unknown>;
|
|
20
|
+
}>;
|
|
21
|
+
interface A2UIComponentDefinition<T extends ZodRawShape = ZodRawShape> {
|
|
22
|
+
props: ZodObject<T>;
|
|
23
|
+
description?: string;
|
|
24
|
+
render: (props: RendererProps<z.infer<ZodObject<T>>>) => unknown;
|
|
25
|
+
}
|
|
26
|
+
type A2UIComponentMap = Record<string, A2UIComponentDefinition<any>>;
|
|
27
|
+
declare function createA2UICatalog(components: A2UIComponentMap, options?: {
|
|
28
|
+
catalogId?: string;
|
|
29
|
+
includeBasicCatalog?: boolean;
|
|
30
|
+
}): Catalog<LitComponentImplementation>;
|
|
31
|
+
declare function extractA2UISchema(components: A2UIComponentMap): Array<{
|
|
32
|
+
name: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
props?: Record<string, unknown>;
|
|
35
|
+
}>;
|
|
36
|
+
declare function buildCatalogContextValue(catalog?: unknown): string;
|
|
37
|
+
interface InlineCatalogSchema {
|
|
38
|
+
catalogId: string;
|
|
39
|
+
components: Record<string, Record<string, unknown>>;
|
|
40
|
+
}
|
|
41
|
+
declare function extractCatalogComponentSchemas(catalog?: unknown): InlineCatalogSchema;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { A2UIComponentDefinition, A2UIComponentMap, A2UI_SCHEMA_CONTEXT_DESCRIPTION, buildCatalogContextValue, createA2UICatalog, createCatalog, extractA2UISchema, extractCatalogComponentSchemas, extractSchema };
|
|
44
|
+
//# sourceMappingURL=create-catalog.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-catalog.d.mts","names":[],"sources":["../../src/web-components/create-catalog.ts"],"mappings":";;;;;;AAiCA;;;;cAAa,+BAAA;AAAA,iBAWG,aAAA,WAAwB,kBAAA,CAAA,CACtC,WAAA,EAAa,CAAA,EACb,SAAA,EAAW,gBAAA,CAAiB,CAAA,GAC5B,OAAA;EACE,SAAA;EACA,mBAAA;AAAA,IAED,OAAA,CAAQ,0BAAA;AAAA,iBA0CK,aAAA,CAAc,WAAA,EAAa,kBAAA,GAAqB,KAAA;EAC9D,IAAA;EACA,WAAA;EACA,KAAA,GAAQ,MAAA;AAAA;AAAA,UAwBO,uBAAA,WAAkC,WAAA,GAAc,WAAA;EAC/D,KAAA,EAAO,SAAA,CAAU,CAAA;EACjB,WAAA;EACA,MAAA,GAAS,KAAA,EAAO,aAAA,CAAc,CAAA,CAAE,KAAA,CAAM,SAAA,CAAU,CAAA;AAAA;AAAA,KAGtC,gBAAA,GAAmB,MAAA,SAAe,uBAAA;AAAA,iBAE9B,iBAAA,CACd,UAAA,EAAY,gBAAA,EACZ,OAAA;EACE,SAAA;EACA,mBAAA;AAAA,IAED,OAAA,CAAQ,0BAAA;AAAA,iBAYK,iBAAA,CAAkB,UAAA,EAAY,gBAAA,GAAmB,KAAA;EAC/D,IAAA;EACA,WAAA;EACA,KAAA,GAAQ,MAAA;AAAA;AAAA,iBAkDM,wBAAA,CAAyB,OAAA;AAAA,UAmCxB,mBAAA;EACf,SAAA;EACA,UAAA,EAAY,MAAA,SAAe,MAAA;AAAA;AAAA,iBAGb,8BAAA,CACd,OAAA,aACC,mBAAA"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { createLitComponent } from "./adapter.mjs";
|
|
2
|
+
import { basicCatalog } from "./catalog/basic/index.mjs";
|
|
3
|
+
import { Catalog } from "@a2ui/web_core/v0_9";
|
|
4
|
+
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
5
|
+
|
|
6
|
+
//#region src/web-components/create-catalog.ts
|
|
7
|
+
const BASIC_CATALOG_ID = "https://a2ui.org/specification/v0_9/basic_catalog.json";
|
|
8
|
+
/**
|
|
9
|
+
* Context description used to identify the A2UI component schema in RunAgentInput.context.
|
|
10
|
+
* Must match the constant in @ag-ui/a2ui-middleware so the middleware can overwrite
|
|
11
|
+
* a frontend-provided schema with a server-side one.
|
|
12
|
+
*/
|
|
13
|
+
const A2UI_SCHEMA_CONTEXT_DESCRIPTION = "A2UI Component Schema — available components for generating UI surfaces. Use these component names and properties when creating A2UI operations.";
|
|
14
|
+
function createCatalog(definitions, renderers, options) {
|
|
15
|
+
const catalogId = options?.catalogId ?? "copilotkit://custom-catalog";
|
|
16
|
+
const customComponents = [];
|
|
17
|
+
for (const [name, def] of Object.entries(definitions)) {
|
|
18
|
+
const api = {
|
|
19
|
+
name,
|
|
20
|
+
schema: def.props
|
|
21
|
+
};
|
|
22
|
+
const renderer = renderers[name];
|
|
23
|
+
if (renderer === void 0) throw new Error(`Missing renderer for component "${name}"`);
|
|
24
|
+
customComponents.push(createLitComponent(api, ({ props, buildChild, context }) => renderer({
|
|
25
|
+
props,
|
|
26
|
+
children: buildChild,
|
|
27
|
+
dispatch: (action) => context.dispatchAction(action)
|
|
28
|
+
})));
|
|
29
|
+
}
|
|
30
|
+
return new Catalog(catalogId, options?.includeBasicCatalog === true ? [...Array.from(basicCatalog.components.values()), ...customComponents] : customComponents, options?.includeBasicCatalog === true ? Array.from(basicCatalog.functions.values()) : []);
|
|
31
|
+
}
|
|
32
|
+
function extractSchema(definitions) {
|
|
33
|
+
return Object.entries(definitions).map(([name, def]) => ({
|
|
34
|
+
name,
|
|
35
|
+
description: def.description,
|
|
36
|
+
props: zodSchemaToSimpleObject(def.props)
|
|
37
|
+
}));
|
|
38
|
+
}
|
|
39
|
+
function zodSchemaToSimpleObject(schema) {
|
|
40
|
+
const shape = schema.shape;
|
|
41
|
+
const properties = {};
|
|
42
|
+
for (const [key, value] of Object.entries(shape)) {
|
|
43
|
+
const zodValue = value;
|
|
44
|
+
properties[key] = {
|
|
45
|
+
type: zodValue._def?.typeName ?? "unknown",
|
|
46
|
+
...zodValue.description ? { description: zodValue.description } : {}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
type: "object",
|
|
51
|
+
properties
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function createA2UICatalog(components, options) {
|
|
55
|
+
const definitions = {};
|
|
56
|
+
const renderers = {};
|
|
57
|
+
for (const [name, def] of Object.entries(components)) {
|
|
58
|
+
definitions[name] = {
|
|
59
|
+
props: def.props,
|
|
60
|
+
description: def.description
|
|
61
|
+
};
|
|
62
|
+
renderers[name] = def.render;
|
|
63
|
+
}
|
|
64
|
+
return createCatalog(definitions, renderers, options);
|
|
65
|
+
}
|
|
66
|
+
function extractA2UISchema(components) {
|
|
67
|
+
const definitions = {};
|
|
68
|
+
for (const [name, def] of Object.entries(components)) definitions[name] = {
|
|
69
|
+
props: def.props,
|
|
70
|
+
description: def.description
|
|
71
|
+
};
|
|
72
|
+
return extractSchema(definitions);
|
|
73
|
+
}
|
|
74
|
+
function isCatalogContextValue(value) {
|
|
75
|
+
return typeof value === "object" && value !== null && "id" in value && typeof value.id === "string" && "components" in value && value.components instanceof Map;
|
|
76
|
+
}
|
|
77
|
+
function resolveCatalog(catalog) {
|
|
78
|
+
return isCatalogContextValue(catalog) ? catalog : basicCatalog;
|
|
79
|
+
}
|
|
80
|
+
function toJsonSchema(schema, options) {
|
|
81
|
+
return zodToJsonSchema(schema, options);
|
|
82
|
+
}
|
|
83
|
+
function extendsBasicCatalog(catalog) {
|
|
84
|
+
for (const name of basicCatalog.components.keys()) if (!catalog.components.has(name)) return false;
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
function getCustomComponentNames(catalog) {
|
|
88
|
+
const custom = [];
|
|
89
|
+
for (const name of catalog.components.keys()) if (!basicCatalog.components.has(name)) custom.push(name);
|
|
90
|
+
return custom;
|
|
91
|
+
}
|
|
92
|
+
function buildCatalogContextValue(catalog) {
|
|
93
|
+
const resolved = resolveCatalog(catalog);
|
|
94
|
+
const lines = ["Available A2UI catalog:"];
|
|
95
|
+
if (resolved.id === BASIC_CATALOG_ID) {
|
|
96
|
+
lines.push(`- ${resolved.id} (basic catalog)`);
|
|
97
|
+
return lines.join("\n");
|
|
98
|
+
}
|
|
99
|
+
const isSuperset = extendsBasicCatalog(resolved);
|
|
100
|
+
const customNames = getCustomComponentNames(resolved);
|
|
101
|
+
lines.push(`- ${resolved.id}`);
|
|
102
|
+
if (isSuperset) lines.push(" Extends the basic catalog with all standard components plus:");
|
|
103
|
+
else {
|
|
104
|
+
lines.push(" Custom catalog (does NOT include all basic components).");
|
|
105
|
+
lines.push(" Custom components:");
|
|
106
|
+
}
|
|
107
|
+
for (const name of customNames) {
|
|
108
|
+
const component = resolved.components.get(name);
|
|
109
|
+
if (!component) continue;
|
|
110
|
+
const jsonSchema = toJsonSchema(component.schema);
|
|
111
|
+
lines.push(` - ${name}:`);
|
|
112
|
+
lines.push(` ${JSON.stringify(jsonSchema, null, 2).split("\n").join("\n ")}`);
|
|
113
|
+
}
|
|
114
|
+
return lines.join("\n");
|
|
115
|
+
}
|
|
116
|
+
function extractCatalogComponentSchemas(catalog) {
|
|
117
|
+
const resolved = resolveCatalog(catalog);
|
|
118
|
+
const components = {};
|
|
119
|
+
for (const [name, comp] of resolved.components) {
|
|
120
|
+
const zodSchema = toJsonSchema(comp.schema, { target: "jsonSchema2019-09" });
|
|
121
|
+
components[name] = { allOf: [{ $ref: "common_types.json#/$defs/ComponentCommon" }, {
|
|
122
|
+
properties: {
|
|
123
|
+
component: { const: name },
|
|
124
|
+
...zodSchema.properties
|
|
125
|
+
},
|
|
126
|
+
required: ["component", ...zodSchema.required ?? []]
|
|
127
|
+
}] };
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
catalogId: resolved.id,
|
|
131
|
+
components
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
//#endregion
|
|
136
|
+
export { A2UI_SCHEMA_CONTEXT_DESCRIPTION, buildCatalogContextValue, createA2UICatalog, createCatalog, extractA2UISchema, extractCatalogComponentSchemas, extractSchema };
|
|
137
|
+
//# sourceMappingURL=create-catalog.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-catalog.mjs","names":[],"sources":["../../src/web-components/create-catalog.ts"],"sourcesContent":["import type { z } from \"zod\";\nimport type { ZodObject, ZodRawShape, ZodTypeAny } from \"zod\";\nimport { Catalog } from \"@a2ui/web_core/v0_9\";\nimport type { ComponentApi } from \"@a2ui/web_core/v0_9\";\nimport { zodToJsonSchema } from \"zod-to-json-schema\";\nimport { basicCatalog } from \"./catalog/basic\";\nimport { createLitComponent } from \"./adapter\";\nimport type {\n CatalogComponentDefinition,\n CatalogDefinitions,\n CatalogRenderers,\n ComponentRenderer,\n LitComponentImplementation,\n RendererProps,\n} from \"./types\";\n\nconst BASIC_CATALOG_ID =\n \"https://a2ui.org/specification/v0_9/basic_catalog.json\";\n\ntype CatalogContextComponent = {\n schema: unknown;\n};\n\ntype CatalogContextValue = {\n id: string;\n components: ReadonlyMap<string, CatalogContextComponent>;\n};\n\n/**\n * Context description used to identify the A2UI component schema in RunAgentInput.context.\n * Must match the constant in @ag-ui/a2ui-middleware so the middleware can overwrite\n * a frontend-provided schema with a server-side one.\n */\nexport const A2UI_SCHEMA_CONTEXT_DESCRIPTION =\n \"A2UI Component Schema — available components for generating UI surfaces. Use these component names and properties when creating A2UI operations.\";\n\nexport type {\n CatalogComponentDefinition,\n CatalogDefinitions,\n CatalogRenderers,\n ComponentRenderer,\n RendererProps,\n} from \"./types\";\n\nexport function createCatalog<D extends CatalogDefinitions>(\n definitions: D,\n renderers: CatalogRenderers<D>,\n options?: {\n catalogId?: string;\n includeBasicCatalog?: boolean;\n },\n): Catalog<LitComponentImplementation> {\n const catalogId = options?.catalogId ?? \"copilotkit://custom-catalog\";\n const customComponents: LitComponentImplementation[] = [];\n\n for (const [name, def] of Object.entries(definitions)) {\n const api: ComponentApi = {\n name,\n schema: def.props,\n };\n const renderer = (renderers as Record<string, ComponentRenderer<any>>)[\n name\n ];\n if (renderer === undefined) {\n throw new Error(`Missing renderer for component \"${name}\"`);\n }\n customComponents.push(\n createLitComponent(api, ({ props, buildChild, context }) =>\n renderer({\n props,\n children: buildChild,\n dispatch: (action: unknown) => context.dispatchAction(action),\n }),\n ),\n );\n }\n\n const components =\n options?.includeBasicCatalog === true\n ? [...Array.from(basicCatalog.components.values()), ...customComponents]\n : customComponents;\n const functions =\n options?.includeBasicCatalog === true\n ? Array.from(basicCatalog.functions.values())\n : [];\n\n return new Catalog<LitComponentImplementation>(\n catalogId,\n components,\n functions,\n );\n}\n\nexport function extractSchema(definitions: CatalogDefinitions): Array<{\n name: string;\n description?: string;\n props?: Record<string, unknown>;\n}> {\n return Object.entries(definitions).map(([name, def]) => ({\n name,\n description: def.description,\n props: zodSchemaToSimpleObject(def.props),\n }));\n}\n\nfunction zodSchemaToSimpleObject(\n schema: ZodObject<any>,\n): Record<string, unknown> {\n const shape = schema.shape;\n const properties: Record<string, { type: string; description?: string }> = {};\n for (const [key, value] of Object.entries(shape)) {\n const zodValue = value as any;\n properties[key] = {\n type: zodValue._def?.typeName ?? \"unknown\",\n ...(zodValue.description ? { description: zodValue.description } : {}),\n };\n }\n return { type: \"object\", properties };\n}\n\nexport interface A2UIComponentDefinition<T extends ZodRawShape = ZodRawShape> {\n props: ZodObject<T>;\n description?: string;\n render: (props: RendererProps<z.infer<ZodObject<T>>>) => unknown;\n}\n\nexport type A2UIComponentMap = Record<string, A2UIComponentDefinition<any>>;\n\nexport function createA2UICatalog(\n components: A2UIComponentMap,\n options?: {\n catalogId?: string;\n includeBasicCatalog?: boolean;\n },\n): Catalog<LitComponentImplementation> {\n const definitions: CatalogDefinitions = {};\n const renderers: Record<string, ComponentRenderer<any>> = {};\n\n for (const [name, def] of Object.entries(components)) {\n definitions[name] = { props: def.props, description: def.description };\n renderers[name] = def.render as ComponentRenderer<any>;\n }\n\n return createCatalog(definitions, renderers as any, options);\n}\n\nexport function extractA2UISchema(components: A2UIComponentMap): Array<{\n name: string;\n description?: string;\n props?: Record<string, unknown>;\n}> {\n const definitions: CatalogDefinitions = {};\n for (const [name, def] of Object.entries(components)) {\n definitions[name] = { props: def.props, description: def.description };\n }\n return extractSchema(definitions);\n}\n\nfunction isCatalogContextValue(value: unknown): value is CatalogContextValue {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"id\" in value &&\n typeof value.id === \"string\" &&\n \"components\" in value &&\n value.components instanceof Map\n );\n}\n\nfunction resolveCatalog(catalog?: unknown): CatalogContextValue {\n return isCatalogContextValue(catalog) ? catalog : basicCatalog;\n}\n\nfunction toJsonSchema(\n schema: unknown,\n options?: Parameters<typeof zodToJsonSchema>[1],\n): ReturnType<typeof zodToJsonSchema> {\n return zodToJsonSchema(schema as ZodTypeAny, options);\n}\n\nfunction extendsBasicCatalog(catalog: CatalogContextValue): boolean {\n for (const name of basicCatalog.components.keys()) {\n if (!catalog.components.has(name)) {\n return false;\n }\n }\n return true;\n}\n\nfunction getCustomComponentNames(catalog: CatalogContextValue): string[] {\n const custom: string[] = [];\n for (const name of catalog.components.keys()) {\n if (!basicCatalog.components.has(name)) {\n custom.push(name);\n }\n }\n return custom;\n}\n\nexport function buildCatalogContextValue(catalog?: unknown): string {\n const resolved = resolveCatalog(catalog);\n const lines: string[] = [\"Available A2UI catalog:\"];\n\n if (resolved.id === BASIC_CATALOG_ID) {\n lines.push(`- ${resolved.id} (basic catalog)`);\n return lines.join(\"\\n\");\n }\n\n const isSuperset = extendsBasicCatalog(resolved);\n const customNames = getCustomComponentNames(resolved);\n\n lines.push(`- ${resolved.id}`);\n if (isSuperset) {\n lines.push(\n \" Extends the basic catalog with all standard components plus:\",\n );\n } else {\n lines.push(\" Custom catalog (does NOT include all basic components).\");\n lines.push(\" Custom components:\");\n }\n\n for (const name of customNames) {\n const component = resolved.components.get(name);\n if (!component) continue;\n const jsonSchema = toJsonSchema(component.schema);\n lines.push(` - ${name}:`);\n lines.push(\n ` ${JSON.stringify(jsonSchema, null, 2).split(\"\\n\").join(\"\\n \")}`,\n );\n }\n\n return lines.join(\"\\n\");\n}\n\nexport interface InlineCatalogSchema {\n catalogId: string;\n components: Record<string, Record<string, unknown>>;\n}\n\nexport function extractCatalogComponentSchemas(\n catalog?: unknown,\n): InlineCatalogSchema {\n const resolved = resolveCatalog(catalog);\n const components: Record<string, Record<string, unknown>> = {};\n for (const [name, comp] of resolved.components) {\n const zodSchema = toJsonSchema(comp.schema, {\n target: \"jsonSchema2019-09\",\n }) as { properties?: Record<string, unknown>; required?: string[] };\n components[name] = {\n allOf: [\n { $ref: \"common_types.json#/$defs/ComponentCommon\" },\n {\n properties: {\n component: { const: name },\n ...zodSchema.properties,\n },\n required: [\"component\", ...(zodSchema.required ?? [])],\n },\n ],\n };\n }\n return { catalogId: resolved.id, components };\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_bound_component = require('./bound-component.cjs');
|
|
3
|
+
const require_node = require('./node.cjs');
|
|
4
|
+
const require_surface = require('./surface.cjs');
|
|
5
|
+
|
|
6
|
+
//#region src/web-components/define.ts
|
|
7
|
+
const CPK_A2UI_SURFACE_TAG = "cpk-a2ui-surface";
|
|
8
|
+
const CPK_A2UI_NODE_TAG = "cpk-a2ui-node";
|
|
9
|
+
const CPK_A2UI_BOUND_COMPONENT_TAG = "cpk-a2ui-bound-component";
|
|
10
|
+
function defineA2UIWebComponents() {
|
|
11
|
+
if (!customElements.get(CPK_A2UI_BOUND_COMPONENT_TAG)) customElements.define(CPK_A2UI_BOUND_COMPONENT_TAG, require_bound_component.CpkA2uiBoundComponent);
|
|
12
|
+
if (!customElements.get(CPK_A2UI_NODE_TAG)) customElements.define(CPK_A2UI_NODE_TAG, require_node.CpkA2uiNode);
|
|
13
|
+
if (!customElements.get(CPK_A2UI_SURFACE_TAG)) customElements.define(CPK_A2UI_SURFACE_TAG, require_surface.CpkA2uiSurface);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
exports.CPK_A2UI_BOUND_COMPONENT_TAG = CPK_A2UI_BOUND_COMPONENT_TAG;
|
|
18
|
+
exports.CPK_A2UI_NODE_TAG = CPK_A2UI_NODE_TAG;
|
|
19
|
+
exports.CPK_A2UI_SURFACE_TAG = CPK_A2UI_SURFACE_TAG;
|
|
20
|
+
exports.CpkA2uiBoundComponent = require_bound_component.CpkA2uiBoundComponent;
|
|
21
|
+
exports.CpkA2uiNode = require_node.CpkA2uiNode;
|
|
22
|
+
exports.CpkA2uiSurface = require_surface.CpkA2uiSurface;
|
|
23
|
+
exports.defineA2UIWebComponents = defineA2UIWebComponents;
|
|
24
|
+
//# sourceMappingURL=define.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.cjs","names":["CpkA2uiBoundComponent","CpkA2uiNode","CpkA2uiSurface"],"sources":["../../src/web-components/define.ts"],"sourcesContent":["import { CpkA2uiBoundComponent } from \"./bound-component\";\nimport { CpkA2uiNode } from \"./node\";\nimport { CpkA2uiSurface } from \"./surface\";\n\nexport const CPK_A2UI_SURFACE_TAG = \"cpk-a2ui-surface\";\nexport const CPK_A2UI_NODE_TAG = \"cpk-a2ui-node\";\nexport const CPK_A2UI_BOUND_COMPONENT_TAG = \"cpk-a2ui-bound-component\";\n\nexport function defineA2UIWebComponents(): void {\n if (!customElements.get(CPK_A2UI_BOUND_COMPONENT_TAG)) {\n customElements.define(CPK_A2UI_BOUND_COMPONENT_TAG, CpkA2uiBoundComponent);\n }\n if (!customElements.get(CPK_A2UI_NODE_TAG)) {\n customElements.define(CPK_A2UI_NODE_TAG, CpkA2uiNode);\n }\n if (!customElements.get(CPK_A2UI_SURFACE_TAG)) {\n customElements.define(CPK_A2UI_SURFACE_TAG, CpkA2uiSurface);\n }\n}\n\nexport { CpkA2uiSurface, CpkA2uiNode, CpkA2uiBoundComponent };\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"cpk-a2ui-surface\": CpkA2uiSurface;\n \"cpk-a2ui-node\": CpkA2uiNode;\n \"cpk-a2ui-bound-component\": CpkA2uiBoundComponent;\n }\n}\n"],"mappings":";;;;;;AAIA,MAAa,uBAAuB;AACpC,MAAa,oBAAoB;AACjC,MAAa,+BAA+B;AAE5C,SAAgB,0BAAgC;AAC9C,KAAI,CAAC,eAAe,IAAI,6BAA6B,CACnD,gBAAe,OAAO,8BAA8BA,8CAAsB;AAE5E,KAAI,CAAC,eAAe,IAAI,kBAAkB,CACxC,gBAAe,OAAO,mBAAmBC,yBAAY;AAEvD,KAAI,CAAC,eAAe,IAAI,qBAAqB,CAC3C,gBAAe,OAAO,sBAAsBC,+BAAe"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CpkA2uiBoundComponent } from "./bound-component.cjs";
|
|
2
|
+
import { CpkA2uiNode } from "./node.cjs";
|
|
3
|
+
import { CpkA2uiSurface } from "./surface.cjs";
|
|
4
|
+
|
|
5
|
+
//#region src/web-components/define.d.ts
|
|
6
|
+
declare const CPK_A2UI_SURFACE_TAG = "cpk-a2ui-surface";
|
|
7
|
+
declare const CPK_A2UI_NODE_TAG = "cpk-a2ui-node";
|
|
8
|
+
declare const CPK_A2UI_BOUND_COMPONENT_TAG = "cpk-a2ui-bound-component";
|
|
9
|
+
declare function defineA2UIWebComponents(): void;
|
|
10
|
+
declare global {
|
|
11
|
+
interface HTMLElementTagNameMap {
|
|
12
|
+
"cpk-a2ui-surface": CpkA2uiSurface;
|
|
13
|
+
"cpk-a2ui-node": CpkA2uiNode;
|
|
14
|
+
"cpk-a2ui-bound-component": CpkA2uiBoundComponent;
|
|
15
|
+
}
|
|
16
|
+
} //# sourceMappingURL=define.d.ts.map
|
|
17
|
+
//#endregion
|
|
18
|
+
export { CPK_A2UI_BOUND_COMPONENT_TAG, CPK_A2UI_NODE_TAG, CPK_A2UI_SURFACE_TAG, CpkA2uiBoundComponent, CpkA2uiNode, CpkA2uiSurface, defineA2UIWebComponents };
|
|
19
|
+
//# sourceMappingURL=define.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.d.cts","names":[],"sources":["../../src/web-components/define.ts"],"mappings":";;;;;cAIa,oBAAA;AAAA,cACA,iBAAA;AAAA,cACA,4BAAA;AAAA,iBAEG,uBAAA,CAAA;AAAA,QAcR,MAAA;EAAA,UACI,qBAAA;IACR,kBAAA,EAAoB,cAAA;IACpB,eAAA,EAAiB,WAAA;IACjB,0BAAA,EAA4B,qBAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CpkA2uiBoundComponent } from "./bound-component.mjs";
|
|
2
|
+
import { CpkA2uiNode } from "./node.mjs";
|
|
3
|
+
import { CpkA2uiSurface } from "./surface.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/web-components/define.d.ts
|
|
6
|
+
declare const CPK_A2UI_SURFACE_TAG = "cpk-a2ui-surface";
|
|
7
|
+
declare const CPK_A2UI_NODE_TAG = "cpk-a2ui-node";
|
|
8
|
+
declare const CPK_A2UI_BOUND_COMPONENT_TAG = "cpk-a2ui-bound-component";
|
|
9
|
+
declare function defineA2UIWebComponents(): void;
|
|
10
|
+
declare global {
|
|
11
|
+
interface HTMLElementTagNameMap {
|
|
12
|
+
"cpk-a2ui-surface": CpkA2uiSurface;
|
|
13
|
+
"cpk-a2ui-node": CpkA2uiNode;
|
|
14
|
+
"cpk-a2ui-bound-component": CpkA2uiBoundComponent;
|
|
15
|
+
}
|
|
16
|
+
} //# sourceMappingURL=define.d.ts.map
|
|
17
|
+
//#endregion
|
|
18
|
+
export { CPK_A2UI_BOUND_COMPONENT_TAG, CPK_A2UI_NODE_TAG, CPK_A2UI_SURFACE_TAG, CpkA2uiBoundComponent, CpkA2uiNode, CpkA2uiSurface, defineA2UIWebComponents };
|
|
19
|
+
//# sourceMappingURL=define.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.d.mts","names":[],"sources":["../../src/web-components/define.ts"],"mappings":";;;;;cAIa,oBAAA;AAAA,cACA,iBAAA;AAAA,cACA,4BAAA;AAAA,iBAEG,uBAAA,CAAA;AAAA,QAcR,MAAA;EAAA,UACI,qBAAA;IACR,kBAAA,EAAoB,cAAA;IACpB,eAAA,EAAiB,WAAA;IACjB,0BAAA,EAA4B,qBAAA;EAAA;AAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CpkA2uiBoundComponent } from "./bound-component.mjs";
|
|
2
|
+
import { CpkA2uiNode } from "./node.mjs";
|
|
3
|
+
import { CpkA2uiSurface } from "./surface.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/web-components/define.ts
|
|
6
|
+
const CPK_A2UI_SURFACE_TAG = "cpk-a2ui-surface";
|
|
7
|
+
const CPK_A2UI_NODE_TAG = "cpk-a2ui-node";
|
|
8
|
+
const CPK_A2UI_BOUND_COMPONENT_TAG = "cpk-a2ui-bound-component";
|
|
9
|
+
function defineA2UIWebComponents() {
|
|
10
|
+
if (!customElements.get(CPK_A2UI_BOUND_COMPONENT_TAG)) customElements.define(CPK_A2UI_BOUND_COMPONENT_TAG, CpkA2uiBoundComponent);
|
|
11
|
+
if (!customElements.get(CPK_A2UI_NODE_TAG)) customElements.define(CPK_A2UI_NODE_TAG, CpkA2uiNode);
|
|
12
|
+
if (!customElements.get(CPK_A2UI_SURFACE_TAG)) customElements.define(CPK_A2UI_SURFACE_TAG, CpkA2uiSurface);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { CPK_A2UI_BOUND_COMPONENT_TAG, CPK_A2UI_NODE_TAG, CPK_A2UI_SURFACE_TAG, CpkA2uiBoundComponent, CpkA2uiNode, CpkA2uiSurface, defineA2UIWebComponents };
|
|
17
|
+
//# sourceMappingURL=define.mjs.map
|