ain-ui 0.2.0 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -33,6 +33,7 @@ All basic A2UI components are available, plus:
33
33
 
34
34
  | Component | Purpose |
35
35
  | --- | --- |
36
+ | Toolbar | Wrapping file controls with mobile view toggles |
36
37
  | Grid | Responsive columns, including A2UI child templates |
37
38
  | Tile | File/folder thumbnail, label, caption and action |
38
39
  | FileView | Image, video, audio, PDF preview and download |
package/dist/ainui.js CHANGED
@@ -126,17 +126,23 @@ const cleanPath = (p) => (typeof p === "string" ? p.replace(/^\/+|\/+$/g, "") :
126
126
  export function ainuiFolder(opts) {
127
127
  const env = opts.env ?? {};
128
128
  const view = env.view ?? defaultView(opts.items);
129
+ const photos = opts.items.filter(i => !i.is_dir && i.mime.startsWith("image/")).length;
130
+ const files = opts.items.filter(i => !i.is_dir).length - photos;
131
+ const folders = opts.items.filter(i => i.is_dir).length;
132
+ const count = (n, noun) => `${n} ${noun}${n === 1 ? "" : "s"}`;
133
+ const inventory = [photos && count(photos, "photo"), files && count(files, "file"), folders && count(folders, "folder")].filter(Boolean).join(" · ") || "0 items";
129
134
  const toolbar = ["search_field", "search_btn", "view"];
130
135
  if (env.canWrite)
131
136
  toolbar.push("new_btn", "upload");
132
137
  const body = opts.items.length ? (view === "grid" ? "grid" : "list") : "empty";
133
- const rootChildren = ["crumbs", "toolbar", body, ...(opts.note ? ["note"] : [])];
138
+ const rootChildren = ["crumbs", "toolbar", "inventory", body, ...(opts.note ? ["note"] : [])];
134
139
  const comps = [
135
140
  column("root", rootChildren),
136
141
  breadcrumbs(),
137
- row("toolbar", toolbar, { align: "center" }),
142
+ { id: "inventory", component: "Text", text: { path: "/inventory" }, variant: "caption" },
143
+ { id: "toolbar", component: "Toolbar", children: toolbar },
138
144
  { id: "search_field", component: "TextField", label: "Search file names", value: { path: "/query" }, weight: 1 },
139
- button("search_btn", "search_label", "aindrive.search", { drive_id: DRIVE, query: { path: "/query" }, path: { path: "/path" } }, { variant: "primary" }),
145
+ button("search_btn", "search_label", "aindrive.search", { drive_id: DRIVE, query: { path: "/query" }, path: { path: "/path" } }),
140
146
  text("search_label", "Search"),
141
147
  {
142
148
  id: "view",
@@ -152,7 +158,7 @@ export function ainuiFolder(opts) {
152
158
  }
153
159
  const open = ev("aindrive.open", { drive_id: { path: "drive_id" }, path: { path: "path" }, is_dir: { path: "is_dir" } });
154
160
  if (body === "grid") {
155
- comps.push({ id: "grid", component: "Grid", children: { componentId: "tile", path: "/items" }, minItemWidth: 128, gap: 8 }, {
161
+ comps.push({ id: "grid", component: "Grid", children: { componentId: "tile", path: "/items" }, minItemWidth: 176, gap: 20 }, {
156
162
  id: "tile", component: "Tile",
157
163
  media: { path: "thumb" }, kind: { path: "kind" }, label: { path: "name" }, caption: { path: "meta" }, action: open,
158
164
  });
@@ -175,6 +181,7 @@ export function ainuiFolder(opts) {
175
181
  query: opts.query ?? "",
176
182
  new_name: "",
177
183
  items: opts.items,
184
+ inventory: `${inventory} · ${opts.query ? "Search results" : "This folder only"}`,
178
185
  });
179
186
  }
180
187
  export function ainuiFile(opts) {
@@ -185,7 +192,7 @@ export function ainuiFile(opts) {
185
192
  const comps = [
186
193
  column("root", ["crumbs", "toolbar", "view"]),
187
194
  breadcrumbs(),
188
- row("toolbar", toolbar, { align: "center" }),
195
+ { id: "toolbar", component: "Toolbar", children: toolbar },
189
196
  button("back_btn", "back_label", "aindrive.open", { drive_id: DRIVE, path: { path: "/parent" }, is_dir: true }),
190
197
  text("back_label", "Back"),
191
198
  ];
package/dist/catalog.json CHANGED
@@ -1256,6 +1256,27 @@
1256
1256
  }
1257
1257
  ]
1258
1258
  },
1259
+ "Toolbar": {
1260
+ "allOf": [
1261
+ {
1262
+ "$ref": "common_types.json#/$defs/ComponentCommon"
1263
+ },
1264
+ {
1265
+ "properties": {
1266
+ "component": {
1267
+ "const": "Toolbar"
1268
+ },
1269
+ "children": {
1270
+ "$ref": "common_types.json#/$defs/ChildList"
1271
+ }
1272
+ },
1273
+ "required": [
1274
+ "component",
1275
+ "children"
1276
+ ]
1277
+ }
1278
+ ]
1279
+ },
1259
1280
  "Grid": {
1260
1281
  "allOf": [
1261
1282
  {
package/dist/react.d.ts CHANGED
@@ -27,7 +27,6 @@ export type FolderChatSend = (turn: {
27
27
  signal: AbortSignal;
28
28
  onUpdate: (update: ChatUpdate) => void;
29
29
  }) => Promise<ChatUpdate>;
30
- /** Scope changes unmount the old chat, abort its request and drop its context ids. */
31
30
  export declare function AinuiFolderChat(props: {
32
31
  driveId: string;
33
32
  path: string;
package/dist/react.js CHANGED
@@ -38,11 +38,21 @@ const api = (name, shape) => ({ name, schema: z.object(shape).passthrough() });
38
38
  const dynamic = z.union([CommonSchemas.DynamicValue, z.object({ $asset: z.object({
39
39
  drive_id: z.string(), path: z.string(), variant: z.enum(["thumb", "original"]), mime: z.string(), v: z.number().optional(),
40
40
  }) }), z.null()]).optional();
41
+ function Glyph({ kind }) {
42
+ 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" };
43
+ 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] }) });
44
+ }
45
+ const Toolbar = createBinderlessComponentImplementation(api("Toolbar", { children: CommonSchemas.ChildList }), ({ context, buildChild }) => {
46
+ const spec = context.componentModel.properties.children;
47
+ const rows = useValue(context, !Array.isArray(spec) && spec ? { path: spec.path } : []);
48
+ return _jsx("div", { className: "ainui-toolbar", children: Array.isArray(spec) ? spec.map(id => _jsx(React.Fragment, { children: buildChild(id) }, id)) :
49
+ (Array.isArray(rows) ? rows : []).map((_, i) => _jsx(React.Fragment, { children: buildChild(spec.componentId, `${spec.path}/${i}`) }, i)) });
50
+ });
41
51
  const Grid = createBinderlessComponentImplementation(api("Grid", { children: CommonSchemas.ChildList, minItemWidth: z.number().optional(), gap: z.number().optional() }), ({ context, buildChild }) => {
42
52
  const p = context.componentModel.properties;
43
53
  const spec = p.children;
44
54
  const rows = useValue(context, !Array.isArray(spec) && spec ? { path: spec.path } : []);
45
- return _jsx("div", { style: { display: "grid", gridTemplateColumns: `repeat(auto-fit,minmax(min(100%,${Math.max(64, Number(p.minItemWidth) || 128)}px),1fr))`, gap: Number(p.gap) || 8 }, children: Array.isArray(spec) ? spec.map((id) => _jsx(React.Fragment, { children: buildChild(id) }, id)) :
55
+ return _jsx("div", { className: "ainui-grid", style: { display: "grid", width: "100%", minWidth: 0, gridTemplateColumns: `repeat(auto-fill,minmax(min(100%,var(--ainui-tile-min,${Math.max(64, Number(p.minItemWidth) || 176)}px)),1fr))`, gap: Number(p.gap) || 20 }, children: Array.isArray(spec) ? spec.map((id) => _jsx(React.Fragment, { children: buildChild(id) }, id)) :
46
56
  (Array.isArray(rows) ? rows : []).map((_, i) => _jsx(React.Fragment, { children: buildChild(spec.componentId, `${spec.path}/${i}`) }, i)) });
47
57
  });
48
58
  const Tile = createBinderlessComponentImplementation(api("Tile", { media: dynamic, label: dynamic, caption: dynamic, kind: dynamic, action: CommonSchemas.Action.optional() }), ({ context }) => {
@@ -55,8 +65,8 @@ const Tile = createBinderlessComponentImplementation(api("Tile", { media: dynami
55
65
  const src = urlOf(media, resolver);
56
66
  const [failed, setFailed] = useState(false);
57
67
  useEffect(() => setFailed(false), [src]);
58
- return _jsxs("button", { style: { ...box, ...button, textAlign: "left" }, onClick: () => void fire(context), children: [src && !failed ? _jsx("img", { src: src, alt: "", loading: "lazy", onError: () => setFailed(true), style: { width: "100%", aspectRatio: "1", objectFit: "cover", borderRadius: 8 } }) :
59
- _jsx("span", { style: { fontSize: 40, padding: 24 }, children: kind === "folder" ? "📁" : "📄" }), _jsx("span", { style: { overflowWrap: "anywhere" }, children: label }), _jsx("small", { children: caption })] });
68
+ return _jsxs("button", { type: "button", className: "ainui-tile", onClick: () => void fire(context), children: [_jsx("span", { className: "ainui-tile-media", children: src && !failed ? _jsx("img", { src: src, alt: "", loading: "lazy", onError: () => setFailed(true) }) :
69
+ _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 })] });
60
70
  });
61
71
  const FileView = createBinderlessComponentImplementation(api("FileView", { src: dynamic, name: dynamic, mime: dynamic, size: dynamic }), ({ context }) => {
62
72
  const p = context.componentModel.properties;
@@ -75,26 +85,27 @@ const FileView = createBinderlessComponentImplementation(api("FileView", { src:
75
85
  });
76
86
  const Breadcrumbs = createBinderlessComponentImplementation(api("Breadcrumbs", { items: dynamic, action: CommonSchemas.Action.optional() }), ({ context }) => {
77
87
  const items = useValue(context, context.componentModel.properties.items) || [];
78
- return _jsx("nav", { "aria-label": "Folder path", style: { display: "flex", flexWrap: "wrap", gap: 4 }, children: items.map((item, i) => i === items.length - 1 ? _jsx("span", { "aria-current": "page", children: item.label }, i) :
79
- _jsx("button", { style: button, onClick: () => void fire(context, { path: item.path }), children: item.label }, i)) });
88
+ 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 }) :
89
+ _jsx("button", { onClick: () => void fire(context, { path: item.path }), children: item.label === "/" ? "Drive" : item.label })] }, i)) });
80
90
  });
81
91
  const Segmented = createBinderlessComponentImplementation(api("Segmented", { options: z.array(z.object({ value: z.string(), label: z.string() })), value: dynamic, action: CommonSchemas.Action.optional() }), ({ context }) => {
82
92
  const p = context.componentModel.properties;
83
93
  const value = useValue(context, p.value);
84
- return _jsx("div", { role: "group", style: { display: "flex", gap: 4 }, children: p.options.map((o) => _jsx("button", { style: { ...button, fontWeight: value === o.value ? "bold" : "normal" }, "aria-pressed": value === o.value, onClick: () => {
94
+ 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: () => {
85
95
  const binding = p.value;
86
96
  if (binding?.path)
87
97
  context.dataContext.set(binding.path, o.value);
88
98
  void fire(context, { value: o.value });
89
- }, children: o.label }, o.value)) });
99
+ }, children: [(o.value === "grid" || o.value === "list") && _jsx(Glyph, { kind: o.value }), _jsx("span", { children: o.label })] }, o.value)) });
90
100
  });
