@copilotkit/react-core 1.63.2 → 1.63.3-canary.rc-1

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.
@@ -52,7 +52,7 @@ let _copilotkit_web_components_threads_drawer = require("@copilotkit/web-compone
52
52
  let react_markdown = require("react-markdown");
53
53
  react_markdown = __toESM(react_markdown);
54
54
 
55
- //#region src/v2/lib/slots.tsx
55
+ //#region src/v2/lib/shallow-stable-ref.ts
56
56
  /**
57
57
  * Shallow equality comparison for objects.
58
58
  */
@@ -92,64 +92,6 @@ function useShallowStableRef(value) {
92
92
  ref.current = value;
93
93
  return ref.current;
94
94
  }
95
- /**
96
- * Check if a value is a React component type (function, class, forwardRef, memo, etc.)
97
- */
98
- function isReactComponentType(value) {
99
- if (typeof value === "function") return true;
100
- if (value && typeof value === "object" && "$$typeof" in value && !react.default.isValidElement(value)) return true;
101
- return false;
102
- }
103
- /**
104
- * Internal function to render a slot value as a React element (non-memoized).
105
- */
106
- function renderSlotElement(slot, DefaultComponent, props) {
107
- if (typeof slot === "string") {
108
- const existingClassName = props.className;
109
- return react.default.createElement(DefaultComponent, {
110
- ...props,
111
- className: (0, tailwind_merge.twMerge)(existingClassName, slot)
112
- });
113
- }
114
- if (isReactComponentType(slot)) return react.default.createElement(slot, props);
115
- if (slot && typeof slot === "object" && !react.default.isValidElement(slot)) return react.default.createElement(DefaultComponent, {
116
- ...props,
117
- ...slot
118
- });
119
- return react.default.createElement(DefaultComponent, props);
120
- }
121
- /**
122
- * Internal memoized wrapper component for renderSlot.
123
- * Uses forwardRef to support ref forwarding.
124
- */
125
- const MemoizedSlotWrapper = react.default.memo(react.default.forwardRef(function MemoizedSlotWrapper(props, ref) {
126
- const { $slot, $component, ...rest } = props;
127
- return renderSlotElement($slot, $component, ref !== null ? {
128
- ...rest,
129
- ref
130
- } : rest);
131
- }), (prev, next) => {
132
- if (prev.$slot !== next.$slot) return false;
133
- if (prev.$component !== next.$component) return false;
134
- const { $slot: _ps, $component: _pc, ...prevRest } = prev;
135
- const { $slot: _ns, $component: _nc, ...nextRest } = next;
136
- return shallowEqual(prevRest, nextRest);
137
- });
138
- /**
139
- * Renders a slot value as a memoized React element.
140
- * Automatically prevents unnecessary re-renders using shallow prop comparison.
141
- * Supports ref forwarding.
142
- *
143
- * @example
144
- * renderSlot(customInput, CopilotChatInput, { onSubmit: handleSubmit })
145
- */
146
- function renderSlot(slot, DefaultComponent, props) {
147
- return react.default.createElement(MemoizedSlotWrapper, {
148
- ...props,
149
- $slot: slot,
150
- $component: DefaultComponent
151
- });
152
- }
153
95
 
154
96
  //#endregion
155
97
  //#region src/v2/providers/CopilotChatConfigurationProvider.tsx
@@ -357,9 +299,9 @@ const useCopilotChatConfiguration = () => {
357
299
 
358
300
  //#endregion
359
301
  //#region src/v2/lib/utils.ts
360
- const twMerge$8 = (0, tailwind_merge.extendTailwindMerge)({ prefix: "cpk" });
302
+ const twMerge$9 = (0, tailwind_merge.extendTailwindMerge)({ prefix: "cpk" });
361
303
  function cn(...inputs) {
362
- return twMerge$8((0, clsx.clsx)(inputs));
304
+ return twMerge$9((0, clsx.clsx)(inputs));
363
305
  }
364
306
 
365
307
  //#endregion
@@ -453,12 +395,13 @@ function Tooltip({ ...props }) {
453
395
  ...props
454
396
  }) });
455
397
  }
456
- function TooltipTrigger({ ...props }) {
398
+ const TooltipTrigger = react.forwardRef(function TooltipTrigger({ ...props }, ref) {
457
399
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tooltip.Trigger, {
400
+ ref,
458
401
  "data-slot": "tooltip-trigger",
459
402
  ...props
460
403
  });
461
- }
404
+ });
462
405
  function TooltipContent({ className, sideOffset = 0, children, ...props }) {
463
406
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_tooltip.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_tooltip.Content, {
464
407
  "data-copilotkit": true,
@@ -478,12 +421,13 @@ function DropdownMenu({ ...props }) {
478
421
  ...props
479
422
  });
480
423
  }
