@copilotkit/react-core 2.0.0-rc.7 → 2.0.0-rc.8
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/{MarkdownRendererContext-B4Us6mwL.d.cts → MarkdownRendererContext-DAuVISwv.d.cts} +14 -30
- package/dist/MarkdownRendererContext-DAuVISwv.d.cts.map +1 -0
- package/dist/{MarkdownRendererContext-CRKFzsEB.d.mts → MarkdownRendererContext-XWC2OXD5.d.mts} +15 -31
- package/dist/MarkdownRendererContext-XWC2OXD5.d.mts.map +1 -0
- package/dist/{MarkdownSurfaces-Bd--93O1.mjs → MarkdownSurfaces-BXaxgpm_.mjs} +91 -74
- package/dist/MarkdownSurfaces-BXaxgpm_.mjs.map +1 -0
- package/dist/{MarkdownSurfaces-S4wfUl3J.cjs → MarkdownSurfaces-DQZM4lSI.cjs} +96 -73
- package/dist/MarkdownSurfaces-DQZM4lSI.cjs.map +1 -0
- package/dist/context.cjs +20 -17
- package/dist/context.cjs.map +1 -1
- package/dist/context.d.cts +38 -98
- package/dist/context.d.cts.map +1 -1
- package/dist/context.d.mts +38 -98
- package/dist/context.d.mts.map +1 -1
- package/dist/context.mjs +20 -17
- package/dist/context.mjs.map +1 -1
- package/dist/generative-ui.cjs +35 -15
- package/dist/generative-ui.cjs.map +1 -1
- package/dist/generative-ui.d.cts +9 -9
- package/dist/generative-ui.d.mts +9 -9
- package/dist/generative-ui.mjs +35 -15
- package/dist/generative-ui.mjs.map +1 -1
- package/dist/headless.cjs +50 -76
- package/dist/headless.cjs.map +1 -1
- package/dist/headless.d.cts +78 -253
- package/dist/headless.d.cts.map +1 -1
- package/dist/headless.d.mts +56 -202
- package/dist/headless.d.mts.map +1 -1
- package/dist/headless.mjs +43 -74
- package/dist/headless.mjs.map +1 -1
- package/dist/index.cjs +664 -958
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +168 -472
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +168 -472
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +443 -949
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +754 -1029
- package/dist/index.umd.js.map +1 -1
- package/package.json +9 -10
- package/dist/MarkdownRendererContext-B4Us6mwL.d.cts.map +0 -1
- package/dist/MarkdownRendererContext-CRKFzsEB.d.mts.map +0 -1
- package/dist/MarkdownSurfaces-Bd--93O1.mjs.map +0 -1
- package/dist/MarkdownSurfaces-S4wfUl3J.cjs.map +0 -1
package/dist/generative-ui.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
-
const require_MarkdownSurfaces = require('./MarkdownSurfaces-
|
|
4
|
+
const require_MarkdownSurfaces = require('./MarkdownSurfaces-DQZM4lSI.cjs');
|
|
5
5
|
let react = require("react");
|
|
6
6
|
react = require_MarkdownSurfaces.__toESM(react);
|
|
7
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -2292,10 +2292,14 @@ const ICON_STROKE = {
|
|
|
2292
2292
|
function kebabToPascal(name) {
|
|
2293
2293
|
return name.split(/[-_\s]+/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
2294
2294
|
}
|
|
2295
|
+
/** "ArrowRight" gives "arrow-right", as Lucide names its icon classes. */
|
|
2296
|
+
function pascalToKebab(name) {
|
|
2297
|
+
return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
2298
|
+
}
|
|
2295
2299
|
let lucidePromise = null;
|
|
2296
2300
|
let lucideIcons = null;
|
|
2297
2301
|
function loadLucideIcons() {
|
|
2298
|
-
lucidePromise ??= import("lucide
|
|
2302
|
+
lucidePromise ??= import("lucide").then((module) => {
|
|
2299
2303
|
const icons = module.icons;
|
|
2300
2304
|
lucideIcons = icons;
|
|
2301
2305
|
return icons;
|
|
@@ -2303,9 +2307,9 @@ function loadLucideIcons() {
|
|
|
2303
2307
|
return lucidePromise;
|
|
2304
2308
|
}
|
|
2305
2309
|
/**
|
|
2306
|
-
*
|
|
2307
|
-
*
|
|
2308
|
-
*
|
|
2310
|
+
* Lucide has about 1,500 icons. A static import of its `icons` map puts all
|
|
2311
|
+
* of them in every bundle and makes module load slow. So the map loads once,
|
|
2312
|
+
* on first use, and the icons show when it is there.
|
|
2309
2313
|
*/
|
|
2310
2314
|
function useLucideIcons() {
|
|
2311
2315
|
const [icons, setIcons] = (0, react.useState)(lucideIcons);
|
|
@@ -2321,6 +2325,20 @@ function useLucideIcons() {
|
|
|
2321
2325
|
}, []);
|
|
2322
2326
|
return icons;
|
|
2323
2327
|
}
|
|
2328
|
+
/** The icon for a kebab-case or PascalCase name, or `null` when there is none. */
|
|
2329
|
+
function findLucideIcon(icons, name) {
|
|
2330
|
+
const pascalName = kebabToPascal(name);
|
|
2331
|
+
const key = pascalName in icons ? pascalName : name in icons ? name : null;
|
|
2332
|
+
if (key === null) return null;
|
|
2333
|
+
const nodes = icons[key].map(([tag, attributes]) => ({
|
|
2334
|
+
tag,
|
|
2335
|
+
attributes
|
|
2336
|
+
}));
|
|
2337
|
+
return {
|
|
2338
|
+
lucideName: pascalToKebab(key),
|
|
2339
|
+
nodes
|
|
2340
|
+
};
|
|
2341
|
+
}
|
|
2324
2342
|
/**
|
|
2325
2343
|
* A lucide icon by kebab-case (or PascalCase) name. An unknown name renders
|
|
2326
2344
|
* nothing. Without a `label`, the icon is hidden from screen readers.
|
|
@@ -2333,18 +2351,20 @@ function useLucideIcons() {
|
|
|
2333
2351
|
function LucideIcon({ name, label, description, size = "md", color, weight, inline, style }) {
|
|
2334
2352
|
const icons = useLucideIcons();
|
|
2335
2353
|
if (!name || !icons) return null;
|
|
2336
|
-
const
|
|
2337
|
-
if (!
|
|
2354
|
+
const icon = findLucideIcon(icons, name);
|
|
2355
|
+
if (!icon) return null;
|
|
2338
2356
|
const pixels = typeof size === "number" ? size : inline ? "1em" : ICON_PX$1[size];
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2357
|
+
const a11y = label === void 0 ? { "aria-hidden": true } : {
|
|
2358
|
+
role: "img",
|
|
2359
|
+
"aria-label": label,
|
|
2360
|
+
"aria-description": description
|
|
2361
|
+
};
|
|
2362
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_MarkdownSurfaces.IconSvg, {
|
|
2363
|
+
lucideName: icon.lucideName,
|
|
2364
|
+
nodes: icon.nodes,
|
|
2365
|
+
...a11y,
|
|
2345
2366
|
focusable: "false",
|
|
2346
|
-
|
|
2347
|
-
height: pixels,
|
|
2367
|
+
size: pixels,
|
|
2348
2368
|
color: textColor(color) ?? "currentColor",
|
|
2349
2369
|
strokeWidth: weight ? ICON_STROKE[weight] : void 0,
|
|
2350
2370
|
style: {
|