91
101
  const FileUpload = createBinderlessComponentImplementation(api("FileUpload", { label: dynamic, maxBytes: z.number().optional(), action: CommonSchemas.Action.optional() }), ({ context }) => {
92
102
  const p = context.componentModel.properties;
93
103
  const label = useValue(context, p.label) || "Upload file";
94
104
  const [busy, setBusy] = useState(false);
95
105
  const [error, setError] = useState("");
106
+ const input = useRef(null);
96
107
  const limit = Math.min(Number(p.maxBytes) || AINUI_UPLOAD_MAX_BYTES, AINUI_UPLOAD_MAX_BYTES);
97
- return _jsxs("label", { style: box, children: [label, _jsx("input", { type: "file", disabled: busy, onChange: async (e) => {
108
+ 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) => {
98
109
  const file = e.target.files?.[0];
99
110
  e.target.value = "";
100
111
  if (!file)
@@ -118,7 +129,7 @@ const FileUpload = createBinderlessComponentImplementation(api("FileUpload", { l
118
129
  finally {
119
130
  setBusy(false);
120
131
  }
121
- } }), busy && _jsx("small", { children: "Uploading\u2026" }), error && _jsx("small", { role: "alert", children: error })] });
132
+ } }), busy && _jsx("span", { className: "ainui-sr-only", role: "status", children: "Uploading\u2026" }), error && _jsx("small", { role: "alert", children: error })] });
122
133
  });
