cortena-ui 1.1.0 → 1.2.0
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 +51 -0
- package/dist/index.d.ts +437 -16
- package/dist/index.js +4327 -2066
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/src/a2ui/catalogue-doc.ts +218 -0
- package/src/a2ui/catalogue.ts +950 -0
- package/src/a2ui/index.ts +73 -0
- package/src/a2ui/message.ts +590 -0
- package/src/a2ui/renderer.tsx +438 -0
- package/src/a2ui/views.tsx +1113 -0
- package/src/hooks/use-cortena-theme.ts +12 -4
- package/src/index.ts +2 -0
|
@@ -197,18 +197,26 @@ function subscribeTheme(onChange: () => void): () => void {
|
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
+
// jsdom (the extensions' test environment) has no matchMedia; treat its
|
|
201
|
+
// absence as a light system scheme that never changes, rather than throwing.
|
|
202
|
+
function schemeQuery(): MediaQueryList | null {
|
|
203
|
+
return typeof window !== "undefined" && typeof window.matchMedia === "function"
|
|
204
|
+
? window.matchMedia(DARK_QUERY)
|
|
205
|
+
: null;
|
|
206
|
+
}
|
|
207
|
+
|
|
200
208
|
function subscribeScheme(onChange: () => void): () => void {
|
|
201
|
-
const query =
|
|
202
|
-
query
|
|
209
|
+
const query = schemeQuery();
|
|
210
|
+
query?.addEventListener("change", onChange);
|
|
203
211
|
const unsubscribeTheme = subscribeTheme(onChange);
|
|
204
212
|
return () => {
|
|
205
|
-
query
|
|
213
|
+
query?.removeEventListener("change", onChange);
|
|
206
214
|
unsubscribeTheme();
|
|
207
215
|
};
|
|
208
216
|
}
|
|
209
217
|
|
|
210
218
|
function systemScheme(): ResolvedCortenaTheme {
|
|
211
|
-
return
|
|
219
|
+
return schemeQuery()?.matches ? "dark" : "light";
|
|
212
220
|
}
|
|
213
221
|
|
|
214
222
|
/* ── hook ────────────────────────────────────────────────────────────────── */
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// cortena-ui public surface. One export line per component file; every
|
|
2
2
|
// component is styled from cortena-design tokens and built on Base UI.
|
|
3
3
|
export { cn } from "@/lib/cn";
|
|
4
|
+
// The A2UI catalogue and renderer: the vocabulary agents draw with (05-agent-ui.md).
|
|
5
|
+
export * from "@/a2ui";
|
|
4
6
|
export * from "@/components/chart";
|
|
5
7
|
export * from "@/components/data-table";
|
|
6
8
|
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "@/components/accordion";
|