ain-ui 0.2.3 → 1.0.4

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.
Files changed (56) hide show
  1. package/NOTICE +37 -0
  2. package/README.md +179 -77
  3. package/dist/agent.d.ts +131 -0
  4. package/dist/agent.js +822 -0
  5. package/dist/ainui.d.ts +15 -1
  6. package/dist/ainui.js +53 -10
  7. package/dist/basic.d.ts +5 -47
  8. package/dist/basic.js +22 -29
  9. package/dist/catalog/standard.gen.d.ts +5 -0
  10. package/dist/catalog/standard.gen.js +6 -0
  11. package/dist/catalog-v1.json +2560 -0
  12. package/dist/catalog.json +19917 -2061
  13. package/dist/chat.js +6 -7
  14. package/dist/expression.d.ts +23 -0
  15. package/dist/expression.js +222 -0
  16. package/dist/index.d.ts +2 -0
  17. package/dist/index.js +2 -0
  18. package/dist/macros.d.ts +12 -0
  19. package/dist/macros.js +57 -0
  20. package/dist/payment.js +6 -7
  21. package/dist/pickers.d.ts +158 -0
  22. package/dist/pickers.js +110 -0
  23. package/dist/protocol.d.ts +100 -0
  24. package/dist/protocol.js +232 -0
  25. package/dist/react/ain.d.ts +1 -0
  26. package/dist/react/ain.js +225 -0
  27. package/dist/react/catalog.d.ts +9 -0
  28. package/dist/react/catalog.js +23 -0
  29. package/dist/react/core.d.ts +91 -0
  30. package/dist/react/core.js +173 -0
  31. package/dist/react/functions.d.ts +2 -0
  32. package/dist/react/functions.js +29 -0
  33. package/dist/react/standard/composites.d.ts +1 -0
  34. package/dist/react/standard/composites.js +110 -0
  35. package/dist/react/standard/data.d.ts +1 -0
  36. package/dist/react/standard/data.js +481 -0
  37. package/dist/react/standard/feedback.d.ts +11 -0
  38. package/dist/react/standard/feedback.js +111 -0
  39. package/dist/react/standard/inputs.d.ts +5 -0
  40. package/dist/react/standard/inputs.js +467 -0
  41. package/dist/react/standard/layout.d.ts +5 -0
  42. package/dist/react/standard/layout.js +104 -0
  43. package/dist/react/standard/media.d.ts +33 -0
  44. package/dist/react/standard/media.js +208 -0
  45. package/dist/react/standard/rich.d.ts +1 -0
  46. package/dist/react/standard/rich.js +146 -0
  47. package/dist/react/standard/text.d.ts +9 -0
  48. package/dist/react/standard/text.js +209 -0
  49. package/dist/react/surface.d.ts +46 -0
  50. package/dist/react/surface.js +134 -0
  51. package/dist/react.d.ts +3 -35
  52. package/dist/react.js +3 -272
  53. package/dist/renderer.d.ts +1 -1
  54. package/dist/renderer.js +299 -4
  55. package/dist/styles.css +805 -20
  56. package/package.json +28 -11