123
134
  const X402Payment = createBinderlessComponentImplementation(api("X402Payment", { amount: dynamic, currency: dynamic, network: dynamic, payTo: dynamic, action: CommonSchemas.Action.optional() }), ({ context }) => {
124
135
  const p = context.componentModel.properties;
@@ -149,19 +160,21 @@ const FolderChat = createBinderlessComponentImplementation(api("FolderChat", { v
149
160
  const [input, setInput] = useState("");
150
161
  if (!state)
151
162
  return null;
152
- return _jsxs("section", { "aria-label": "Folder chat", style: box, children: [_jsxs("strong", { children: ["Folder chat \u00B7 ", state.path || "/"] }), _jsxs("label", { children: ["Agent ", _jsx("select", { "aria-label": "Chat agent", disabled: state.busy, value: state.agentId, onChange: e => void fire(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", style: { maxHeight: 400, overflowY: "auto" }, children: state.messages.map((m, i) => _jsxs("div", { role: m.role === "error" ? "alert" : undefined, style: { whiteSpace: "pre-wrap", overflowWrap: "anywhere", paddingBlock: 8 }, 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) {
163
+ 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 fire(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" }), m.role === "agent" ? _jsx(AgentText, { text: m.text }) : _jsx("div", { className: "ainui-chat-text", children: m.text })] }, i)) }), _jsxs("form", { onSubmit: e => { e.preventDefault(); if (input.trim() && !state.busy) {
153
164
  void fire(context, { operation: "send", q: input.trim(), agentId: state.agentId });
154
165
  setInput("");
155
- } }, style: box, children: [_jsx("textarea", { "aria-label": "Message", disabled: state.busy, value: input, onChange: e => setInput(e.target.value) }), state.busy ? _jsx("button", { type: "button", style: button, onClick: () => void fire(context, { operation: "cancel" }), children: "Stop" }) : _jsx("button", { style: button, disabled: !input.trim() || !state.agentId, children: "Send" })] })] });
166
+ } }, 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 fire(context, { operation: "cancel" }), children: "Stop" }) : _jsx("button", { className: "ainui-button ainui-button-primary", disabled: !input.trim() || !state.agentId, children: "Send" })] })] });
156
167
  });
