@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.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as GenerativeUIFunctionInput, B as GenerativeUIInvokeResult, C as GenerativeUIComponentDefinition, D as GenerativeUIEventDefinition, E as GenerativeUIDefinitionsOf, F as SchemaInput, I as GenerativeUIError, L as GenerativeUIErrorCode, M as GenerativeUISlotKind, N as GenerativeUIStateOf, O as GenerativeUIFunctionArgs, P as createGenerativeUI, R as GenerativeUIErrorInfo, S as GenerativeUI, T as GenerativeUIComponentProps, _ as GenerativeUIThemeVariables, b as useGenerativeUIAccessibility, d as GenerativeUIMarkdownConfig, f as GenerativeUIToolConfig, g as GenerativeUIThemeVariable, h as GenerativeUIThemeValues, j as GenerativeUIFunctionName, k as GenerativeUIFunctionDefinition, l as GenerativeUIConfig, m as GenerativeUITheme, o as DefaultGenerativeUIChatCard, p as useGenerativeUIRuntime, s as GenerativeUIChatSurfaceProps, t as DefaultMarkdownRendererProps, u as GenerativeUIErrorBoundaryConfig, v as GenerativeUIAccessibility, w as GenerativeUIComponentName, x as CreateGenerativeUIConfig, y as GenerativeUIAriaAttributes, z as GenerativeUIEventHandler } from "./MarkdownRendererContext-
|
|
1
|
+
import { A as GenerativeUIFunctionInput, B as GenerativeUIInvokeResult, C as GenerativeUIComponentDefinition, D as GenerativeUIEventDefinition, E as GenerativeUIDefinitionsOf, F as SchemaInput, I as GenerativeUIError, L as GenerativeUIErrorCode, M as GenerativeUISlotKind, N as GenerativeUIStateOf, O as GenerativeUIFunctionArgs, P as createGenerativeUI, R as GenerativeUIErrorInfo, S as GenerativeUI, T as GenerativeUIComponentProps, _ as GenerativeUIThemeVariables, b as useGenerativeUIAccessibility, d as GenerativeUIMarkdownConfig, f as GenerativeUIToolConfig, g as GenerativeUIThemeVariable, h as GenerativeUIThemeValues, j as GenerativeUIFunctionName, k as GenerativeUIFunctionDefinition, l as GenerativeUIConfig, m as GenerativeUITheme, o as DefaultGenerativeUIChatCard, p as useGenerativeUIRuntime, s as GenerativeUIChatSurfaceProps, t as DefaultMarkdownRendererProps, u as GenerativeUIErrorBoundaryConfig, v as GenerativeUIAccessibility, w as GenerativeUIComponentName, x as CreateGenerativeUIConfig, y as GenerativeUIAriaAttributes, z as GenerativeUIEventHandler } from "./MarkdownRendererContext-DAuVISwv.cjs";
|
|
2
2
|
import * as react from "react";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
import { GenerativeUIJSONSchema } from "@copilotkit/shared";
|
|
@@ -2288,12 +2288,12 @@ declare const standardUI: GenerativeUI<{
|
|
|
2288
2288
|
size: zod.ZodOptional<zod.ZodEnum<["sm", "md", "lg", "xl"]>>;
|
|
2289
2289
|
pill: zod.ZodOptional<zod.ZodBoolean>;
|
|
2290
2290
|
}, "strip", zod.ZodTypeAny, {
|
|
2291
|
-
value?: string | undefined;
|
|
2292
2291
|
options?: (string | {
|
|
2293
2292
|
value: string;
|
|
2294
2293
|
label?: string | undefined;
|
|
2295
2294
|
description?: string | undefined;
|
|
2296
2295
|
})[] | undefined;
|
|
2296
|
+
value?: string | undefined;
|
|
2297
2297
|
size?: "sm" | "md" | "lg" | "xl" | undefined;
|
|
2298
2298
|
block?: boolean | undefined;
|
|
2299
2299
|
label?: string | undefined;
|
|
@@ -2316,12 +2316,12 @@ declare const standardUI: GenerativeUI<{
|
|
|
2316
2316
|
clearLabel?: string | undefined;
|
|
2317
2317
|
searchable?: boolean | undefined;
|
|
2318
2318
|
}, {
|
|
2319
|
-
value?: string | undefined;
|
|
2320
2319
|
options?: (string | {
|
|
2321
2320
|
value: string;
|
|
2322
2321
|
label?: string | undefined;
|
|
2323
2322
|
description?: string | undefined;
|
|
2324
2323
|
})[] | undefined;
|
|
2324
|
+
value?: string | undefined;
|
|
2325
2325
|
size?: "sm" | "md" | "lg" | "xl" | undefined;
|
|
2326
2326
|
block?: boolean | undefined;
|
|
2327
2327
|
label?: string | undefined;
|
|
@@ -2513,12 +2513,12 @@ declare const standardUI: GenerativeUI<{
|
|
|
2513
2513
|
disabled: zod.ZodOptional<zod.ZodBoolean>;
|
|
2514
2514
|
required: zod.ZodOptional<zod.ZodBoolean>;
|
|
2515
2515
|
}, "strip", zod.ZodTypeAny, {
|
|
2516
|
-
value?: string | undefined;
|
|
2517
2516
|
options?: (string | {
|
|
2518
2517
|
value: string;
|
|
2519
2518
|
label?: string | undefined;
|
|
2520
2519
|
description?: string | undefined;
|
|
2521
2520
|
})[] | undefined;
|
|
2521
|
+
value?: string | undefined;
|
|
2522
2522
|
direction?: "col" | "row" | undefined;
|
|
2523
2523
|
variant?: "list" | "pills" | "cards" | undefined;
|
|
2524
2524
|
label?: string | undefined;
|
|
@@ -2535,12 +2535,12 @@ declare const standardUI: GenerativeUI<{
|
|
|
2535
2535
|
name?: string | undefined;
|
|
2536
2536
|
required?: boolean | undefined;
|
|
2537
2537
|
}, {
|
|
2538
|
-
value?: string | undefined;
|
|
2539
2538
|
options?: (string | {
|
|
2540
2539
|
value: string;
|
|
2541
2540
|
label?: string | undefined;
|
|
2542
2541
|
description?: string | undefined;
|
|
2543
2542
|
})[] | undefined;
|
|
2543
|
+
value?: string | undefined;
|
|
2544
2544
|
direction?: "col" | "row" | undefined;
|
|
2545
2545
|
variant?: "list" | "pills" | "cards" | undefined;
|
|
2546
2546
|
label?: string | undefined;
|
|
@@ -2732,12 +2732,12 @@ declare const standardUI: GenerativeUI<{
|
|
|
2732
2732
|
variant: zod.ZodOptional<zod.ZodEnum<["solid", "soft", "outline", "ghost"]>>;
|
|
2733
2733
|
disabled: zod.ZodOptional<zod.ZodBoolean>;
|
|
2734
2734
|
}, "strip", zod.ZodTypeAny, {
|
|
2735
|
-
value?: string | undefined;
|
|
2736
2735
|
options?: (string | {
|
|
2737
2736
|
value: string;
|
|
2738
2737
|
label?: string | undefined;
|
|
2739
2738
|
description?: string | undefined;
|
|
2740
2739
|
})[] | undefined;
|
|
2740
|
+
value?: string | undefined;
|
|
2741
2741
|
variant?: "solid" | "outline" | "soft" | "ghost" | undefined;
|
|
2742
2742
|
size?: "sm" | "md" | "lg" | "xl" | undefined;
|
|
2743
2743
|
block?: boolean | undefined;
|
|
@@ -2754,12 +2754,12 @@ declare const standardUI: GenerativeUI<{
|
|
|
2754
2754
|
}[] | undefined;
|
|
2755
2755
|
disabled?: boolean | undefined;
|
|
2756
2756
|
}, {
|
|
2757
|
-
value?: string | undefined;
|
|
2758
2757
|
options?: (string | {
|
|
2759
2758
|
value: string;
|
|
2760
2759
|
label?: string | undefined;
|
|
2761
2760
|
description?: string | undefined;
|
|
2762
2761
|
})[] | undefined;
|
|
2762
|
+
value?: string | undefined;
|
|
2763
2763
|
variant?: "solid" | "outline" | "soft" | "ghost" | undefined;
|
|
2764
2764
|
size?: "sm" | "md" | "lg" | "xl" | undefined;
|
|
2765
2765
|
block?: boolean | undefined;
|
|
@@ -2839,12 +2839,12 @@ declare const standardUI: GenerativeUI<{
|
|
|
2839
2839
|
disabled: zod.ZodOptional<zod.ZodBoolean>;
|
|
2840
2840
|
required: zod.ZodOptional<zod.ZodBoolean>;
|
|
2841
2841
|
}, "strip", zod.ZodTypeAny, {
|
|
2842
|
-
value?: string[] | undefined;
|
|
2843
2842
|
options?: (string | {
|
|
2844
2843
|
value: string;
|
|
2845
2844
|
label?: string | undefined;
|
|
2846
2845
|
description?: string | undefined;
|
|
2847
2846
|
})[] | undefined;
|
|
2847
|
+
value?: string[] | undefined;
|
|
2848
2848
|
weight?: number | undefined;
|
|
2849
2849
|
variant?: "multipleSelection" | "mutuallyExclusive" | undefined;
|
|
2850
2850
|
label?: string | undefined;
|
|
@@ -2862,12 +2862,12 @@ declare const standardUI: GenerativeUI<{
|
|
|
2862
2862
|
displayStyle?: "checkbox" | "chips" | undefined;
|
|
2863
2863
|
filterable?: boolean | undefined;
|
|
2864
2864
|
}, {
|
|
2865
|
-
value?: string[] | undefined;
|
|
2866
2865
|
options?: (string | {
|
|
2867
2866
|
value: string;
|
|
2868
2867
|
label?: string | undefined;
|
|
2869
2868
|
description?: string | undefined;
|
|
2870
2869
|
})[] | undefined;
|
|
2870
|
+
value?: string[] | undefined;
|
|
2871
2871
|
weight?: number | undefined;
|
|
2872
2872
|
variant?: "multipleSelection" | "mutuallyExclusive" | undefined;
|
|
2873
2873
|
label?: string | undefined;
|
package/dist/generative-ui.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as GenerativeUIFunctionInput, B as GenerativeUIInvokeResult, C as GenerativeUIComponentDefinition, D as GenerativeUIEventDefinition, E as GenerativeUIDefinitionsOf, F as SchemaInput, I as GenerativeUIError, L as GenerativeUIErrorCode, M as GenerativeUISlotKind, N as GenerativeUIStateOf, O as GenerativeUIFunctionArgs, P as createGenerativeUI, R as GenerativeUIErrorInfo, S as GenerativeUI, T as GenerativeUIComponentProps, _ as GenerativeUIThemeVariables, b as useGenerativeUIAccessibility, d as GenerativeUIMarkdownConfig, f as GenerativeUIToolConfig, g as GenerativeUIThemeVariable, h as GenerativeUIThemeValues, j as GenerativeUIFunctionName, k as GenerativeUIFunctionDefinition, l as GenerativeUIConfig, m as GenerativeUITheme, o as DefaultGenerativeUIChatCard, p as useGenerativeUIRuntime, s as GenerativeUIChatSurfaceProps, t as DefaultMarkdownRendererProps, u as GenerativeUIErrorBoundaryConfig, v as GenerativeUIAccessibility, w as GenerativeUIComponentName, x as CreateGenerativeUIConfig, y as GenerativeUIAriaAttributes, z as GenerativeUIEventHandler } from "./MarkdownRendererContext-
|
|
1
|
+
import { A as GenerativeUIFunctionInput, B as GenerativeUIInvokeResult, C as GenerativeUIComponentDefinition, D as GenerativeUIEventDefinition, E as GenerativeUIDefinitionsOf, F as SchemaInput, I as GenerativeUIError, L as GenerativeUIErrorCode, M as GenerativeUISlotKind, N as GenerativeUIStateOf, O as GenerativeUIFunctionArgs, P as createGenerativeUI, R as GenerativeUIErrorInfo, S as GenerativeUI, T as GenerativeUIComponentProps, _ as GenerativeUIThemeVariables, b as useGenerativeUIAccessibility, d as GenerativeUIMarkdownConfig, f as GenerativeUIToolConfig, g as GenerativeUIThemeVariable, h as GenerativeUIThemeValues, j as GenerativeUIFunctionName, k as GenerativeUIFunctionDefinition, l as GenerativeUIConfig, m as GenerativeUITheme, o as DefaultGenerativeUIChatCard, p as useGenerativeUIRuntime, s as GenerativeUIChatSurfaceProps, t as DefaultMarkdownRendererProps, u as GenerativeUIErrorBoundaryConfig, v as GenerativeUIAccessibility, w as GenerativeUIComponentName, x as CreateGenerativeUIConfig, y as GenerativeUIAriaAttributes, z as GenerativeUIEventHandler } from "./MarkdownRendererContext-XWC2OXD5.mjs";
|
|
2
2
|
import * as react from "react";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
@@ -2288,12 +2288,12 @@ declare const standardUI: GenerativeUI<{
|
|
|
2288
2288
|
size: zod.ZodOptional<zod.ZodEnum<["sm", "md", "lg", "xl"]>>;
|
|
2289
2289
|
pill: zod.ZodOptional<zod.ZodBoolean>;
|
|
2290
2290
|
}, "strip", zod.ZodTypeAny, {
|
|
2291
|
-
value?: string | undefined;
|
|
2292
2291
|
options?: (string | {
|
|
2293
2292
|
value: string;
|
|
2294
2293
|
label?: string | undefined;
|
|
2295
2294
|
description?: string | undefined;
|
|
2296
2295
|
})[] | undefined;
|
|
2296
|
+
value?: string | undefined;
|
|
2297
2297
|
size?: "sm" | "md" | "lg" | "xl" | undefined;
|
|
2298
2298
|
block?: boolean | undefined;
|
|
2299
2299
|
label?: string | undefined;
|
|
@@ -2316,12 +2316,12 @@ declare const standardUI: GenerativeUI<{
|
|
|
2316
2316
|
clearLabel?: string | undefined;
|
|
2317
2317
|
searchable?: boolean | undefined;
|
|
2318
2318
|
}, {
|
|
2319
|
-
value?: string | undefined;
|
|
2320
2319
|
options?: (string | {
|
|
2321
2320
|
value: string;
|
|
2322
2321
|
label?: string | undefined;
|
|
2323
2322
|
description?: string | undefined;
|
|
2324
2323
|
})[] | undefined;
|
|
2324
|
+
value?: string | undefined;
|
|
2325
2325
|
size?: "sm" | "md" | "lg" | "xl" | undefined;
|
|
2326
2326
|
block?: boolean | undefined;
|
|
2327
2327
|
label?: string | undefined;
|
|
@@ -2513,12 +2513,12 @@ declare const standardUI: GenerativeUI<{
|
|
|
2513
2513
|
disabled: zod.ZodOptional<zod.ZodBoolean>;
|
|
2514
2514
|
required: zod.ZodOptional<zod.ZodBoolean>;
|
|
2515
2515
|
}, "strip", zod.ZodTypeAny, {
|
|
2516
|
-
value?: string | undefined;
|
|
2517
2516
|
options?: (string | {
|
|
2518
2517
|
value: string;
|
|
2519
2518
|
label?: string | undefined;
|
|
2520
2519
|
description?: string | undefined;
|
|
2521
2520
|
})[] | undefined;
|
|
2521
|
+
value?: string | undefined;
|
|
2522
2522
|
direction?: "col" | "row" | undefined;
|
|
2523
2523
|
variant?: "list" | "pills" | "cards" | undefined;
|
|
2524
2524
|
label?: string | undefined;
|
|
@@ -2535,12 +2535,12 @@ declare const standardUI: GenerativeUI<{
|
|
|
2535
2535
|
name?: string | undefined;
|
|
2536
2536
|
required?: boolean | undefined;
|
|
2537
2537
|
}, {
|
|
2538
|
-
value?: string | undefined;
|
|
2539
2538
|
options?: (string | {
|
|
2540
2539
|
value: string;
|
|
2541
2540
|
label?: string | undefined;
|
|
2542
2541
|
description?: string | undefined;
|
|
2543
2542
|
})[] | undefined;
|
|
2543
|
+
value?: string | undefined;
|
|
2544
2544
|
direction?: "col" | "row" | undefined;
|
|
2545
2545
|
variant?: "list" | "pills" | "cards" | undefined;
|
|
2546
2546
|
label?: string | undefined;
|
|
@@ -2732,12 +2732,12 @@ declare const standardUI: GenerativeUI<{
|
|
|
2732
2732
|
variant: zod.ZodOptional<zod.ZodEnum<["solid", "soft", "outline", "ghost"]>>;
|
|
2733
2733
|
disabled: zod.ZodOptional<zod.ZodBoolean>;
|
|
2734
2734
|
}, "strip", zod.ZodTypeAny, {
|
|
2735
|
-
value?: string | undefined;
|
|
2736
2735
|
options?: (string | {
|
|
2737
2736
|
value: string;
|
|
2738
2737
|
label?: string | undefined;
|
|
2739
2738
|
description?: string | undefined;
|
|
2740
2739
|
})[] | undefined;
|
|
2740
|
+
value?: string | undefined;
|
|
2741
2741
|
variant?: "solid" | "outline" | "soft" | "ghost" | undefined;
|
|
2742
2742
|
size?: "sm" | "md" | "lg" | "xl" | undefined;
|
|
2743
2743
|
block?: boolean | undefined;
|
|
@@ -2754,12 +2754,12 @@ declare const standardUI: GenerativeUI<{
|
|
|
2754
2754
|
}[] | undefined;
|
|
2755
2755
|
disabled?: boolean | undefined;
|
|
2756
2756
|
}, {
|
|
2757
|
-
value?: string | undefined;
|
|
2758
2757
|
options?: (string | {
|
|
2759
2758
|
value: string;
|
|
2760
2759
|
label?: string | undefined;
|
|
2761
2760
|
description?: string | undefined;
|
|
2762
2761
|
})[] | undefined;
|
|
2762
|
+
value?: string | undefined;
|
|
2763
2763
|
variant?: "solid" | "outline" | "soft" | "ghost" | undefined;
|
|
2764
2764
|
size?: "sm" | "md" | "lg" | "xl" | undefined;
|
|
2765
2765
|
block?: boolean | undefined;
|
|
@@ -2839,12 +2839,12 @@ declare const standardUI: GenerativeUI<{
|
|
|
2839
2839
|
disabled: zod.ZodOptional<zod.ZodBoolean>;
|
|
2840
2840
|
required: zod.ZodOptional<zod.ZodBoolean>;
|
|
2841
2841
|
}, "strip", zod.ZodTypeAny, {
|
|
2842
|
-
value?: string[] | undefined;
|
|
2843
2842
|
options?: (string | {
|
|
2844
2843
|
value: string;
|
|
2845
2844
|
label?: string | undefined;
|
|
2846
2845
|
description?: string | undefined;
|
|
2847
2846
|
})[] | undefined;
|
|
2847
|
+
value?: string[] | undefined;
|
|
2848
2848
|
weight?: number | undefined;
|
|
2849
2849
|
variant?: "multipleSelection" | "mutuallyExclusive" | undefined;
|
|
2850
2850
|
label?: string | undefined;
|
|
@@ -2862,12 +2862,12 @@ declare const standardUI: GenerativeUI<{
|
|
|
2862
2862
|
displayStyle?: "checkbox" | "chips" | undefined;
|
|
2863
2863
|
filterable?: boolean | undefined;
|
|
2864
2864
|
}, {
|
|
2865
|
-
value?: string[] | undefined;
|
|
2866
2865
|
options?: (string | {
|
|
2867
2866
|
value: string;
|
|
2868
2867
|
label?: string | undefined;
|
|
2869
2868
|
description?: string | undefined;
|
|
2870
2869
|
})[] | undefined;
|
|
2870
|
+
value?: string[] | undefined;
|
|
2871
2871
|
weight?: number | undefined;
|
|
2872
2872
|
variant?: "multipleSelection" | "mutuallyExclusive" | undefined;
|
|
2873
2873
|
label?: string | undefined;
|
package/dist/generative-ui.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
3
|
+
import { A as GenerativeUIError, F as toJsonSchema, K as IconSvg, 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-BXaxgpm_.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";
|
|
@@ -2290,10 +2290,14 @@ const ICON_STROKE = {
|
|
|
2290
2290
|
function kebabToPascal(name) {
|
|
2291
2291
|
return name.split(/[-_\s]+/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
2292
2292
|
}
|
|
2293
|
+
/** "ArrowRight" gives "arrow-right", as Lucide names its icon classes. */
|
|
2294
|
+
function pascalToKebab(name) {
|
|
2295
|
+
return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
2296
|
+
}
|
|
2293
2297
|
let lucidePromise = null;
|
|
2294
2298
|
let lucideIcons = null;
|
|
2295
2299
|
function loadLucideIcons() {
|
|
2296
|
-
lucidePromise ??= import("lucide
|
|
2300
|
+
lucidePromise ??= import("lucide").then((module) => {
|
|
2297
2301
|
const icons = module.icons;
|
|
2298
2302
|
lucideIcons = icons;
|
|
2299
2303
|
return icons;
|
|
@@ -2301,9 +2305,9 @@ function loadLucideIcons() {
|
|
|
2301
2305
|
return lucidePromise;
|
|
2302
2306
|
}
|
|
2303
2307
|
/**
|
|
2304
|
-
*
|
|
2305
|
-
*
|
|
2306
|
-
*
|
|
2308
|
+
* Lucide has about 1,500 icons. A static import of its `icons` map puts all
|
|
2309
|
+
* of them in every bundle and makes module load slow. So the map loads once,
|
|
2310
|
+
* on first use, and the icons show when it is there.
|
|
2307
2311
|
*/
|
|
2308
2312
|
function useLucideIcons() {
|
|
2309
2313
|
const [icons, setIcons] = useState(lucideIcons);
|
|
@@ -2319,6 +2323,20 @@ function useLucideIcons() {
|
|
|
2319
2323
|
}, []);
|
|
2320
2324
|
return icons;
|
|
2321
2325
|
}
|
|
2326
|
+
/** The icon for a kebab-case or PascalCase name, or `null` when there is none. */
|
|
2327
|
+
function findLucideIcon(icons, name) {
|
|
2328
|
+
const pascalName = kebabToPascal(name);
|
|
2329
|
+
const key = pascalName in icons ? pascalName : name in icons ? name : null;
|
|
2330
|
+
if (key === null) return null;
|
|
2331
|
+
const nodes = icons[key].map(([tag, attributes]) => ({
|
|
2332
|
+
tag,
|
|
2333
|
+
attributes
|
|
2334
|
+
}));
|
|
2335
|
+
return {
|
|
2336
|
+
lucideName: pascalToKebab(key),
|
|
2337
|
+
nodes
|
|
2338
|
+
};
|
|
2339
|
+
}
|
|
2322
2340
|
/**
|
|
2323
2341
|
* A lucide icon by kebab-case (or PascalCase) name. An unknown name renders
|
|
2324
2342
|
* nothing. Without a `label`, the icon is hidden from screen readers.
|
|
@@ -2331,18 +2349,20 @@ function useLucideIcons() {
|
|
|
2331
2349
|
function LucideIcon({ name, label, description, size = "md", color, weight, inline, style }) {
|
|
2332
2350
|
const icons = useLucideIcons();
|
|
2333
2351
|
if (!name || !icons) return null;
|
|
2334
|
-
const
|
|
2335
|
-
if (!
|
|
2352
|
+
const icon = findLucideIcon(icons, name);
|
|
2353
|
+
if (!icon) return null;
|
|
2336
2354
|
const pixels = typeof size === "number" ? size : inline ? "1em" : ICON_PX$1[size];
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2355
|
+
const a11y = label === void 0 ? { "aria-hidden": true } : {
|
|
2356
|
+
role: "img",
|
|
2357
|
+
"aria-label": label,
|
|
2358
|
+
"aria-description": description
|
|
2359
|
+
};
|
|
2360
|
+
return /* @__PURE__ */ jsx(IconSvg, {
|
|
2361
|
+
lucideName: icon.lucideName,
|
|
2362
|
+
nodes: icon.nodes,
|
|
2363
|
+
...a11y,
|
|
2343
2364
|
focusable: "false",
|
|
2344
|
-
|
|
2345
|
-
height: pixels,
|
|
2365
|
+
size: pixels,
|
|
2346
2366
|
color: textColor(color) ?? "currentColor",
|
|
2347
2367
|
strokeWidth: weight ? ICON_STROKE[weight] : void 0,
|
|
2348
2368
|
style: {
|