481
- function DropdownMenuTrigger({ ...props }) {
424
+ const DropdownMenuTrigger = react.forwardRef(function DropdownMenuTrigger({ ...props }, ref) {
482
425
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Trigger, {
426
+ ref,
483
427
  "data-slot": "dropdown-menu-trigger",
484
428
  ...props
485
429
  });
486
- }
430
+ });
487
431
  function DropdownMenuContent({ className, sideOffset = 4, ...props }) {
488
432
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_dropdown_menu.Content, {
489
433
  "data-copilotkit": true,
@@ -732,6 +676,67 @@ const CopilotChatAudioRecorder = (0, react.forwardRef)((props, ref) => {
732
676
  });
733
677
  CopilotChatAudioRecorder.displayName = "CopilotChatAudioRecorder";
734
678
 
679
+ //#endregion
680
+ //#region src/v2/lib/slots.tsx
681
+ /**
682
+ * Check if a value is a React component type (function, class, forwardRef, memo, etc.)
683
+ */
684
+ function isReactComponentType(value) {
685
+ if (typeof value === "function") return true;
686
+ if (value && typeof value === "object" && "$$typeof" in value && !react.default.isValidElement(value)) return true;
687
+ return false;
688
+ }
689
+ /**
690
+ * Internal function to render a slot value as a React element (non-memoized).
691
+ */
692
+ function renderSlotElement(slot, DefaultComponent, props) {
693
+ if (typeof slot === "string") {
694
+ const existingClassName = props.className;
695
+ return react.default.createElement(DefaultComponent, {
696
+ ...props,
697
+ className: (0, tailwind_merge.twMerge)(existingClassName, slot)
698
+ });
699
+ }
700
+ if (isReactComponentType(slot)) return react.default.createElement(slot, props);
701
+ if (slot && typeof slot === "object" && !react.default.isValidElement(slot)) return react.default.createElement(DefaultComponent, {
702
+ ...props,
703
+ ...slot
704
+ });
705
+ return react.default.createElement(DefaultComponent, props);
706
+ }
707
+ /**
708
+ * Internal memoized wrapper component for renderSlot.
709
+ * Uses forwardRef to support ref forwarding.
710
+ */
711
+ const MemoizedSlotWrapper = react.default.memo(react.default.forwardRef(function MemoizedSlotWrapper(props, ref) {
712
+ const { $slot, $component, ...rest } = props;
713
+ return renderSlotElement($slot, $component, ref !== null ? {
714
+ ...rest,
715
+ ref
716
+ } : rest);
717
+ }), (prev, next) => {
718
+ if (prev.$slot !== next.$slot) return false;
719
+ if (prev.$component !== next.$component) return false;
720
+ const { $slot: _ps, $component: _pc, ...prevRest } = prev;
721
+ const { $slot: _ns, $component: _nc, ...nextRest } = next;
722
+ return shallowEqual(prevRest, nextRest);
723
+ });
724
+ /**
725
+ * Renders a slot value as a memoized React element.
726
+ * Automatically prevents unnecessary re-renders using shallow prop comparison.
727
+ * Supports ref forwarding.
728
+ *
729
+ * @example
730
+ * renderSlot(customInput, CopilotChatInput, { onSubmit: handleSubmit })
731
+ */
732
+ function renderSlot(slot, DefaultComponent, props) {
733
+ return react.default.createElement(MemoizedSlotWrapper, {
734
+ ...props,
735
+ $slot: slot,
736
+ $component: DefaultComponent
737
+ });
738
+ }
739
+
735
740
  //#endregion
736
741
  //#region src/v2/components/chat/CopilotChatInput.tsx
737
742
  const SLASH_MENU_MAX_VISIBLE_ITEMS = 5;
@@ -1085,7 +1090,6 @@ function CopilotChatInput({ mode = "input", onSubmitMessage, onStop, isRunning =
1085
1090
  }
1086
1091
  if (typeof window !== "undefined" && typeof window.matchMedia === "function") {
1087
1092
  if (window.matchMedia("(max-width: 767px)").matches) {
1088
- ensureMeasurements();
1089
1093
  adjustTextareaHeight();
1090
1094
  updateLayout("expanded");
1091
1095
  return;
@@ -12172,4 +12176,4 @@ Object.defineProperty(exports, 'ɵrunMcpFollowUp', {
12172
12176
  return ɵrunMcpFollowUp;
12173
12177
  }
12174
12178
  });
12175
- //# sourceMappingURL=copilotkit-DDVfoiRM.cjs.map
12179
+ //# sourceMappingURL=copilotkit-rYTwMndy.cjs.map