157
168
  // Preserve AIN-UI's confirmation extension on the basic Button.
158
169
  const Button = createBinderlessComponentImplementation(api("Button", { child: CommonSchemas.ComponentId, action: CommonSchemas.Action.optional(), confirm: dynamic, variant: dynamic, tone: dynamic }), ({ context, buildChild }) => {
159
170
  const p = context.componentModel.properties;
160
171
  const confirm = useValue(context, p.confirm);
161
- return _jsx("button", { style: button, onClick: () => { if (!confirm || window.confirm(confirm))
172
+ const variant = useValue(context, p.variant);
173
+ const tone = useValue(context, p.tone);
174
+ return _jsx("button", { className: `ainui-button ${variant === "primary" ? "ainui-button-primary" : variant === "borderless" ? "ainui-button-ghost" : ""} ${tone === "danger" ? "ainui-button-danger" : ""}`, onClick: () => { if (!confirm || window.confirm(confirm))
162
175
  void fire(context); }, children: buildChild(String(p.child)) });
163
176
  });
164
- export const ainuiCatalog = new Catalog(AINUI_CATALOG, [...basicCatalog.components.values()].filter((c) => c.name !== "Button").concat([Button, Grid, Tile, FileView, Breadcrumbs, Segmented, FileUpload, X402Payment, FolderChat]), [...basicCatalog.functions.values()]);
177
+ export const ainuiCatalog = new Catalog(AINUI_CATALOG, [...basicCatalog.components.values()].filter((c) => c.name !== "Button").concat([Button, Toolbar, Grid, Tile, FileView, Breadcrumbs, Segmented, FileUpload, X402Payment, FolderChat]), [...basicCatalog.functions.values()]);
165
178
  export function AinuiSurface({ messages, onAction, resolveAsset, renderFile }) {
166
179
  const handler = useRef(onAction);
167
180
  handler.current = onAction;
@@ -188,6 +201,25 @@ export function AinuiSurface({ messages, onAction, resolveAsset, renderFile }) {
188
201
  return _jsx(MarkdownContext.Provider, { value: renderMarkdown, children: _jsx(Assets.Provider, { value: resolveAsset ?? (() => ""), children: _jsx(FileRenderer.Provider, { value: renderFile, children: _jsx("div", { className: "ain-ui", children: Array.from(processor.model.surfacesMap.values()).map((surface) => _jsx(A2uiSurface, { surface: surface }, surface.id)) }) }) }) });
189
202
  }
190
203
  /** Scope changes unmount the old chat, abort its request and drop its context ids. */
204
+ /**
205
+ * An agent's message as Markdown — agents answer in it (headings, lists, tables, code). The same
206
+ * markdown-it the A2UI Text component uses (it sanitizes); the plain text shows until the render lands, so a
207
+ * streamed message never flickers to empty. A person's own message stays as typed.
208
+ */
209
+ function AgentText({ text }) {
210
+ const [html, setHtml] = useState(null);
211
+ useEffect(() => {
212
+ let live = true;
213
+ // an empty render (no live DOM for the sanitizer, a failure) shows the text as typed rather than nothing
214
+ renderMarkdown(text).then(h => { if (live)
215
+ setHtml(h && h.trim() ? h : null); }).catch(() => { if (live)
216
+ setHtml(null); });
217
+ return () => { live = false; };
218
+ }, [text]);
219
+ return html == null
220
+ ? _jsx("div", { className: "ainui-chat-text", children: text })
221
+ : _jsx("div", { className: "ainui-chat-text ainui-chat-markdown", dangerouslySetInnerHTML: { __html: html } });
222
+ }
191
223
  export function AinuiFolderChat(props) {
192
224
  return _jsx(FolderChatSession, { ...props }, `${props.driveId}:${props.path}`);
193
225
  }
package/dist/renderer.js CHANGED
@@ -159,6 +159,14 @@ export function createA2uiRenderer(container, { onAction, resolveAsset, assetBas
159
159
  }
160
160
  const kids = (spec, into) => childIds(spec, surf, scope).forEach((k) => into.appendChild(renderNode(surfaceId, k.id, k.scope)));
161
161
  switch (c.component) {
162
+ case "Toolbar":
163
+ el.className = "a2ui-row";
164
+ el.style.display = "flex";
165
+ el.style.flexWrap = "wrap";
166
+ el.style.alignItems = "flex-end";
167
+ el.style.gap = "10px";
168
+ kids(c.children, el);
169
+ break;
162
170
  case "Column":
163
171
  case "Row":
164
172
  case "List": {
package/dist/styles.css CHANGED
@@ -11,3 +11,68 @@
11
11
  }
12
12
  .ain-ui button:focus-visible, .ain-ui input:focus-visible, .ain-ui textarea:focus-visible { outline:2px solid currentColor; outline-offset:2px; }
13
13
  .ain-ui p { margin-block:6px; }
14
+
15
+ /* Shared file browser: neutral controls, clear focus and consistent media geometry. */
16
+ .ain-ui { --ainui-muted: #667085; --ainui-line: #e4e7ec; --ainui-hover: #f5f6f8; --ainui-active: #fff; --ainui-accent: #2456d9; }
17
+ .ainui-toolbar { display:flex; flex-wrap:wrap; align-items:flex-end; gap:10px; padding:10px 0 14px; }
18
+ .ainui-toolbar > :first-child { flex:1 1 200px; min-width:140px; }
19
+ .ainui-toolbar label { font-size:12px; color:var(--ainui-muted); }
20
+ .ain-ui .ainui-button { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:40px; padding:8px 14px; border:1px solid var(--ainui-line); border-radius:8px; background:transparent; color:inherit; font-size:13px; font-weight:500; line-height:20px; white-space:nowrap; transition:background .15s; }
21
+ .ain-ui .ainui-button p { margin:0; }
22
+ .ain-ui .ainui-button:hover { background:var(--ainui-hover); }
23
+ .ain-ui .ainui-button-primary { color:#fff; background:var(--ainui-accent); border-color:var(--ainui-accent); }
24
+ .ain-ui .ainui-button-primary:hover { background:#1d46b5; }
25
+ .ain-ui .ainui-button-ghost { border-color:transparent; justify-content:flex-start; }
26
+ .ain-ui .ainui-button-danger { color:#c13535; }
27
+ .ainui-segmented { display:flex; gap:2px; padding:3px; border-radius:9px; background:var(--ainui-hover); border:1px solid var(--ainui-line); }
28
+ .ainui-segmented button { display:flex; align-items:center; gap:6px; min-height:32px; padding:5px 10px; border:0; border-radius:6px; background:transparent; color:var(--ainui-muted); font-size:12px; }
29
+ .ainui-segmented button[aria-pressed=true] { background:var(--ainui-active); color:inherit; box-shadow:0 1px 3px #00000014; }
30
+ .ainui-breadcrumbs { display:flex; flex-wrap:wrap; align-items:center; gap:8px; font-size:13px; min-height:32px; }
31
+ .ainui-breadcrumbs button { border:0; background:transparent; color:var(--ainui-muted); padding:6px 0; }
32
+ .ainui-breadcrumbs button:hover { color:inherit; text-decoration:underline; }
33
+ .ainui-breadcrumbs [aria-current] { font-weight:500; overflow-wrap:anywhere; }
34
+ .ainui-breadcrumb-separator { color:var(--ainui-muted); opacity:.5; }
35
+ .ain-ui .ainui-tile { display:flex; flex-direction:column; gap:5px; min-width:0; width:100%; height:100%; padding:6px; border:0; border-radius:12px; background:transparent; color:inherit; text-align:left; overflow:hidden; transition:background .15s; }
36
+ .ain-ui .ainui-tile:hover { background:var(--ainui-hover); }
37
+ .ainui-tile-media { display:flex; flex:0 0 auto; align-items:center; justify-content:center; width:100%; aspect-ratio:1; overflow:hidden; border-radius:9px; background:var(--ainui-hover); box-shadow:inset 0 0 0 1px #8882; }
38
+ .ainui-tile-media img { width:100%; height:100%; object-fit:cover; }
39
+ .ainui-tile-placeholder { color:var(--ainui-muted); }
40
+ .ainui-tile-placeholder svg { width:36px; height:36px; }
41
+ .ainui-tile-name { display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden; overflow-wrap:anywhere; line-height:1.4; height:2.8em; margin-top:5px; font-size:13px; font-weight:500; }
42
+ .ainui-tile-caption { white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:100%; font-size:12px; line-height:18px; color:var(--ainui-muted); }
43
+ .ainui-upload { position:relative; }
44
+ .ainui-upload [role=alert] { display:block; max-width:220px; color:#c13535; }
45
+ .ainui-sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
46
+ @media (prefers-color-scheme:dark) { .ain-ui { --ainui-muted:#a1a7b3; --ainui-line:#ffffff20; --ainui-hover:#ffffff08; --ainui-active:#ffffff12; --ainui-accent:#3d68e0; } }
47
+ @media (max-width:600px) { .ain-ui { --ainui-tile-min:128px; } .ainui-toolbar { gap:8px; } .ainui-toolbar > :first-child { flex-basis:calc(100% - 100px); } .ain-ui .ainui-button { min-height:44px; } .ainui-segmented button { min-height:36px; } .ainui-grid { gap:10px !important; } }
48
+ @media (prefers-reduced-motion:reduce) { .ain-ui button { transition:none; } }
49
+ /* The official catalog renders captions as span > em; captions are metadata here. */
50
+ .ain-ui span > em { font-style:normal; font-size:12px; color:var(--ainui-muted); }
51
+ .ainui-chat { display:flex; flex-direction:column; gap:14px; min-width:0; padding-top:18px; }
52
+ .ainui-chat-title { font-size:14px; }
53
+ .ainui-chat-agent { display:flex !important; align-items:center; gap:12px; color:var(--ainui-muted); font-size:12px; }
54
+ .ainui-chat-agent select { min-height:36px; flex:1; min-width:0; padding:6px 10px; border:1px solid var(--ainui-line); border-radius:7px; background:transparent; color:inherit; font:inherit; }
55
+ .ainui-chat-log { max-height:400px; overflow-y:auto; }
56
+ .ainui-chat-log:empty { display:none; }
57
+ .ainui-chat-message { white-space:pre-wrap; overflow-wrap:anywhere; padding:12px; margin-bottom:10px; font-size:13px; line-height:1.6; border-radius:9px; }
58
+ .ainui-chat-message strong { display:block; margin-bottom:4px; font-size:11px; color:var(--ainui-muted); font-weight:500; }
59
+ .ainui-chat-message-user { background:var(--ainui-hover); }
60
+ .ainui-chat-message-error { color:#c13535; }
61
+ .ainui-chat form { position:relative; }
62
+ .ainui-chat textarea { resize:vertical; min-height:86px; font-size:13px; }
63
+ .ainui-chat form > button { align-self:flex-end; min-width:80px; }
64
+
65
+ @media(max-width:600px){.ainui-segmented button:has(svg) span{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.ainui-segmented button:has(svg){min-width:36px;padding:6px}}
66
+
67
+ /* Agent replies are Markdown: keep blocks compact inside a chat bubble; tables scroll instead of squeezing. */
68
+ .ainui-chat-markdown p { margin: 0 0 .5em; }
69
+ .ainui-chat-markdown p:last-child { margin-bottom: 0; }
70
+ .ainui-chat-markdown h1, .ainui-chat-markdown h2, .ainui-chat-markdown h3, .ainui-chat-markdown h4 { margin: .6em 0 .3em; font-size: 1.05em; font-weight: 700; }
71
+ .ainui-chat-markdown ul, .ainui-chat-markdown ol { margin: 0 0 .5em; padding-left: 1.4em; }
72
+ .ainui-chat-markdown code { font-family: ui-monospace, Menlo, monospace; font-size: .9em; background: rgba(0, 0, 0, .06); padding: .05em .35em; border-radius: 4px; }
73
+ .ainui-chat-markdown pre { background: rgba(0, 0, 0, .06); border-radius: 8px; padding: .6em .8em; overflow-x: auto; margin: 0 0 .5em; }
74
+ .ainui-chat-markdown pre code { background: none; padding: 0; }
75
+ .ainui-chat-markdown table { display: block; overflow-x: auto; border-collapse: collapse; margin: 0 0 .6em; font-size: .92em; }
76
+ .ainui-chat-markdown th, .ainui-chat-markdown td { border: 1px solid rgba(0, 0, 0, .15); padding: .3em .6em; text-align: left; white-space: nowrap; }
77
+ .ainui-chat-markdown th { font-weight: 600; background: rgba(0, 0, 0, .04); }
78
+ .ainui-chat-markdown a { color: inherit; text-decoration: underline; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ain-ui",
3
- "version": "0.2.0",
3
+ "version": "0.2.3",
4
4
  "description": "AIN-UI: A2UI and AG-UI extensions for grids, files, uploads and x402 payments",
5
5
  "type": "module",
6
6
  "license": "MIT",