@@ -0,0 +1,100 @@
1
+ /**
2
+ * A2UI wire versions and the conversion between them.
3
+ *
4
+ * AIN-UI speaks A2UI 1.0. Producers written against v0.9 (and AINUI v1, its catalog) still work: `upgradeMessages`
5
+ * rewrites what they send into 1.0, position by position — the spec forbids a blanket rename, because `path` in
6
+ * `updateDataModel` and in a child template stays `path` while a data binding becomes `@path`.
7
+ *
8
+ * Pure: no IO, no DOM.
9
+ */
10
+ export declare const A2UI_VERSION: "1.0";
11
+ export declare const A2UI_V09: "v0.9";
12
+ export declare const A2UI_MIME = "application/a2ui+json";
13
+ /** The MIME type v0.9 used; still accepted on input. */
14
+ export declare const A2UI_MIME_V09 = "application/json+a2ui";
15
+ export declare const A2UI_BASIC_CATALOG = "https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json";
16
+ export declare const A2UI_BASIC_CATALOG_V09 = "https://a2ui.org/specification/v0_9/catalogs/basic/catalog.json";
17
+ /** AIN-UI's catalog for A2UI 1.0: the standard components plus the AIN ones (files, upload, payment, pickers). */
18
+ export declare const AINUI_CATALOG = "https://ainui.ainetwork.xyz/catalogs/ainui/v2/catalog.json";
19
+ /** AINUI v1 (A2UI v0.9). Surfaces that name it are upgraded to the v2 catalog. */
20
+ export declare const AINUI_CATALOG_V1 = "https://aindrive.ainetwork.ai/ainui/v1/catalog.json";
21
+ export type A2uiComponent = {
22
+ id: string;
23
+ component: string;
24
+ } & Record<string, unknown>;
25
+ export type A2uiMessage = {
26
+ version: string;
27
+ createSurface: {
28
+ surfaceId: string;
29
+ catalogId?: string;
30
+ components?: A2uiComponent[];
31
+ dataModel?: Record<string, unknown>;
32
+ sendDataModel?: boolean;
33
+ metadata?: Record<string, unknown>;
34
+ };
35
+ } | {
36
+ version: string;
37
+ updateComponents: {
38
+ surfaceId: string;
39
+ components: A2uiComponent[];
40
+ };
41
+ } | {
42
+ version: string;
43
+ updateDataModel: {
44
+ surfaceId: string;
45
+ path?: string;
46
+ value?: unknown;
47
+ };
48
+ } | {
49
+ version: string;
50
+ deleteSurface: {
51
+ surfaceId: string;
52
+ };
53
+ };
54
+ /** Renderer→agent user action. */
55
+ export type A2uiAction = {
56
+ name: string;
57
+ surfaceId?: string;
58
+ sourceComponentId?: string;
59
+ timestamp?: string;
60
+ context?: Record<string, unknown>;
61
+ };
62
+ export type WireVersion = typeof A2UI_VERSION | typeof A2UI_V09;
63
+ /**
64
+ * What the builders (ainuiFolder, a2uiForSkill, ainuiPayment, the pickers, …) emit. "1.0" by default. A host
65
+ * whose callers still speak A2UI v0.9 (an MCP client, an A2A agent that asked for the v0.9 extension) sets
66
+ * "v0.9" and gets exactly what ain-ui 0.x produced: v0.9 messages naming the v0.9 basic catalog or AINUI v1.
67
+ * The renderers read both, so a host's own pages are unaffected by this choice.
68
+ */
69
+ export declare function setA2uiWireVersion(version: WireVersion): void;
70
+ export declare const a2uiWireVersion: () => WireVersion;
71
+ /** Builders write v0.9; this is where that becomes what the host asked for. */
72
+ export declare const emitMessages: (messages: readonly unknown[]) => A2uiMessage[];
73
+ /** Is this message written for a version before 1.0? */
74
+ export declare const isLegacyMessage: (m: unknown) => boolean;
75
+ /**
76
+ * v0.9 (and v0.9.1) messages → 1.0. Messages already at 1.0 pass through untouched, so a mixed list is fine.
77
+ * A v0.9 surface that names the basic catalog moves to the 1.0 basic catalog; one that names AINUI v1 moves to v2.
78
+ */
79
+ export declare function upgradeMessages(messages: readonly unknown[]): A2uiMessage[];
80
+ /**
81
+ * 1.0 messages in the layout the dependency-free DOM renderer works with: one message per operation, bindings
82
+ * as `{path}`. A `createSurface` that carries its components and data is split into the three operations.
83
+ */
84
+ export declare function flattenMessages(messages: readonly unknown[]): A2uiMessage[];
85
+ /**
86
+ * Accept the shapes renderers actually send: a client event `{version, action}`, a bare `action` object,
87
+ * `{action}`, or AG-UI/CopilotKit's `{userAction}` (forwardedProps.a2uiAction).
88
+ */
89
+ export declare function parseA2uiAction(input: unknown): A2uiAction | null;
90
+ /** The 1.0 envelope a renderer sends for a user action. */
91
+ export declare const actionMessage: (action: A2uiAction) => {
92
+ version: "1.0";
93
+ action: {
94
+ name: string;
95
+ surfaceId?: string;
96
+ sourceComponentId?: string;
97
+ timestamp: string;
98
+ context?: Record<string, unknown>;
99
+ };
100
+ };
@@ -0,0 +1,232 @@
1
+ /**
2
+ * A2UI wire versions and the conversion between them.
3
+ *
4
+ * AIN-UI speaks A2UI 1.0. Producers written against v0.9 (and AINUI v1, its catalog) still work: `upgradeMessages`
5
+ * rewrites what they send into 1.0, position by position — the spec forbids a blanket rename, because `path` in
6
+ * `updateDataModel` and in a child template stays `path` while a data binding becomes `@path`.
7
+ *
8
+ * Pure: no IO, no DOM.
9
+ */
10
+ export const A2UI_VERSION = "1.0";
11
+ export const A2UI_V09 = "v0.9";
12
+ export const A2UI_MIME = "application/a2ui+json";
13
+ /** The MIME type v0.9 used; still accepted on input. */
14
+ export const A2UI_MIME_V09 = "application/json+a2ui";
15
+ export const A2UI_BASIC_CATALOG = "https://a2ui.org/specification/v1_0/catalogs/basic/catalog.json";
16
+ export const A2UI_BASIC_CATALOG_V09 = "https://a2ui.org/specification/v0_9/catalogs/basic/catalog.json";
17
+ /** AIN-UI's catalog for A2UI 1.0: the standard components plus the AIN ones (files, upload, payment, pickers). */
18
+ export const AINUI_CATALOG = "https://ainui.ainetwork.xyz/catalogs/ainui/v2/catalog.json";
19
+ /** AINUI v1 (A2UI v0.9). Surfaces that name it are upgraded to the v2 catalog. */
20
+ export const AINUI_CATALOG_V1 = "https://aindrive.ainetwork.ai/ainui/v1/catalog.json";
21
+ const isObject = (v) => !!v && typeof v === "object" && !Array.isArray(v);
22
+ const only = (o, ...keys) => Object.keys(o).every((k) => keys.includes(k));
23
+ /** A v0.9 data binding is `{path}` and nothing else; a child template has `componentId` beside it. */
24
+ const isBinding09 = (v) => isObject(v) && typeof v.path === "string" && only(v, "path");
25
+ const isCall09 = (v) => isObject(v) && typeof v.call === "string" && only(v, "call", "args", "returnType");
26
+ const isTemplate = (v) => isObject(v) && typeof v.componentId === "string" && typeof v.path === "string";
27
+ /** Rewrites bindings and function calls inside one property value. Literal data is left as it is. */
28
+ function upgradeValue(v) {
29
+ if (Array.isArray(v))
30
+ return v.map(upgradeValue);
31
+ if (!isObject(v))
32
+ return v;
33
+ if (isBinding09(v))
34
+ return { "@path": v.path };
35
+ if (isCall09(v))
36
+ return { "@call": v.call, ...(v.args === undefined ? {} : { args: upgradeValue(v.args) }) };
37
+ if (isTemplate(v))
38
+ return v;
39
+ return Object.fromEntries(Object.entries(v).map(([k, x]) => [k, upgradeValue(x)]));
40
+ }
41
+ const HEADING = /^h([1-5])$/;
42
+ const TITLE_SIZE = { 1: "2xl", 2: "xl", 3: "lg", 4: "md", 5: "sm" };
43
+ /** Text in v0.9 carried headings as `variant: h1…h5`; 1.0 keeps only `caption` and `body`. */
44
+ function upgradeText(c, toAinui) {
45
+ const { variant, ...rest } = c;
46
+ const level = typeof variant === "string" ? HEADING.exec(variant)?.[1] : undefined;
47
+ if (toAinui) {
48
+ if (level)
49
+ return { ...rest, component: "Title", size: TITLE_SIZE[level] };
50
+ if (variant === "caption")
51
+ return { ...rest, component: "Caption" };
52
+ return rest;
53
+ }
54
+ if (level) {
55
+ // The basic catalog renders Markdown in Text.text: a heading is `#` marks before the words.
56
+ const marks = "#".repeat(Number(level)) + " ";
57
+ const t = rest.text;
58
+ const bound = isObject(t) && typeof t["@path"] === "string";
59
+ return { ...rest, text: bound ? { "@call": "formatString", args: { value: `${marks}\${${t["@path"]}}` } } : `${marks}${String(t ?? "")}` };
60
+ }
61
+ return (variant === "caption" || variant === "body" ? { ...rest, variant } : rest);
62
+ }
63
+ function upgradeComponent(c, toAinui) {
64
+ const out = {};
65
+ for (const [k, v] of Object.entries(c)) {
66
+ // v0.9 producers (AINUI v1 included) wrote null for "not set"; in 1.0 an optional prop is left out instead
67
+ if (v === null && k !== "id" && k !== "component")
68
+ continue;
69
+ if (k === "id" || k === "component")
70
+ out[k] = v;
71
+ else if (k === "checks")
72
+ out["@checks"] = upgradeValue(v);
73
+ else if (k === "accessibility")
74
+ out["@accessibility"] = upgradeValue(v);
75
+ else
76
+ out[k] = upgradeValue(v);
77
+ }
78
+ let next = out;
79
+ if (next.component === "List" && "listStyle" in next) {
80
+ const { listStyle: _gone, ...rest } = next;
81
+ next = rest;
82
+ }
83
+ if (next.component === "Text")
84
+ next = upgradeText(next, toAinui);
85
+ if (next.component === "TextField") {
86
+ if (typeof next.validationRegexp === "string") {
87
+ const { validationRegexp, ...rest } = next;
88
+ next = { ...rest, "@checks": [...(rest["@checks"] ?? []), { condition: { "@call": "regex", args: { value: rest.value, pattern: validationRegexp } }, message: "Invalid format" }] };
89
+ }
90
+ if (next.value === undefined)
91
+ next = { ...next, value: "" };
92
+ }
93
+ return next;
94
+ }
95
+ /**
96
+ * v0.9 took any string as a component id; 1.0 takes identifiers (`tile-0` is not one). Ids are renamed per surface
97
+ * (`tile-0` → `tile_0`) the same way in every message, and so are the places that name them.
98
+ */
99
+ const IDENT = /^[\p{ID_Start}_][\p{ID_Continue}]*$/u;
100
+ class IdNames {
101
+ bySurface = new Map();
102
+ name(surfaceId, id) {
103
+ if (typeof id !== "string" || IDENT.test(id))
104
+ return id;
105
+ let names = this.bySurface.get(surfaceId);
106
+ if (!names)
107
+ this.bySurface.set(surfaceId, (names = new Map()));
108
+ let next = names.get(id);
109
+ if (!next) {
110
+ const taken = new Set(names.values());
111
+ next = id.replace(/[^\p{ID_Continue}]/gu, "_").replace(/^(?![\p{ID_Start}_])/u, "_") || "_";
112
+ while (taken.has(next))
113
+ next += "_";
114
+ names.set(id, next);
115
+ }
116
+ return next;
117
+ }
118
+ /** A component with its id and every reference it makes renamed. */
119
+ component(surfaceId, c) {
120
+ const ref = (v) => this.name(surfaceId, v);
121
+ const out = { ...c, id: ref(c.id) };
122
+ for (const key of ["child", "trigger", "content"])
123
+ if (key in out)
124
+ out[key] = ref(out[key]);
125
+ if (Array.isArray(out.children))
126
+ out.children = out.children.map(ref);
127
+ else if (isObject(out.children) && typeof out.children.componentId === "string")
128
+ out.children = { ...out.children, componentId: ref(out.children.componentId) };
129
+ if (Array.isArray(out.tabs))
130
+ out.tabs = out.tabs.map((t) => (isObject(t) && "child" in t ? { ...t, child: ref(t.child) } : t));
131
+ if (Array.isArray(out.cellComponents))
132
+ out.cellComponents = out.cellComponents.map(ref);
133
+ return out;
134
+ }
135
+ }
136
+ const catalogFor = (id) => (id === A2UI_BASIC_CATALOG_V09 ? A2UI_BASIC_CATALOG : id === AINUI_CATALOG_V1 ? AINUI_CATALOG : id);
137
+ let wire = A2UI_VERSION;
138
+ /**
139
+ * What the builders (ainuiFolder, a2uiForSkill, ainuiPayment, the pickers, …) emit. "1.0" by default. A host
140
+ * whose callers still speak A2UI v0.9 (an MCP client, an A2A agent that asked for the v0.9 extension) sets
141
+ * "v0.9" and gets exactly what ain-ui 0.x produced: v0.9 messages naming the v0.9 basic catalog or AINUI v1.
142
+ * The renderers read both, so a host's own pages are unaffected by this choice.
143
+ */
144
+ export function setA2uiWireVersion(version) {
145
+ if (version !== A2UI_VERSION && version !== A2UI_V09)
146
+ throw new Error(`A2UI wire version must be "${A2UI_VERSION}" or "${A2UI_V09}"`);
147
+ wire = version;
148
+ }
149
+ export const a2uiWireVersion = () => wire;
150
+ /** Builders write v0.9; this is where that becomes what the host asked for. */
151
+ export const emitMessages = (messages) => (wire === A2UI_V09 ? messages : upgradeMessages(messages));
152
+ /** Is this message written for a version before 1.0? */
153
+ export const isLegacyMessage = (m) => isObject(m) && typeof m.version === "string" && m.version !== A2UI_VERSION;
154
+ /**
155
+ * v0.9 (and v0.9.1) messages → 1.0. Messages already at 1.0 pass through untouched, so a mixed list is fine.
156
+ * A v0.9 surface that names the basic catalog moves to the 1.0 basic catalog; one that names AINUI v1 moves to v2.
157
+ */
158
+ export function upgradeMessages(messages) {
159
+ const ainui = new Map();
160
+ const ids = new IdNames();
161
+ return messages.map((raw) => {
162
+ if (!isLegacyMessage(raw))
163
+ return raw;
164
+ const m = raw;
165
+ if (m.createSurface) {
166
+ const { theme: _theme, ...rest } = m.createSurface;
167
+ const catalogId = catalogFor(rest.catalogId);
168
+ ainui.set(rest.surfaceId, catalogId === AINUI_CATALOG);
169
+ return { version: A2UI_VERSION, createSurface: { ...rest, ...(catalogId ? { catalogId } : {}),
170
+ ...(rest.components ? { components: rest.components.map((c) => ids.component(rest.surfaceId, upgradeComponent(c, catalogId === AINUI_CATALOG))) } : {}) } };
171
+ }
172
+ if (m.updateComponents) {
173
+ const toAinui = ainui.get(m.updateComponents.surfaceId) ?? false;
174
+ const surfaceId = m.updateComponents.surfaceId;
175
+ return { version: A2UI_VERSION, updateComponents: { ...m.updateComponents, components: (m.updateComponents.components ?? []).map((c) => ids.component(surfaceId, upgradeComponent(c, toAinui))) } };
176
+ }
177
+ if (m.updateDataModel) {
178
+ // 1.0 requires `value`; null deletes the key, which is what an absent value meant in v0.9.
179
+ return { version: A2UI_VERSION, updateDataModel: { ...m.updateDataModel, value: m.updateDataModel.value === undefined ? null : m.updateDataModel.value } };
180
+ }
181
+ return { ...m, version: A2UI_VERSION };
182
+ });
183
+ }
184
+ function downgradeValue(v) {
185
+ if (Array.isArray(v))
186
+ return v.map(downgradeValue);
187
+ if (!isObject(v))
188
+ return v;
189
+ if (typeof v["@path"] === "string" && only(v, "@path"))
190
+ return { path: v["@path"] };
191
+ if (typeof v["@call"] === "string")
192
+ return { call: v["@call"], ...(v.args === undefined ? {} : { args: downgradeValue(v.args) }) };
193
+ return Object.fromEntries(Object.entries(v).map(([k, x]) => [k === "@checks" ? "checks" : k === "@accessibility" ? "accessibility" : k, downgradeValue(x)]));
194
+ }
195
+ /**
196
+ * 1.0 messages in the layout the dependency-free DOM renderer works with: one message per operation, bindings
197
+ * as `{path}`. A `createSurface` that carries its components and data is split into the three operations.
198
+ */
199
+ export function flattenMessages(messages) {
200
+ const out = [];
201
+ for (const raw of upgradeMessages(messages)) {
202
+ if (raw.createSurface) {
203
+ const { components, dataModel, ...rest } = raw.createSurface;
204
+ out.push({ version: A2UI_VERSION, createSurface: rest });
205
+ if (components)
206
+ out.push({ version: A2UI_VERSION, updateComponents: { surfaceId: rest.surfaceId, components: components.map(downgradeValue) } });
207
+ if (dataModel !== undefined)
208
+ out.push({ version: A2UI_VERSION, updateDataModel: { surfaceId: rest.surfaceId, path: "/", value: dataModel } });
209
+ }
210
+ else if (raw.updateComponents) {
211
+ out.push({ version: A2UI_VERSION, updateComponents: { ...raw.updateComponents, components: raw.updateComponents.components.map(downgradeValue) } });
212
+ }
213
+ else
214
+ out.push(raw);
215
+ }
216
+ return out;
217
+ }
218
+ /**
219
+ * Accept the shapes renderers actually send: a client event `{version, action}`, a bare `action` object,
220
+ * `{action}`, or AG-UI/CopilotKit's `{userAction}` (forwardedProps.a2uiAction).
221
+ */
222
+ export function parseA2uiAction(input) {
223
+ if (!isObject(input))
224
+ return null;
225
+ const candidate = (input.action ?? input.userAction ?? input);
226
+ if (typeof candidate?.name !== "string")
227
+ return null;
228
+ const context = isObject(candidate.context) ? candidate.context : {};
229
+ return { ...candidate, name: candidate.name, context };
230
+ }
231
+ /** The 1.0 envelope a renderer sends for a user action. */
232
+ export const actionMessage = (action) => ({ version: A2UI_VERSION, action: { timestamp: new Date().toISOString(), ...action } });
@@ -0,0 +1 @@
1
+ export declare const ain: import("@a2ui/react").ReactComponentImplementation<import("zod").ZodTypeAny>[];
@@ -0,0 +1,225 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ /**
4
+ * The AIN components of the AINUI catalog: files, upload, payment, folder chat and the two pickers.
5
+ * They sit beside the standard components (./standard) in one catalog (./catalog.ts).
6
+ */
7
+ import React, { useEffect, useMemo, useRef, useState } from "react";
8
+ import { createBinderlessComponentImplementation, useSignalValue } from "@a2ui/react";
9
+ import { AINUI_UPLOAD_MAX_BYTES } from "../ainui.js";
10
+ import { AGENT_SCOPES, AGENT_STATUS_LABEL, AVAILABILITY_LABEL, FILE_SCOPES, MORE_LABEL, PAID_BADGE, ROLE_LABEL, SHARE_ORIGIN_LABEL, VISIBILITY_LABEL, agentKey, agentPickReason, capabilityLines, fileKey, filePickReason, } from "../pickers.js";
11
+ import { STANDARD, boundPath, fire, safeUrl, useHost } from "./core.js";
12
+ const box = { display: "flex", flexDirection: "column", gap: 8, minWidth: 0 };
13
+ const button = { padding: "8px 12px", border: "1px solid #8885", borderRadius: 8, color: "inherit", background: "transparent" };
14
+ function useValue(ctx, raw) {
15
+ const signal = useMemo(() => ctx.dataContext.resolveSignal(raw), [ctx, raw]);
16
+ return useSignalValue(signal);
17
+ }
18
+ function urlOf(value, resolver, download = false) {
19
+ return safeUrl(value && typeof value === "object" && "$asset" in value ? resolver(value.$asset, { download }) : value);
20
+ }
21
+ const fireAction = (ctx, extra = {}) => fire(ctx, "action", extra);
22
+ // A2UI owns state, bindings, action validation and surface lifecycle. These
23
+ // implementations add only AIN-UI's component views.
24
+ /** The component as the catalog declares it (src/catalog/ain.json); the view below binds its own properties. */
25
+ const api = (name, _shape) => STANDARD.components.get(name);
26
+ function Glyph({ kind }) {
27
+ const paths = { grid: "M3 3h6v6H3z M15 3h6v6h-6z M3 15h6v6H3z M15 15h6v6h-6z", list: "M8 5h13M8 12h13M8 19h13M3 5h.01M3 12h.01M3 19h.01", upload: "M12 16V3m-5 5 5-5 5 5M4 16v5h16v-5", folder: "M3 7V5h6l2 2h10v13H3z", file: "M5 3h9l5 5v13H5z M14 3v6h5" };
28
+ return _jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: paths[kind] }) });
29
+ }
30
+ const Toolbar = createBinderlessComponentImplementation(api("Toolbar"), ({ context, buildChild }) => {
31
+ const spec = context.componentModel.properties.children;
32
+ const rows = useValue(context, !Array.isArray(spec) && spec ? { "@path": spec.path } : []);
33
+ return _jsx("div", { className: "ainui-toolbar", children: Array.isArray(spec) ? spec.map(id => _jsx(React.Fragment, { children: buildChild(id) }, id)) :
34
+ (Array.isArray(rows) ? rows : []).map((_, i) => _jsx(React.Fragment, { children: buildChild(spec.componentId, `${spec.path}/${i}`) }, i)) });
35
+ });
36
+ const Tile = createBinderlessComponentImplementation(api("Tile"), ({ context }) => {
37
+ const p = context.componentModel.properties;
38
+ const media = useValue(context, p.media);
39
+ const label = useValue(context, p.label);
40
+ const caption = useValue(context, p.caption);
41
+ const kind = useValue(context, p.kind);
42
+ const resolver = useHost().resolveAsset;
43
+ const src = urlOf(media, resolver);
44
+ const [failed, setFailed] = useState(false);
45
+ useEffect(() => setFailed(false), [src]);
46
+ return _jsxs("button", { type: "button", className: "ainui-tile", onClick: () => void fireAction(context), children: [_jsx("span", { className: "ainui-tile-media", children: src && !failed ? _jsx("img", { src: src, alt: "", loading: "lazy", onError: () => setFailed(true) }) :
47
+ _jsx("span", { className: "ainui-tile-placeholder", children: _jsx(Glyph, { kind: kind === "folder" ? "folder" : "file" }) }) }), _jsx("span", { className: "ainui-tile-name", title: label, children: label }), _jsx("small", { className: "ainui-tile-caption", children: caption })] });
48
+ });
49
+ const FileView = createBinderlessComponentImplementation(api("FileView"), ({ context }) => {
50
+ const p = context.componentModel.properties;
51
+ const asset = useValue(context, p.src);
52
+ const name = useValue(context, p.name);
53
+ const mime = useValue(context, p.mime) || "";
54
+ const resolver = useHost().resolveAsset;
55
+ const src = urlOf(asset, resolver);
56
+ const render = useHost().renderFile;
57
+ const size = useValue(context, p.size);
58
+ if (render && src)
59
+ return _jsx(_Fragment, { children: render({ src, download: urlOf(asset, resolver, true), name, mime, size }) });
60
+ return _jsxs("div", { style: box, children: [src && (mime.startsWith("image/") ? _jsx("img", { src: src, alt: name, style: { maxHeight: "70vh", objectFit: "contain" } }) :
61
+ mime.startsWith("video/") ? _jsx("video", { controls: true, src: src }) : mime.startsWith("audio/") ? _jsx("audio", { controls: true, src: src }) :
62
+ mime === "application/pdf" ? _jsx("iframe", { title: name, src: src, style: { height: "70vh", border: 0 } }) : null), _jsx("strong", { children: name }), _jsx("a", { href: urlOf(asset, resolver, true), download: name, children: "Download" })] });
63
+ });
64
+ const Breadcrumbs = createBinderlessComponentImplementation(api("Breadcrumbs"), ({ context }) => {
65
+ const items = useValue(context, context.componentModel.properties.items) || [];
66
+ return _jsx("nav", { "aria-label": "Folder path", className: "ainui-breadcrumbs", children: items.map((item, i) => _jsxs(React.Fragment, { children: [i > 0 && _jsx("span", { className: "ainui-breadcrumb-separator", "aria-hidden": "true", children: "/" }), i === items.length - 1 ? _jsx("span", { "aria-current": "page", children: item.label }) :
67
+ _jsx("button", { onClick: () => void fireAction(context, { path: item.path }), children: item.label === "/" ? "Drive" : item.label })] }, i)) });
68
+ });
69
+ const Segmented = createBinderlessComponentImplementation(api("Segmented"), ({ context }) => {
70
+ const p = context.componentModel.properties;
71
+ const value = useValue(context, p.value);
72
+ return _jsx("div", { role: "group", "aria-label": "View options", className: "ainui-segmented", children: p.options.map((o) => _jsxs("button", { type: "button", "aria-pressed": value === o.value, onClick: () => {
73
+ const path = boundPath(context, "value");
74
+ if (path)
75
+ context.dataContext.set(path, o.value);
76
+ void fireAction(context, { value: o.value });
77
+ }, children: [(o.value === "grid" || o.value === "list") && _jsx(Glyph, { kind: o.value }), _jsx("span", { children: o.label })] }, o.value)) });
78
+ });
79
+ const FileUpload = createBinderlessComponentImplementation(api("FileUpload"), ({ context }) => {
80
+ const p = context.componentModel.properties;
81
+ const label = useValue(context, p.label) || "Upload file";
82
+ const [busy, setBusy] = useState(false);
83
+ const [error, setError] = useState("");
84
+ const input = useRef(null);
85
+ const limit = Math.min(Number(p.maxBytes) || AINUI_UPLOAD_MAX_BYTES, AINUI_UPLOAD_MAX_BYTES);
86
+ return _jsxs("div", { className: "ainui-upload", children: [_jsxs("button", { className: "ainui-button ainui-button-primary", type: "button", disabled: busy, onClick: () => input.current?.click(), children: [_jsx(Glyph, { kind: "upload" }), busy ? "Uploading…" : label] }), _jsx("input", { ref: input, hidden: true, tabIndex: -1, "aria-label": label, type: "file", disabled: busy, onChange: async (e) => {
87
+ const file = e.target.files?.[0];
88
+ e.target.value = "";
89
+ if (!file)
90
+ return;
91
+ if (file.size > limit) {
92
+ setError(`Maximum file size: ${limit / 1024 / 1024} MiB`);
93
+ return;
94
+ }
95
+ setBusy(true);
96
+ setError("");
97
+ try {
98
+ const bytes = new Uint8Array(await file.arrayBuffer());
99
+ let binary = "";
100
+ for (let i = 0; i < bytes.length; i += 8192)
101
+ binary += String.fromCharCode(...bytes.subarray(i, i + 8192));
102
+ await fireAction(context, { name: file.name, content: btoa(binary), encoding: "base64" });
103
+ }
104
+ catch (e) {
105
+ setError(e.message);
106
+ }
107
+ finally {
108
+ setBusy(false);
109
+ }
110
+ } }), busy && _jsx("span", { className: "ainui-sr-only", role: "status", children: "Uploading\u2026" }), error && _jsx("small", { role: "alert", children: error })] });
111
+ });
112
+ const X402Payment = createBinderlessComponentImplementation(api("X402Payment"), ({ context }) => {
113
+ const p = context.componentModel.properties;
114
+ const amount = useValue(context, p.amount);
115
+ const currency = useValue(context, p.currency);
116
+ const network = useValue(context, p.network);
117
+ const payTo = useValue(context, p.payTo);
118
+ const [busy, setBusy] = useState(false);
119
+ const [error, setError] = useState("");
120
+ return _jsxs("div", { style: box, children: [_jsxs("strong", { children: [amount, " ", currency] }), _jsxs("small", { children: ["Network: ", network] }), _jsxs("small", { style: { overflowWrap: "anywhere" }, children: ["To: ", payTo] }), _jsx("button", { style: button, disabled: busy, onClick: async () => {
121
+ if (busy)
122
+ return;
123
+ setBusy(true);
124
+ setError("");
125
+ try {
126
+ await fireAction(context);
127
+ }
128
+ catch (e) {
129
+ setError(e.message);
130
+ }
131
+ finally {
132
+ setBusy(false);
133
+ }
134
+ }, children: busy ? "Confirm in your wallet…" : `Pay ${amount} ${currency}` }), error && _jsx("small", { role: "alert", children: error })] });
135
+ });
136
+ const FolderChat = createBinderlessComponentImplementation(api("FolderChat"), ({ context }) => {
137
+ const state = useValue(context, context.componentModel.properties.value);
138
+ const [input, setInput] = useState("");
139
+ if (!state)
140
+ return null;
141
+ return _jsxs("section", { "aria-label": "Folder chat", className: "ainui-chat", children: [_jsx("strong", { className: "ainui-chat-title", children: state.path.split("/").filter(Boolean).at(-1) || "Folder chat" }), _jsxs("label", { className: "ainui-chat-agent", children: ["Agent ", _jsx("select", { "aria-label": "Chat agent", disabled: state.busy, value: state.agentId, onChange: e => void fireAction(context, { operation: "select", agentId: e.target.value }), children: state.agents.map(a => _jsx("option", { value: a.id, children: a.label }, a.id)) })] }), _jsx("div", { role: "log", "aria-live": "polite", className: "ainui-chat-log", children: state.messages.map((m, i) => _jsxs("div", { role: m.role === "error" ? "alert" : undefined, className: `ainui-chat-message ainui-chat-message-${m.role}`, children: [_jsx("strong", { children: m.role === "user" ? "You" : m.role === "error" ? "Error" : state.agents.find(a => a.id === state.agentId)?.label || "Agent" }), _jsx("div", { children: m.text })] }, i)) }), _jsxs("form", { onSubmit: e => { e.preventDefault(); if (input.trim() && !state.busy) {
142
+ void fireAction(context, { operation: "send", q: input.trim(), agentId: state.agentId });
143
+ setInput("");
144
+ } }, style: box, children: [_jsx("textarea", { "aria-label": "Message", placeholder: "Ask about the files in this folder\u2026", rows: 3, disabled: state.busy, value: input, onChange: e => setInput(e.target.value) }), state.busy ? _jsx("button", { type: "button", className: "ainui-button", onClick: () => void fireAction(context, { operation: "cancel" }), children: "Stop" }) : _jsx("button", { className: "ainui-button ainui-button-primary", disabled: !input.trim() || !state.agentId, children: "Send" })] })] });
145
+ });
146
+ // ── Pickers (docs §3 FilePicker / AgentPicker) ─────────────────────────────
147
+ // Every action is a fixed `ainui.picker.*` name (PICKER_ACTIONS) with the
148
+ // component's `context` merged in. Refs are dispatched whole, as listed.
149
+ function usePickerContext(ctx) {
150
+ const raw = ctx.componentModel.properties.context;
151
+ const isBinding = !!raw && typeof raw === "object" && ("@path" in raw || "@call" in raw);
152
+ const bound = useValue(ctx, isBinding ? raw : undefined);
153
+ const value = isBinding ? bound : raw;
154
+ return value && typeof value === "object" ? value : {};
155
+ }
156
+ function pickerDispatch(ctx, base, name, context) {
157
+ return ctx.dispatchAction({ event: { name, context: { ...base, ...context } } });
158
+ }
159
+ function PickerHeader({ ctx, base, kind, scopes, scope, query, asOf, cursorExpired }) {
160
+ // Uncontrolled on purpose: the query is only read on submit; a new listing (new `query`) remounts the field.
161
+ const field = useRef(null);
162
+ return _jsxs(_Fragment, { children: [_jsx("div", { role: "tablist", "aria-label": kind === "file" ? "파일 범위" : "에이전트 범위", className: "ainui-picker-scopes", children: scopes.map((s) => _jsx("button", { type: "button", role: "tab", "aria-selected": scope === s.value, className: "ainui-picker-scope", onClick: () => { if (scope !== s.value)
163
+ void pickerDispatch(ctx, base, "ainui.picker.scope", { kind, scope: s.value }); }, children: s.label }, s.value)) }), _jsxs("form", { role: "search", className: "ainui-picker-search", onSubmit: (e) => { e.preventDefault(); void pickerDispatch(ctx, base, "ainui.picker.search", { kind, query: (field.current?.value ?? "").trim() }); }, children: [_jsx("input", { ref: field, type: "search", "aria-label": "\uAC80\uC0C9", placeholder: kind === "file" ? "파일 이름 검색" : "에이전트 검색", defaultValue: query }, query), _jsx("button", { type: "submit", className: "ainui-button", children: "\uAC80\uC0C9" })] }), (asOf || cursorExpired) && _jsxs("div", { className: "ainui-picker-asof", children: [asOf && _jsxs("small", { children: ["\uAE30\uC900 \uC2DC\uAC01: ", _jsx("time", { dateTime: asOf, children: asOf })] }), cursorExpired && _jsx("button", { type: "button", className: "ainui-button", onClick: () => void pickerDispatch(ctx, base, "ainui.picker.more", { kind, cursor: null }), children: "\uBAA9\uB85D\uC774 \uB9CC\uB8CC\uB428 \u2014 \uCC98\uC74C\uBD80\uD130 \uB2E4\uC2DC \uBD88\uB7EC\uC624\uAE30" })] })] });
164
+ }
165
+ function PickerMore({ ctx, base, kind, cursor }) {
166
+ if (typeof cursor !== "string" || !cursor)
167
+ return null;
168
+ return _jsx("button", { type: "button", className: "ainui-button ainui-picker-more", onClick: () => void pickerDispatch(ctx, base, "ainui.picker.more", { kind, cursor }), children: MORE_LABEL });
169
+ }
170
+ const Badge = ({ tone, children }) => _jsx("span", { className: `ainui-picker-badge${tone ? ` ainui-picker-badge-${tone}` : ""}`, children: children });
171
+ const FilePicker = createBinderlessComponentImplementation(api("FilePicker"), ({ context: ctx }) => {
172
+ const p = ctx.componentModel.properties;
173
+ const items = useValue(ctx, p.items);
174
+ const scope = useValue(ctx, p.scope) ?? "mine";
175
+ const query = useValue(ctx, p.query) ?? "";
176
+ const cursor = useValue(ctx, p.cursor);
177
+ const asOf = useValue(ctx, p.asOf);
178
+ const cursorExpired = useValue(ctx, p.cursorExpired) === true;
179
+ const selection = useValue(ctx, p.selection) === "multiple" ? "multiple" : "single";
180
+ const preselected = useValue(ctx, p.selected);
181
+ const base = usePickerContext(ctx);
182
+ const [chosen, setChosen] = useState(() => Array.isArray(preselected) ? preselected : []);
183
+ useEffect(() => { setChosen(Array.isArray(preselected) ? preselected : []); }, [preselected]);
184
+ const rows = Array.isArray(items) ? items.filter((i) => !!i && !!i.ref) : [];
185
+ const pick = (refs) => pickerDispatch(ctx, base, "ainui.picker.pick", { kind: "file", refs });
186
+ const toggle = (key) => setChosen((c) => c.includes(key) ? c.filter((k) => k !== key) : [...c, key]);
187
+ const chosenRows = rows.filter((r) => chosen.includes(fileKey(r.ref)) && !filePickReason(r));
188
+ return _jsxs("section", { "aria-label": "\uD30C\uC77C \uC120\uD0DD", className: "ainui-picker ainui-picker-file", children: [_jsx(PickerHeader, { ctx: ctx, base: base, kind: "file", scopes: FILE_SCOPES, scope: scope, query: query, asOf: asOf, cursorExpired: cursorExpired }), rows.length === 0 && _jsx("p", { className: "ainui-picker-empty", children: "\uD45C\uC2DC\uD560 \uD30C\uC77C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4" }), _jsx("ul", { className: "ainui-picker-list", "aria-label": "\uD30C\uC77C \uBAA9\uB85D", children: rows.map((item) => {
189
+ const key = fileKey(item.ref);
190
+ const reason = filePickReason(item);
191
+ const state = item.ref.availability?.state ?? "unknown";
192
+ const unentitled = !!item.paid && !item.paid.entitled;
193
+ const isChosen = chosen.includes(key);
194
+ const pickLabel = selection === "multiple" ? (isChosen ? "선택 해제" : "선택") : "선택";
195
+ return _jsxs("li", { className: `ainui-picker-row${reason ? " ainui-picker-row-unavailable" : ""}${isChosen ? " ainui-picker-row-selected" : ""}`, "aria-selected": isChosen, "aria-disabled": !!reason, "data-file-key": key, children: [_jsx("span", { className: "ainui-picker-icon", "aria-hidden": "true", children: _jsx(Glyph, { kind: item.ref.kind === "folder" ? "folder" : "file" }) }), _jsxs("span", { className: "ainui-picker-main", children: [_jsx("span", { className: "ainui-picker-name", title: item.ref.displayName, children: item.ref.displayName }), _jsxs("span", { className: "ainui-picker-meta", children: [_jsx(Badge, { children: SHARE_ORIGIN_LABEL[item.shareOrigin] ?? item.shareOrigin }), _jsx(Badge, { tone: "muted", children: ROLE_LABEL[item.role] ?? item.role }), _jsx(Badge, { tone: state === "online" ? undefined : state === "unknown" ? "muted" : "danger", children: AVAILABILITY_LABEL[state] ?? state }), unentitled && _jsx(Badge, { tone: "warn", children: PAID_BADGE })] }), reason && _jsx("small", { className: "ainui-picker-reason", children: reason })] }), _jsxs("span", { className: "ainui-picker-actions", children: [_jsx("button", { type: "button", className: `ainui-button ainui-picker-pick${isChosen ? "" : " ainui-button-primary"}`, disabled: !!reason, "aria-label": reason ? `${item.ref.displayName}: ${reason}` : `${item.ref.displayName} ${pickLabel}`, title: reason ?? undefined, onClick: () => { if (reason)
196
+ return; if (selection === "multiple")
197
+ toggle(key);
198
+ else
199
+ void pick([item.ref]); }, children: pickLabel }), item.ref.sourceUrl && _jsx("button", { type: "button", className: "ainui-button ainui-picker-open", "aria-label": `${item.ref.displayName} 원본 열기`, onClick: () => void pickerDispatch(ctx, base, "ainui.picker.open", { kind: "file", sourceUrl: item.ref.sourceUrl }), children: "\uC5F4\uAE30" })] })] }, key);
200
+ }) }), _jsxs("div", { className: "ainui-picker-footer", children: [_jsx(PickerMore, { ctx: ctx, base: base, kind: "file", cursor: cursor }), selection === "multiple" && _jsxs("button", { type: "button", className: "ainui-button ainui-button-primary ainui-picker-done", disabled: chosenRows.length === 0, onClick: () => void pick(chosenRows.map((r) => r.ref)), children: [chosenRows.length, "\uAC1C \uC120\uD0DD \uC644\uB8CC"] })] })] });
201
+ });
202
+ const AgentPicker = createBinderlessComponentImplementation(api("AgentPicker"), ({ context: ctx }) => {
203
+ const p = ctx.componentModel.properties;
204
+ const items = useValue(ctx, p.items);
205
+ const scope = useValue(ctx, p.scope) ?? "mine";
206
+ const query = useValue(ctx, p.query) ?? "";
207
+ const cursor = useValue(ctx, p.cursor);
208
+ const asOf = useValue(ctx, p.asOf);
209
+ const cursorExpired = useValue(ctx, p.cursorExpired) === true;
210
+ const selected = useValue(ctx, p.selected) ?? "";
211
+ const renders = useValue(ctx, p.renders);
212
+ const base = usePickerContext(ctx);
213
+ const rows = Array.isArray(items) ? items.filter((i) => !!i && !!i.ref) : [];
214
+ return _jsxs("section", { "aria-label": "\uC5D0\uC774\uC804\uD2B8 \uC120\uD0DD", className: "ainui-picker ainui-picker-agent", children: [_jsx(PickerHeader, { ctx: ctx, base: base, kind: "agent", scopes: AGENT_SCOPES, scope: scope, query: query, asOf: asOf, cursorExpired: cursorExpired }), rows.length === 0 && _jsx("p", { className: "ainui-picker-empty", children: "\uD45C\uC2DC\uD560 \uC5D0\uC774\uC804\uD2B8\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4" }), _jsx("ul", { className: "ainui-picker-list", "aria-label": "\uC5D0\uC774\uC804\uD2B8 \uBAA9\uB85D", children: rows.map((item) => {
215
+ const a = item.ref;
216
+ const key = agentKey(a);
217
+ const reason = agentPickReason(item);
218
+ const caps = capabilityLines(a, Array.isArray(renders) ? renders : []);
219
+ const isSelected = selected === key;
220
+ return _jsxs("li", { className: `ainui-picker-row${reason ? " ainui-picker-row-unavailable" : ""}${isSelected ? " ainui-picker-row-selected" : ""}`, "aria-selected": isSelected, "aria-disabled": !!reason, "data-agent-key": key, children: [_jsxs("span", { className: "ainui-picker-main", children: [_jsx("span", { className: "ainui-picker-name", title: a.displayName, children: a.displayName }), a.description && _jsx("span", { className: "ainui-picker-description", children: a.description }), _jsxs("span", { className: "ainui-picker-meta", children: [_jsx(Badge, { tone: a.status === "active" ? undefined : "danger", children: AGENT_STATUS_LABEL[a.status] ?? a.status }), _jsx(Badge, { tone: "muted", children: VISIBILITY_LABEL[a.visibility] ?? a.visibility }), (a.skills ?? []).slice(0, 3).map((s) => _jsx(Badge, { tone: "muted", children: s.name }, s.id))] }), _jsxs("small", { className: "ainui-picker-capabilities", children: [caps.enabled.length > 0 && _jsxs("span", { className: "ainui-picker-enabled", children: ["\uC9C0\uC6D0: ", caps.enabled.join(", ")] }), caps.fallbacks.length > 0 && _jsxs("span", { className: "ainui-picker-fallbacks", children: ["\uB300\uCCB4: ", caps.fallbacks.join(", ")] })] }), reason && _jsx("small", { className: "ainui-picker-reason", children: reason })] }), _jsxs("span", { className: "ainui-picker-actions", children: [_jsx("button", { type: "button", className: "ainui-button ainui-button-primary ainui-picker-pick", disabled: !!reason, "aria-label": reason ? `${a.displayName}: ${reason}` : `${a.displayName} 선택`, title: reason ?? undefined, onClick: () => { if (!reason)
221
+ void pickerDispatch(ctx, base, "ainui.picker.pick", { kind: "agent", ref: a }); }, children: "\uC120\uD0DD" }), _jsx("button", { type: "button", className: "ainui-button ainui-picker-card", "aria-label": `${a.displayName} 에이전트 카드`, onClick: () => void pickerDispatch(ctx, base, "ainui.picker.card", { kind: "agent", agentCardUrl: a.agentCardUrl }), children: "\uCE74\uB4DC" })] })] }, key);
222
+ }) }), _jsx("div", { className: "ainui-picker-footer", children: _jsx(PickerMore, { ctx: ctx, base: base, kind: "agent", cursor: cursor }) })] });
223
+ });
224
+ // Preserve AIN-UI's confirmation extension on the basic Button.
225
+ export const ain = [Toolbar, Tile, FileView, Breadcrumbs, Segmented, FileUpload, X402Payment, FolderChat, FilePicker, AgentPicker];
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The AINUI catalog for A2UI 1.0: the 69 standard components and the AIN ones, each with its React view.
3
+ */
4
+ import type { ReactComponentImplementation } from "@a2ui/react";
5
+ export declare const AINUI_INSTRUCTIONS: string;
6
+ export declare const standardComponents: ReactComponentImplementation[];
7
+ /** Names of standard components that have no view of their own yet. */
8
+ export declare const missingStandardViews: string[];
9
+ export declare const ainuiCatalog: import("@a2ui/web_core").Catalog<import("@a2ui/web_core").ComponentApi<import("zod").ZodTypeAny>, import("@a2ui/web_core").FunctionApi>;
@@ -0,0 +1,23 @@
1
+ import { createComponentImplementation } from "@a2ui/react";
2
+ import React from "react";
3
+ import { AINUI_CATALOG } from "../protocol.js";
4
+ import { Kids, STANDARD, kid } from "./core.js";
5
+ import { ain } from "./ain.js";
6
+ import { functionImplementations } from "./functions.js";
7
+ import { layout } from "./standard/layout.js";
8
+ import { text } from "./standard/text.js";
9
+ import { inputs } from "./standard/inputs.js";
10
+ import { data } from "./standard/data.js";
11
+ import { media } from "./standard/media.js";
12
+ import { feedback } from "./standard/feedback.js";
13
+ import { composites } from "./standard/composites.js";
14
+ import { rich } from "./standard/rich.js";
15
+ export const AINUI_INSTRUCTIONS = STANDARD.instructions ?? "";
16
+ const views = [...layout, ...text, ...inputs, ...data, ...media, ...feedback, ...composites, ...rich, ...ain];
17
+ const byName = new Map(views.map((v) => [v.name, v]));
18
+ /** A component whose view is not written yet still shows its text and children instead of nothing. */
19
+ const fallback = (name) => createComponentImplementation(STANDARD.components.get(name), (({ props, buildChild }) => React.createElement("div", { "data-ainui-fallback": name }, typeof props.text === "string" || typeof props.label === "string" ? props.text ?? props.label : null, kid(buildChild, props.child), React.createElement(Kids, { of: props.children, buildChild }))));
20
+ export const standardComponents = [...STANDARD.components.keys()].map((name) => byName.get(name) ?? fallback(name));
21
+ /** Names of standard components that have no view of their own yet. */
22
+ export const missingStandardViews = [...STANDARD.components.keys()].filter((name) => !byName.has(name));
23
+ export const ainuiCatalog = STANDARD.copyWith({ catalogId: AINUI_CATALOG, components: standardComponents, functions: functionImplementations });