@copilotkit/react-core 2.0.0-rc.2 → 2.0.0-rc.20

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 (47) hide show
  1. package/dist/{MarkdownRendererContext-B4Us6mwL.d.cts → MarkdownRendererContext-Bsl28Gmn.d.mts} +17 -33
  2. package/dist/MarkdownRendererContext-Bsl28Gmn.d.mts.map +1 -0
  3. package/dist/{MarkdownRendererContext-CRKFzsEB.d.mts → MarkdownRendererContext-CBppkb5j.d.cts} +17 -33
  4. package/dist/MarkdownRendererContext-CBppkb5j.d.cts.map +1 -0
  5. package/dist/{MarkdownSurfaces-Bd--93O1.mjs → MarkdownSurfaces-Bt7TD_U1.mjs} +177 -136
  6. package/dist/MarkdownSurfaces-Bt7TD_U1.mjs.map +1 -0
  7. package/dist/{MarkdownSurfaces-S4wfUl3J.cjs → MarkdownSurfaces-CoUoPhR9.cjs} +198 -156
  8. package/dist/MarkdownSurfaces-CoUoPhR9.cjs.map +1 -0
  9. package/dist/context.cjs +28 -26
  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 +28 -26
  16. package/dist/context.mjs.map +1 -1
  17. package/dist/generative-ui.cjs +570 -567
  18. package/dist/generative-ui.cjs.map +1 -1
  19. package/dist/generative-ui.d.cts +2137 -4178
  20. package/dist/generative-ui.d.cts.map +1 -1
  21. package/dist/generative-ui.d.mts +2137 -4178
  22. package/dist/generative-ui.d.mts.map +1 -1
  23. package/dist/generative-ui.mjs +75 -73
  24. package/dist/generative-ui.mjs.map +1 -1
  25. package/dist/headless.cjs +55 -84
  26. package/dist/headless.cjs.map +1 -1
  27. package/dist/headless.d.cts +78 -253
  28. package/dist/headless.d.cts.map +1 -1
  29. package/dist/headless.d.mts +56 -202
  30. package/dist/headless.d.mts.map +1 -1
  31. package/dist/headless.mjs +48 -82
  32. package/dist/headless.mjs.map +1 -1
  33. package/dist/index.cjs +1628 -2398
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.d.cts +203 -540
  36. package/dist/index.d.cts.map +1 -1
  37. package/dist/index.d.mts +202 -539
  38. package/dist/index.d.mts.map +1 -1
  39. package/dist/index.mjs +965 -2248
  40. package/dist/index.mjs.map +1 -1
  41. package/dist/index.umd.js +1776 -2466
  42. package/dist/index.umd.js.map +1 -1
  43. package/package.json +17 -18
  44. package/dist/MarkdownRendererContext-B4Us6mwL.d.cts.map +0 -1
  45. package/dist/MarkdownRendererContext-CRKFzsEB.d.mts.map +0 -1
  46. package/dist/MarkdownSurfaces-Bd--93O1.mjs.map +0 -1
  47. package/dist/MarkdownSurfaces-S4wfUl3J.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"generative-ui.d.mts","names":[],"sources":["../src/generative-ui/refs.ts","../src/generative-ui/catalog-export.ts","../src/generative-ui/GenerativeUISurface.tsx","../src/generative-ui/markdown/MarkdownSurfaces.tsx","../src/generative-ui/hooks.ts","../src/generative-ui/standard/index.ts"],"mappings":";;;;;;;;;;;;;iBAgCgB,KAAA,CAAM,WAAA,YAAoB,CAAA,CAAA,UAAA,CAAA,CAAA,CAAA,SAAA,uCAAA,KAAA,CAAA,YAAA,mBAAA,KAAA,CAAA,qBAAA,SAAA,QAAA,CAAA,SAAA,IAAA,KAAA,CAAA,WAAA;;;AAA1C;;;;iBAcgB,SAAA,CAAU,WAAA,YAAoB,CAAA,CAAA,UAAA,CAAA,CAAA,CAAA,QAAA,EAAA,CAAA,CAAA,QAAA,CAAA,CAAA,CAAA,SAAA,WAAA,CAAA,CAAA,SAAA;;;;;;;;;gFAAA,KAAA,CAAA,qBAAA;;;;;;;UChB7B,wBAAA;;EAEf,KAAA;;EAEA,WAAA;;EAEA,YAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;ADUF;;;iBCkBgB,iBAAA,CACd,EAAA,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iBIgEgB,uBAAA,YACH,YAAA,oBACE,wBAAA,CAAyB,EAAA,EAAA,CAEtC,EAAA,EAAI,EAAA,EACJ,IAAA,EAAM,IAAA,EACN,OAAA,GAAU,IAAA,EAAM,wBAAA,CAAyB,EAAA,EAAI,IAAA;;;;;;;;;;;;AJpF/C;;;;;;;;;;;;;;;cKuCa,UAAA;;;;;;cAGX,GAAA,CAAA,SAAA"}
