@copilotkit/react-core 2.0.0-rc.6 → 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.
Files changed (45) hide show
  1. package/dist/{MarkdownRendererContext-B4Us6mwL.d.cts → MarkdownRendererContext-DAuVISwv.d.cts} +14 -30
  2. package/dist/MarkdownRendererContext-DAuVISwv.d.cts.map +1 -0
  3. package/dist/{MarkdownRendererContext-CRKFzsEB.d.mts → MarkdownRendererContext-XWC2OXD5.d.mts} +15 -31
  4. package/dist/MarkdownRendererContext-XWC2OXD5.d.mts.map +1 -0
  5. package/dist/{MarkdownSurfaces-Bd--93O1.mjs → MarkdownSurfaces-BXaxgpm_.mjs} +91 -74
  6. package/dist/MarkdownSurfaces-BXaxgpm_.mjs.map +1 -0
  7. package/dist/{MarkdownSurfaces-S4wfUl3J.cjs → MarkdownSurfaces-DQZM4lSI.cjs} +96 -73
  8. package/dist/MarkdownSurfaces-DQZM4lSI.cjs.map +1 -0
  9. package/dist/context.cjs +20 -17
  10. package/dist/context.cjs.map +1 -1
  11. package/dist/context.d.cts +38 -98
  12. package/dist/context.d.cts.map +1 -1
  13. package/dist/context.d.mts +38 -98
  14. package/dist/context.d.mts.map +1 -1
  15. package/dist/context.mjs +20 -17
  16. package/dist/context.mjs.map +1 -1
  17. package/dist/generative-ui.cjs +35 -15
  18. package/dist/generative-ui.cjs.map +1 -1
  19. package/dist/generative-ui.d.cts +9 -9
  20. package/dist/generative-ui.d.mts +9 -9
  21. package/dist/generative-ui.mjs +35 -15
  22. package/dist/generative-ui.mjs.map +1 -1
  23. package/dist/headless.cjs +50 -76
  24. package/dist/headless.cjs.map +1 -1
  25. package/dist/headless.d.cts +78 -253
  26. package/dist/headless.d.cts.map +1 -1
  27. package/dist/headless.d.mts +56 -202
  28. package/dist/headless.d.mts.map +1 -1
  29. package/dist/headless.mjs +43 -74
  30. package/dist/headless.mjs.map +1 -1
  31. package/dist/index.cjs +667 -963
  32. package/dist/index.cjs.map +1 -1
  33. package/dist/index.d.cts +168 -485
  34. package/dist/index.d.cts.map +1 -1
  35. package/dist/index.d.mts +168 -485
  36. package/dist/index.d.mts.map +1 -1
  37. package/dist/index.mjs +446 -954
  38. package/dist/index.mjs.map +1 -1
  39. package/dist/index.umd.js +757 -1034
  40. package/dist/index.umd.js.map +1 -1
  41. package/package.json +9 -10
  42. package/dist/MarkdownRendererContext-B4Us6mwL.d.cts.map +0 -1
  43. package/dist/MarkdownRendererContext-CRKFzsEB.d.mts.map +0 -1
  44. package/dist/MarkdownSurfaces-Bd--93O1.mjs.map +0 -1
  45. package/dist/MarkdownSurfaces-S4wfUl3J.cjs.map +0 -1
@@ -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-S4wfUl3J.cjs');
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-react").then((module) => {
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
- * lucide-react has about 1,500 icons. A static import of its `icons` map
2307
- * puts all of them in every bundle and makes module load slow. So the map
2308
- * loads once, on first use, and the icons show when it is there.
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 IconComponent = icons[kebabToPascal(name)] ?? icons[name];
2337
- if (!IconComponent) return null;
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
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconComponent, {
2340
- ...label === void 0 ? { "aria-hidden": true } : {
2341
- role: "img",
2342
- "aria-label": label,
2343
- "aria-description": description
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
- width: pixels,
2347
- height: pixels,
2367
+ size: pixels,
2348
2368
  color: textColor(color) ?? "currentColor",
2349
2369
  strokeWidth: weight ? ICON_STROKE[weight] : void 0,
2350
2370
  style: {