1
+ {"version":3,"file":"generative-ui.d.mts","names":[],"sources":["../src/generative-ui/refs.ts","../src/generative-ui/catalog-export.ts","../src/generative-ui/GenerativeUISurface.tsx","../src/generative-ui/markdown/MarkdownSurfaces.tsx","../src/generative-ui/hooks.ts","../src/generative-ui/standard/index.ts"],"mappings":";;;;;;;;;;;;;iBAgCgB,KAAA,CAAM,WAAA,YAAoB,CAAA,CAAA,OAAA,CAAA,CAAA,CAAA,SAAA,EAAA,CAAA,CAAA,YAAA,sCAAA,KAAA,CAAA,YAAA,mBAAA,KAAA,CAAA,qBAAA,SAAA,QAAA,CAAA,SAAA,IAAA,KAAA,CAAA,WAAA;;;AAA1C;;;;iBAcgB,SAAA,CAAU,WAAA,YAAoB,CAAA,CAAA,OAAA,CAAA,CAAA,CAAA,QAAA,WAAA,CAAA,CAAA,QAAA,CAAA,CAAA,CAAA,SAAA,GAAA,CAAA,CAAA,SAAA;;;8GAAA,KAAA,CAAA,qBAAA;;;;;;;UChB7B,wBAAA;;EAEf,KAAA;;EAEA,WAAA;;EAEA,YAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4Bc,iBAAA,CACd,EAAA,EAAI,YAAA,EACJ,OAAA,GAAS,wBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UC1DD,4BAAA;;EAER,EAAA;;;;;EAKA,WAAA;EFiBmB;EEfnB,QAAA,GAAW,SAAA;EACX,SAAA;EFcwC;;;;;;EEPxC,UAAA;AAAA;;;;;KAqBU,wBAAA,YACC,YAAA,QAAoB,YAAA,SAC7B,4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@ -1,10 +1,10 @@
1
1
  "use client";
2
2
 
3
- import { A as GenerativeUIError, F as toJsonSchema, P as createGenerativeUI, _ as GenerativeUINodeContext, b as useRequiredGenerativeUIRuntime, c as SurfaceView, d as namedRole, f as useGenerativeUIAccessibility, g as useManagerVersion, h as useGenerativeUIState, j as isRecord, l as DARK_THEME_CSS, m as useGenerativeUIFunction, n as ProviderMarkdown, p as wrapperAria, r as DefaultGenerativeUIChatCard, t as MarkdownSurfaces, u as controlAria, y as useGenerativeUIRuntime } from "./MarkdownSurfaces-Bd--93O1.mjs";
3
+ import { F as toJsonSchema, K as IconSvg, O as isRecord, P as createGenerativeUI, _ as GenerativeUINodeContext, b as useRequiredGenerativeUIRuntime, c as SurfaceView, d as namedRole, f as useGenerativeUIAccessibility, g as useManagerVersion, h as useGenerativeUIState, j as GenerativeUIError, l as DARK_THEME_CSS, m as useGenerativeUIFunction, n as ProviderMarkdown, p as wrapperAria, r as DefaultGenerativeUIChatCard, t as MarkdownSurfaces, u as controlAria, y as useGenerativeUIRuntime } from "./MarkdownSurfaces-Bt7TD_U1.mjs";
4
4
  import React, { Suspense, createContext, isValidElement, memo, useCallback, useContext, useEffect, useId, useInsertionEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
5
5
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { A2UI_CHILD_LIST_MARK, A2UI_CHILD_LIST_REF, A2UI_COMPONENT_ID_MARK, A2UI_COMPONENT_ID_REF, GENERATIVE_UI_FUNCTIONS, GENERATIVE_UI_MAX_TARGET_COMPONENTS, childRefKind, functionCallers } from "@copilotkit/shared";
7
- import { z } from "zod";
7
+ import * as z from "zod";
8
8
  import { createPortal } from "react-dom";
9
9
 
10
10
  //#region src/generative-ui/refs.ts
@@ -584,27 +584,6 @@ const BORDER_COLORS = [
584
584
  "danger",
585
585
  "discovery"
586
586
  ];
587
- const BACKGROUNDS = [
588
- "surface",
589
- "surface-secondary",
590
- "surface-tertiary",
591
- "surface-elevated",
592
- "surface-elevated-secondary",
593
- "surface-inverted",
594
- "surface-soft",
595
- "info",
596
- "warning",
597
- "caution",
598
- "success",
599
- "danger",
600
- "discovery",
601
- "info-solid",
602
- "warning-solid",
603
- "caution-solid",
604
- "success-solid",
605
- "danger-solid",
606
- "discovery-solid"
607
- ];
608
587
  const RADIUS_PX = {
609
588
  "2xs": "2px",
610
589
  xs: "4px",
@@ -995,7 +974,7 @@ const layoutProps = {
995
974
  rowGap: sizeValue.optional(),
996
975
  columnGap: sizeValue.optional(),
997
976
  padding: sizeValue.optional().describe("4px steps when a number"),
998
- background: z.string().optional().describe(`One of ${BACKGROUNDS.join("|")} or a CSS color. Leave it unset. Only one summary panel in a Card can use "surface-secondary"`),
977
+ background: z.string().optional().describe("Leave it unset. A surface token such as surface, surface-secondary, info, success, warning, danger, discovery, or one with -solid, or a CSS color. Only one summary panel in a Card uses \"surface-secondary\""),
999
978
  border: z.boolean().optional(),
1000
979
  borderColor: z.enum(BORDER_COLORS).optional(),
1001
980
  radius: radiusValue.optional(),
@@ -1345,6 +1324,7 @@ function cardShadow(props) {
1345
1324
  case "md": return SHADOW_MD;
1346
1325
  case "sm": return SHADOW_SM;
1347
1326
  case "none": return "none";
1327
+ case void 0:
1348
1328
  default: return props.variant === "elevated" ? SHADOW_SOFT : void 0;
1349
1329
  }
1350
1330
  }
@@ -1863,7 +1843,7 @@ const layoutComponents = {
1863
1843
  },
1864
1844
  Row: {
1865
1845
  component: Row,
1866
- description: "A horizontal flex container. For a label and value pair, use a Row with justify \"spaceBetween\": a Caption on the left and a Text with fontWeight \"medium\" on the right. Put buttons in a Row at the bottom of a Card: one Button with variant \"primary\", and the default or \"borderless\" for the others.",
1846
+ description: "A horizontal flex container. Label and value pair: justify \"spaceBetween\", a Caption left and a Text with fontWeight \"medium\" right. Buttons go in a Row at the bottom of a Card: one variant \"primary\", the others default or \"borderless\".",
1867
1847
  props: layoutSchema,
1868
1848
  events: VISIBLE_EVENT,
1869
1849
  slots: CHILDREN_SLOT
@@ -1884,7 +1864,7 @@ const layoutComponents = {
1884
1864
  },
1885
1865
  Card: {
1886
1866
  component: Card,
1887
- description: "A bordered, padded container, only for an interactive panel (controls, a form, a configurator). Tables, charts and text do not need one. Give it a Title and a Caption. Separate the groups in it with a Divider or the plain gap, never with a nested Card or a bordered Box. Variant \"section\" is a heading and content without a box. Variant \"outline\" always has a box. In markdown mode, a Card without controls renders as \"section\" unless it sets variant or border.",
1867
+ description: "A bordered panel, only for an interactive panel (controls, a form, a configurator); tables, charts and text need none. Give it a Title and a Caption. Separate groups with a Divider or the gap, never a nested Card or bordered Box. Variant \"section\": no box; \"outline\": always a box. In markdown mode, without controls it renders as \"section\" unless variant or border is set.",
1888
1868
  props: cardSchema,
1889
1869
  events: VISIBLE_EVENT,
1890
1870
  slots: {
@@ -1908,7 +1888,7 @@ const layoutComponents = {
1908
1888
  },
1909
1889
  Carousel: {
1910
1890
  component: Carousel,
1911
- description: "A row that scrolls horizontally and snaps to its slides, with previous and next arrows. Put CarouselItem or CarouselMediaItem children in it. Bind activeIndex with { \"@path\": \"/x\" } to read or set the slide in view.",
1891
+ description: "A horizontally scrolling row that snaps to its CarouselItem or CarouselMediaItem children, with arrows. Bind activeIndex to read or set the slide in view.",
1912
1892
  props: carouselSchema,
1913
1893
  events: VISIBLE_EVENT,
1914
1894
  slots: CHILDREN_SLOT,
@@ -1923,7 +1903,7 @@ const layoutComponents = {
1923
1903
  },
1924
1904
  CarouselMediaItem: {
1925
1905
  component: CarouselMediaItem,
1926
- description: "A slide of a Carousel with an image on top and its children (a Caption, a Text) under it. size \"sm\" is 160px, \"md\" 240px (default), \"lg\" 320px wide. A click on the image opens all slides full-screen, unless href or onClick is set.",
1906
+ description: "A Carousel slide: an image with its children (a Caption, a Text) under it. size \"sm\" 160px, \"md\" 240px (default), \"lg\" 320px wide. A click opens all slides full-screen, unless href or onClick is set.",
1927
1907
  props: carouselMediaItemSchema,
1928
1908
  events: {
1929
1909
  ...VISIBLE_EVENT,
@@ -2290,10 +2270,14 @@ const ICON_STROKE = {
2290
2270
  function kebabToPascal(name) {
2291
2271
  return name.split(/[-_\s]+/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
2292
2272
  }
2273
+ /** "ArrowRight" gives "arrow-right", as Lucide names its icon classes. */
2274
+ function pascalToKebab(name) {
2275
+ return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
2276
+ }
2293
2277
  let lucidePromise = null;
2294
2278
  let lucideIcons = null;
2295
2279
  function loadLucideIcons() {
2296
- lucidePromise ??= import("lucide-react").then((module) => {
2280
+ lucidePromise ??= import("lucide").then((module) => {
2297
2281
  const icons = module.icons;
2298
2282
  lucideIcons = icons;
2299
2283
  return icons;
@@ -2301,9 +2285,9 @@ function loadLucideIcons() {
2301
2285
  return lucidePromise;
2302
2286
  }
2303
2287
  /**
2304
- * lucide-react has about 1,500 icons. A static import of its `icons` map
2305
- * puts all of them in every bundle and makes module load slow. So the map
2306
- * loads once, on first use, and the icons show when it is there.
2288
+ * Lucide has about 1,500 icons. A static import of its `icons` map puts all
2289
+ * of them in every bundle and makes module load slow. So the map loads once,
2290
+ * on first use, and the icons show when it is there.
2307
2291
  */
2308
2292
  function useLucideIcons() {
2309
2293
  const [icons, setIcons] = useState(lucideIcons);
@@ -2319,6 +2303,20 @@ function useLucideIcons() {
2319
2303
  }, []);
2320
2304
  return icons;
2321
2305
  }
2306
+ /** The icon for a kebab-case or PascalCase name, or `null` when there is none. */
2307
+ function findLucideIcon(icons, name) {
2308
+ const pascalName = kebabToPascal(name);
2309
+ const key = pascalName in icons ? pascalName : name in icons ? name : null;
2310
+ if (key === null) return null;
2311
+ const nodes = icons[key].map(([tag, attributes]) => ({
2312
+ tag,
2313
+ attributes
2314
+ }));
2315
+ return {
2316
+ lucideName: pascalToKebab(key),
2317
+ nodes
2318
+ };
2319
+ }
2322
2320
  /**
2323
2321
  * A lucide icon by kebab-case (or PascalCase) name. An unknown name renders
2324
2322
  * nothing. Without a `label`, the icon is hidden from screen readers.
@@ -2331,18 +2329,20 @@ function useLucideIcons() {
2331
2329
  function LucideIcon({ name, label, description, size = "md", color, weight, inline, style }) {
2332
2330
  const icons = useLucideIcons();
2333
2331
  if (!name || !icons) return null;
2334
- const IconComponent = icons[kebabToPascal(name)] ?? icons[name];
2335
- if (!IconComponent) return null;
2332
+ const icon = findLucideIcon(icons, name);
2333
+ if (!icon) return null;
2336
2334
  const pixels = typeof size === "number" ? size : inline ? "1em" : ICON_PX$1[size];
2337
- return /* @__PURE__ */ jsx(IconComponent, {
2338
- ...label === void 0 ? { "aria-hidden": true } : {
2339
- role: "img",
2340
- "aria-label": label,
2341
- "aria-description": description
2342
- },
2335
+ const a11y = label === void 0 ? { "aria-hidden": true } : {
2336
+ role: "img",
2337
+ "aria-label": label,
2338
+ "aria-description": description
2339
+ };
2340
+ return /* @__PURE__ */ jsx(IconSvg, {
2341
+ lucideName: icon.lucideName,
2342
+ nodes: icon.nodes,
2343
+ ...a11y,
2343
2344
  focusable: "false",
2344
- width: pixels,
2345
- height: pixels,
2345
+ size: pixels,
2346
2346
  color: textColor(color) ?? "currentColor",
2347
2347
  strokeWidth: weight ? ICON_STROKE[weight] : void 0,
2348
2348
  style: {
@@ -2998,7 +2998,7 @@ const mediaComponents = {
2998
2998
  },
2999
2999
  Video: {
3000
3000
  component: Video,
3001
- description: "A video player for a video file URL (with optional captions), or a YouTube link in privacy-enhanced mode: the poster shows first, and the player loads when the user presses play. A page on another video site shows as a link to it. Set title to name the video.",
3001
+ description: "A video file URL (optional captions) or a YouTube link, privacy-enhanced: the poster shows until play. Other video sites show as a link. Set title.",
3002
3002
  props: videoSchema
3003
3003
  },
3004
3004
  AudioPlayer: {
@@ -3044,7 +3044,7 @@ const followUpItem = z.union([z.string(), z.object({
3044
3044
  message: text("The text sent when the user clicks. Default: label")
3045
3045
  })]);
3046
3046
  const followUpSchema = z.object({
3047
- items: z.array(followUpItem).optional().describe("Strings or { \"label\", \"message\"? }, or { \"@path\": \"/x\" }"),
3047
+ items: z.array(followUpItem).optional(),
3048
3048
  title: text("A caption above the pills")
3049
3049
  });
3050
3050
  const followUpArgs = z.object({ message: z.string().describe("The message of the clicked pill") });
@@ -3092,7 +3092,7 @@ const gridImage = z.object({
3092
3092
  href: text("Opens this URL instead of the full-screen view")
3093
3093
  });
3094
3094
  const imageGridSchema = z.object({
3095
- images: z.array(gridImage).optional().describe("A list of { \"url\", \"description\"?, \"caption\"?, \"href\"? }, or { \"@path\": \"/x\" }"),
3095
+ images: z.array(gridImage).optional(),
3096
3096
  columns: z.number().optional().describe("Default 3"),
3097
3097
  aspectRatio: z.string().optional().describe("Default \"1 / 1\""),
3098
3098
  gap: sizeValue.optional().describe("Default 2"),
@@ -3672,7 +3672,7 @@ function ImageGrid(props) {
3672
3672
  const compositeComponents = {
3673
3673
  LinkCard: {
3674
3674
  component: LinkCard,
3675
- description: "A preview card of a URL: the favicon and domain, the title, a description and a thumbnail. A click opens the link in a new tab, or sends onClick when it is bound. Use it for sources, articles and products that have a page.",
3675
+ description: "A preview of a URL: favicon and domain, title, description, thumbnail. A click opens it in a new tab, or sends onClick when bound. For sources, articles and products with a page.",
3676
3676
  props: linkCardSchema,
3677
3677
  events: { onClick: {
3678
3678
  description: "Sent when the user clicks the card, instead of the link.",
@@ -3681,12 +3681,12 @@ const compositeComponents = {
3681
3681
  },
3682
3682
  Citation: {
3683
3683
  component: Citation,
3684
- description: "An inline source marker ([1]) that shows the source on hover or click: the title, a snippet and a link. Put it inline after the sentence it supports, as a child of a Text or in a Row.",
3684
+ description: "An inline source marker ([1]) showing title, snippet and link on hover or click. Put it right after the sentence it supports, as a child of a Text or in a Row.",
3685
3685
  props: citationSchema
3686
3686
  },
3687
3687
  FollowUp: {
3688
3688
  component: FollowUp,
3689
- description: "Suggested next prompts as pills. A click sends the message of the pill as the next turn of the user, with no event binding needed. Put it at the end of a surface, with two to four short items.",
3689
+ description: "Suggested next prompts as pills; a click sends the pill's message as the user's next turn, no event needed. At the end of a surface, two to four short items.",
3690
3690
  props: followUpSchema,
3691
3691
  events: { onFollowUp: {
3692
3692
  description: "Sent when the user clicks a pill. The args carry the message of the pill.",
@@ -3695,7 +3695,7 @@ const compositeComponents = {
3695
3695
  },
3696
3696
  EntityCard: {
3697
3697
  component: EntityCard,
3698
- description: "A card for one thing (a product, place, person or listing): an image, title, subtitle, description, a price or meta line, a badge, a rating and up to three buttons. href opens a page, and onClick is sent when it is bound. Use a Grid of EntityCards for several things.",
3698
+ description: "A card for one product, place, person or listing: image, title, subtitle, description, a price or meta line, badge, rating and up to three buttons. href opens a page; onClick is sent when bound. Use a Grid of them for several things.",
3699
3699
  props: entityCardSchema,
3700
3700
  events: {
3701
3701
  onClick: {
@@ -3731,9 +3731,9 @@ const chartSchema = z.object({
3731
3731
  "pie",
3732
3732
  "donut"
3733
3733
  ]).optional().describe("Default \"bar\""),
3734
- data: z.array(z.record(z.string(), z.unknown())).optional().describe("A list of objects, or { \"@path\": \"/x\" }"),
3734
+ data: z.array(z.record(z.string(), z.unknown())).optional(),
3735
3735
  xKey: z.string().optional().describe("The field of the category axis"),
3736
- series: z.array(chartSeries).optional().describe("The value fields: strings or { \"key\", \"label\"?, \"color\"? }. Default: every number field except xKey"),
3736
+ series: z.array(chartSeries).optional().describe("Default: every number field except xKey"),
3737
3737
  stacked: z.boolean().optional(),
3738
3738
  layout: z.enum(["vertical", "horizontal"]).optional().describe("\"horizontal\" draws the bars from left to right. Default \"vertical\""),
3739
3739
  yAxis: z.object({
@@ -3741,7 +3741,7 @@ const chartSchema = z.object({
3741
3741
  min: z.number().optional(),
3742
3742
  max: z.number().optional(),
3743
3743
  width: z.number().optional().describe("Pixels")
3744
- }).optional().describe("The value axis configuration object: {label?: string, min?: number, max?: number, width?: number}. Example: {label: \"Revenue (USD)\", min: 0, max: 100}. In horizontal charts, label, min and max apply to the horizontal value axis, and width sets the width of the category axis on the left."),
3744
+ }).optional().describe("Example: {label: \"Revenue (USD)\", min: 0, max: 100}. In a horizontal chart it is the horizontal axis, and width sets the category axis width"),
3745
3745
  showDots: z.boolean().optional().describe("Point markers on a line or area"),
3746
3746
  barRadius: z.number().optional().describe("The corner radius of a bar, in pixels"),
3747
3747
  innerRadius: z.union([z.number(), z.string()]).optional().describe("Pie and donut"),
@@ -3760,7 +3760,7 @@ const chartSchema = z.object({
3760
3760
  "number",
3761
3761
  "currency",
3762
3762
  "percent"
3763
- ]).optional().describe("Number formatting. With \"percent\", data values and axis min/max are fractions: 0.4 displays as 40%. For 0% to 10%, use min: 0 and max: 0.1."),
3763
+ ]).optional().describe("With \"percent\", data values and axis min/max are fractions: 0.4 shows as 40%; for 0% to 10%, use min: 0 and max: 0.1."),
3764
3764
  currency: z.string().optional().describe("ISO code. Default \"USD\""),
3765
3765
  title: z.string().optional()
3766
3766
  });
@@ -4174,7 +4174,7 @@ const mapMarker = z.object({
4174
4174
  icon: z.string().optional()
4175
4175
  });
4176
4176
  const mapSchema = z.object({
4177
- markers: z.array(mapMarker).optional().describe("A list of places, or { \"@path\": \"/x\" }"),
4177
+ markers: z.array(mapMarker).optional(),
4178
4178
  route: z.boolean().optional().describe("Draws a line through the markers in order"),
4179
4179
  selected: z.string().optional().describe("The label of the selected marker. Bind it with { \"@path\": \"/x\" } to read the choice of the user"),
4180
4180
  height: z.number().optional().describe("Pixels. Default 240"),
@@ -4502,8 +4502,8 @@ const tableColumn = z.union([
4502
4502
  ]);
4503
4503
  const tableSchema = z.object({
4504
4504
  caption: z.string().optional().describe("A short name of the table for screen readers. It is not shown"),
4505
- columns: z.array(tableColumn).optional().describe("Strings, { \"label\", \"align\"?, \"width\"?, \"componentId\"? } or { \"componentId\" }, or { \"@path\": \"/x\" }. Default []"),
4506
- rows: z.array(z.array(z.unknown())).optional().describe("A list of row lists, or { \"@path\": \"/x\" }. A cell is a string, a number, or { \"componentId\": \"<id>\" } to show a component. Default []"),
4505
+ columns: z.array(tableColumn).optional().describe("Default []"),
4506
+ rows: z.array(z.array(z.unknown())).optional().describe("A list of row lists. A cell is a string, a number, or { \"componentId\": \"<id>\" } to show a component. Default []"),
4507
4507
  columnSizing: z.enum(["auto", "equal"]).optional().describe("Default \"auto\""),
4508
4508
  dividers: z.boolean().optional().describe("Default true"),
4509
4509
  stickyHeader: z.boolean().optional().describe("Default false"),
@@ -4535,7 +4535,7 @@ const listItemValue = z.union([z.string(), z.object({
4535
4535
  value: z.union([z.string(), z.number()]).optional().describe("Without an action: shown on the right of the label, for a key and value fact. With an action: the payload of the pick, not shown")
4536
4536
  })]);
4537
4537
  const listSchema = z.object({
4538
- items: z.array(listItemValue).optional().describe("Strings or { \"label\", \"value\"?, \"description\"?, \"icon\"? }, or { \"@path\": \"/x\" }"),
4538
+ items: z.array(listItemValue).optional(),
4539
4539
  direction: z.enum(["vertical", "horizontal"]).optional().describe("Default \"vertical\". \"horizontal\" scrolls sideways"),
4540
4540
  align: z.enum([
4541
4541
  "start",
@@ -4989,7 +4989,7 @@ function ListItem(props) {
4989
4989
  const dataComponents = {
4990
4990
  Table: {
4991
4991
  component: Table,
4992
- description: "A data table. Put it in a plain Column, not in a Card. Give \"columns\" and \"rows\" (a list of row lists). Or give \"children\": TableSection or TableRow ids, or a template { \"componentId\", \"path\" } that repeats a TableRow for each item of a data list. To show a component (Badge, Button, Icon, Text) in a cell or a column header, set it to { \"componentId\": \"<id>\" } and put the id in \"cellComponents\".",
4992
+ description: "A data table, in a plain Column, not a Card. Give \"columns\" and \"rows\", or \"children\": TableSection or TableRow ids, or a template { \"componentId\", \"path\" } repeating a TableRow per item. A component in a cell or header (Badge, Button, Icon, Text): { \"componentId\": \"<id>\" }, with the id in \"cellComponents\".",
4993
4993
  props: tableSchema,
4994
4994
  slots: {
4995
4995
  children: "multiple",
@@ -5019,7 +5019,7 @@ const dataComponents = {
5019
5019
  },
5020
5020
  List: {
5021
5021
  component: List,
5022
- description: "A list in a Card or next to another component. A plain list of text is markdown, not a List. Give \"items\" (strings or { \"label\", \"value\"?, \"description\"?, \"icon\"? }); without an action, an item with a value is a key and value row, for facts like Price: $1,599. Or, when there are no items, give \"children\": ListItem ids or a template. With an \"action\", the user can pick an item: the event context gets \"index\", \"label\" and \"value\" of the item.",
5022
+ description: "A list in a Card or next to another component; a plain list of text is markdown. Give \"items\": an item with a value and no action is a key-value row (Price: $1,599). Or give \"children\": ListItem ids or a template. With \"action\" the user picks an item; the event context gets its index, label and value.",
5023
5023
  props: listSchema,
5024
5024
  events: { action: {
5025
5025
  description: "Runs when the user picks an item. The args are the index, label and value of the item.",
@@ -5044,7 +5044,7 @@ const dataComponents = {
5044
5044
  },
5045
5045
  Map: {
5046
5046
  component: MapView,
5047
- description: "A map with markers. With \"route\", a line connects the markers in order. Bind \"selected\" to { \"@path\": \"/x\" } to get the label of the marker that the user picks. When maps are not available, it shows a list of the places.",
5047
+ description: "A map with markers; with \"route\" a line connects them in order. Bind \"selected\" to get the label of the marker the user picks. Without maps it shows a list of the places.",
5048
5048
  props: mapSchema,
5049
5049
  writable: ["selected"]
5050
5050
  }
@@ -5600,7 +5600,7 @@ const feedbackComponents = {
5600
5600
  },
5601
5601
  Popover: {
5602
5602
  component: Popover,
5603
- description: "A small overlay next to a trigger. Put exactly two children in it: one PopoverTrigger, then one PopoverContent. A click on the trigger opens and closes the content. Escape or a click outside closes it.",
5603
+ description: "A small overlay: exactly two children, one PopoverTrigger then one PopoverContent. A click on the trigger toggles it; Escape or a click outside closes it.",
5604
5604
  props: popoverSchema,
5605
5605
  slots: CHILDREN_SLOT,
5606
5606
  writable: ["open"]
@@ -5648,7 +5648,7 @@ const validationResult = z.object({
5648
5648
  message: z.string().optional(),
5649
5649
  code: z.string().optional(),
5650
5650
  severity: severity.optional()
5651
- }).passthrough();
5651
+ }).loose();
5652
5652
  const checksProp = z.array(z.object({
5653
5653
  condition: z.union([z.boolean(), validationResult]).optional().describe("A validator call, for example {\"@call\":\"required\",\"args\":{\"value\":{\"@path\":\"/x\"}}}, or a boolean binding"),
5654
5654
  message: z.string().optional().describe("Shown when the check fails, instead of the default message")
@@ -5734,7 +5734,7 @@ const optionList = z.array(z.union([z.string(), z.object({
5734
5734
  value: z.string(),
5735
5735
  label: z.string().optional(),
5736
5736
  description: z.string().optional()
5737
- })])).optional().describe("Strings or { \"value\", \"label\", \"description\"? }");
5737
+ })])).optional();
5738
5738
  const SIZES = [
5739
5739
  "sm",
5740
5740
  "md",
@@ -6349,7 +6349,7 @@ function dateTimeMode(props) {
6349
6349
  /** The date and the time of an ISO 8601 value: a date, a time, or both. */
6350
6350
  function splitDateTime(value) {
6351
6351
  const [head, tail] = value.split("T");
6352
- if (tail !== void 0) return {
6352
+ if (head !== void 0 && tail !== void 0) return {
6353
6353
  date: head,
6354
6354
  time: tail
6355
6355
  };
@@ -6410,7 +6410,7 @@ function fullTime(time) {
6410
6410
  }
6411
6411
  /** The minute of the day of a time, rounded up to a whole minute. */
6412
6412
  function timeToMinute(time) {
6413
- const [hours, minutes, seconds] = fullTime(time).split(":").map(Number);
6413
+ const [hours = NaN, minutes = NaN, seconds = NaN] = fullTime(time).split(":").map(Number);
6414
6414
  return hours * 60 + minutes + (seconds > 0 ? 1 : 0);
6415
6415
  }
6416
6416
  /**
@@ -7036,8 +7036,10 @@ function SegmentedControl(props) {
7036
7036
  const onKeyDown = (event, index) => {
7037
7037
  const next = nextOptionIndex(event.key, index, options.length);
7038
7038
  if (next === void 0) return;
7039
+ const option = options[next];
7040
+ if (option === void 0) return;
7039
7041
  event.preventDefault();
7040
- props.setValue(options[next].value);
7042
+ props.setValue(option.value);
7041
7043
  segments.current[next]?.focus();
7042
7044
  };
7043
7045
  return /* @__PURE__ */ jsx(Field, {
@@ -7186,7 +7188,7 @@ function Slider(props) {
7186
7188
  const inputComponents = {
7187
7189
  Button: {
7188
7190
  component: Button,
7189
- description: "A button that sends its onClick event. With href it opens the URL, and with copy it copies the text, both without the agent. Use variant \"primary\" for the one main Button in a Row, and the default for the others. With submit true inside a Form, it submits the Form. The child or children render instead of the label. With checks, it is disabled while a check fails.",
7191
+ description: "Sends its onClick event; with href it opens the URL, with copy it copies the text. Variant \"primary\" for the one main Button in a Row. submit true submits the Form around it. Its children render instead of the label. With checks it is disabled while a check fails.",
7190
7192
  props: buttonSchema,
7191
7193
  events: { onClick: {
7192
7194
  description: "Sent when the user clicks the button.",
@@ -7212,7 +7214,7 @@ const inputComponents = {
7212
7214
  },
7213
7215
  Form: {
7214
7216
  component: Form,
7215
- description: "A layout container that is a form. It sends its onSubmit event when the user submits it (a Button with submit true, or Enter in a field). Put the values of its fields in the event context with { \"@path\": \"/x\" }.",
7217
+ description: "A layout container that is a form. It sends onSubmit when the user submits (a Button with submit true, or Enter in a field). Put its field values in the event context with { \"@path\": \"/x\" }.",
7216
7218
  props: formSchema,
7217
7219
  events: { onSubmit: {
7218
7220
  description: "Sent when the user submits the form.",
@@ -7269,13 +7271,13 @@ const inputComponents = {
7269
7271
  },
7270
7272
  ChoicePicker: {
7271
7273
  component: ChoicePicker,
7272
- description: "A list of options, as checkboxes or chips. The user picks one, or several with variant \"multipleSelection\". Bind value with { \"@path\": \"/x\" } to read the chosen values as a list. Give it a label.",
7274
+ description: "Options as checkboxes or chips: pick one, or several with variant \"multipleSelection\". Its value is the list of chosen values. Give it a label.",
7273
7275
  props: choicePickerSchema,
7274
7276
  writable: VALUE_WRITABLE
7275
7277
  },
7276
7278
  DateTimeInput: {
7277
7279
  component: DateTimeInput,
7278
- description: "A date picker, or a time picker with enableTime, or both. Set timeStep (minutes) to offer fixed times, e.g. 30 for a booking. The value is ISO 8601. Bind value with { \"@path\": \"/x\" } to read it. Give it a label.",
7280
+ description: "A date picker, a time picker with enableTime, or both. timeStep (minutes) offers fixed times, e.g. 30 for a booking. The value is ISO 8601. Give it a label.",
7279
7281
  props: dateTimeInputSchema,
7280
7282
  writable: VALUE_WRITABLE
7281
7283
  }
@@ -7778,12 +7780,12 @@ function Tooltip({ trigger, content }) {
7778
7780
  const textComponents = {
7779
7781
  Title: {
7780
7782
  component: Title,
7781
- description: "A heading inside a Card or next to another component. A heading alone is markdown outside the fence. Use size \"2xl\" at most once in a surface, and \"lg\" for section headings. Size \"sm\" is an h4, \"md\" and \"lg\" are an h3 (default \"md\"), \"xl\" and larger are an h2. It is bold unless strong is false.",
7783
+ description: "A heading in a Card or next to another component; a heading alone is markdown. Size \"2xl\" at most once per surface, \"lg\" for sections. \"sm\" is an h4, \"md\"/\"lg\" an h3 (default \"md\"), \"xl\" and up an h2. Bold unless strong is false.",
7782
7784
  props: titleSchema
7783
7785
  },
7784
7786
  Text: {
7785
7787
  component: Text,
7786
- description: "Body text inside a Card or next to another component. A paragraph alone is markdown outside the fence. Use color \"default\" or \"secondary\". `text` can have inline markdown: **bold**, *italic*, ~~strike~~, ++underline++, `code` and [link](https://example.com). The `children` ids render inline after the text, for example a Badge.",
7788
+ description: "Body text in a Card or next to another component; a paragraph alone is markdown outside the fence. Color \"default\" or \"secondary\". `text` takes inline markdown (**bold**, *italic*, ~~strike~~, ++underline++, `code`, [link](url)). `children` ids render inline after it, e.g. a Badge.",
7787
7789
  props: textSchema,
7788
7790
  slots: CHILDREN_SLOT
7789
7791
  },
@@ -7854,7 +7856,7 @@ const textComponents = {
7854
7856
  },
7855
7857
  Tooltip: {
7856
7858
  component: Tooltip,
7857
- description: "Shows `content` when the user points at `trigger` or moves keyboard focus to it. `trigger` is one child id: a Text, Icon or Badge, not a Button or Link. `content` is one child id of short text, for example a Text. Do not put links or buttons in `content`.",
7859
+ description: "Shows `content` when the user points at or focuses `trigger`. `trigger`: one child id, a Text, Icon or Badge (not a Button or Link). `content`: one child id of short text, no links or buttons.",
7858
7860
  slots: {
7859
7861
  trigger: "single",
7860
7862
  content: "single"