@copilotkit/react-ui 0.20.0 → 0.21.0-mme-fix-esm-error.2

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 (78) hide show
  1. package/.turbo/turbo-build.log +124 -124
  2. package/CHANGELOG.md +48 -0
  3. package/dist/{chunk-EIB4TGCW.mjs → chunk-3SXQEFGW.mjs} +3 -3
  4. package/dist/{chunk-NFMERKCE.mjs → chunk-7JYUCW7H.mjs} +2 -2
  5. package/dist/{chunk-N37JEHLI.mjs → chunk-7LMXXGJT.mjs} +8 -4
  6. package/dist/chunk-7LMXXGJT.mjs.map +1 -0
  7. package/dist/{chunk-BPT5B4JN.mjs → chunk-7UK4MYTF.mjs} +4 -7
  8. package/dist/{chunk-BPT5B4JN.mjs.map → chunk-7UK4MYTF.mjs.map} +1 -1
  9. package/dist/{chunk-EAKWARPJ.mjs → chunk-BJ75DW3Z.mjs} +30 -26
  10. package/dist/{chunk-EAKWARPJ.mjs.map → chunk-BJ75DW3Z.mjs.map} +1 -1
  11. package/dist/{chunk-WBXU5YXF.mjs → chunk-KE3N45ZY.mjs} +2 -2
  12. package/dist/{chunk-2JGAK63B.mjs → chunk-OTE2PMAQ.mjs} +3 -3
  13. package/dist/chunk-OTE2PMAQ.mjs.map +1 -0
  14. package/dist/{chunk-Q3WQ546F.mjs → chunk-PGPR52GM.mjs} +16 -3
  15. package/dist/chunk-PGPR52GM.mjs.map +1 -0
  16. package/dist/chunk-UGQQ4WEQ.mjs +1 -0
  17. package/dist/{chunk-OAIXDKPE.mjs → chunk-YEHO5VMA.mjs} +2 -2
  18. package/dist/{chunk-EZ3QSEI2.mjs → chunk-YTIGBBTC.mjs} +2 -2
  19. package/dist/components/chat/Button.js.map +1 -1
  20. package/dist/components/chat/Button.mjs +2 -2
  21. package/dist/components/chat/Chat.d.ts +5 -1
  22. package/dist/components/chat/Chat.js +45 -24
  23. package/dist/components/chat/Chat.js.map +1 -1
  24. package/dist/components/chat/Chat.mjs +8 -8
  25. package/dist/components/chat/ChatContext.d.ts +5 -1
  26. package/dist/components/chat/ChatContext.js +7 -3
  27. package/dist/components/chat/ChatContext.js.map +1 -1
  28. package/dist/components/chat/ChatContext.mjs +1 -1
  29. package/dist/components/chat/Header.js.map +1 -1
  30. package/dist/components/chat/Header.mjs +2 -2
  31. package/dist/components/chat/Input.js.map +1 -1
  32. package/dist/components/chat/Input.mjs +2 -2
  33. package/dist/components/chat/Markdown.js +15 -2
  34. package/dist/components/chat/Markdown.js.map +1 -1
  35. package/dist/components/chat/Markdown.mjs +1 -1
  36. package/dist/components/chat/Messages.js +15 -2
  37. package/dist/components/chat/Messages.js.map +1 -1
  38. package/dist/components/chat/Messages.mjs +3 -3
  39. package/dist/components/chat/Popup.js +46 -25
  40. package/dist/components/chat/Popup.js.map +1 -1
  41. package/dist/components/chat/Popup.mjs +9 -9
  42. package/dist/components/chat/Response.js.map +1 -1
  43. package/dist/components/chat/Response.mjs +2 -2
  44. package/dist/components/chat/Sidebar.js +46 -28
  45. package/dist/components/chat/Sidebar.js.map +1 -1
  46. package/dist/components/chat/Sidebar.mjs +9 -9
  47. package/dist/components/chat/index.d.ts +1 -1
  48. package/dist/components/chat/index.js +51 -31
  49. package/dist/components/chat/index.js.map +1 -1
  50. package/dist/components/chat/index.mjs +15 -12
  51. package/dist/components/index.d.ts +1 -1
  52. package/dist/components/index.js +51 -31
  53. package/dist/components/index.js.map +1 -1
  54. package/dist/components/index.mjs +15 -12
  55. package/dist/index.css +4 -0
  56. package/dist/index.css.map +1 -1
  57. package/dist/index.d.ts +1 -1
  58. package/dist/index.js +51 -31
  59. package/dist/index.js.map +1 -1
  60. package/dist/index.mjs +15 -12
  61. package/package.json +7 -7
  62. package/src/components/chat/Chat.tsx +8 -1
  63. package/src/components/chat/ChatContext.tsx +9 -1
  64. package/src/components/chat/Markdown.tsx +12 -0
  65. package/src/components/chat/Popup.tsx +5 -1
  66. package/src/components/chat/Sidebar.tsx +3 -2
  67. package/src/components/chat/index.tsx +1 -0
  68. package/src/css/messages.css +1 -0
  69. package/dist/chunk-2JGAK63B.mjs.map +0 -1
  70. package/dist/chunk-N37JEHLI.mjs.map +0 -1
  71. package/dist/chunk-P4GBO6MW.mjs +0 -1
  72. package/dist/chunk-Q3WQ546F.mjs.map +0 -1
  73. /package/dist/{chunk-EIB4TGCW.mjs.map → chunk-3SXQEFGW.mjs.map} +0 -0
  74. /package/dist/{chunk-NFMERKCE.mjs.map → chunk-7JYUCW7H.mjs.map} +0 -0
  75. /package/dist/{chunk-WBXU5YXF.mjs.map → chunk-KE3N45ZY.mjs.map} +0 -0
  76. /package/dist/{chunk-P4GBO6MW.mjs.map → chunk-UGQQ4WEQ.mjs.map} +0 -0
  77. /package/dist/{chunk-OAIXDKPE.mjs.map → chunk-YEHO5VMA.mjs.map} +0 -0
  78. /package/dist/{chunk-EZ3QSEI2.mjs.map → chunk-YTIGBBTC.mjs.map} +0 -0
@@ -21,8 +21,9 @@ export const CopilotSidebar = (props: CopilotSidebarProps) => {
21
21
 
22
22
  return (
23
23
  <div className={`copilotKitSidebarContentWrapper ${expandedClassName}`}>
24
- {props.children}
25
- <CopilotChat {...props} {...{ onSetOpen }} />
24
+ <CopilotChat {...props} {...{ onSetOpen }}>
25
+ {props.children}
26
+ </CopilotChat>
26
27
  </div>
27
28
  );
28
29
  };
@@ -1,3 +1,4 @@
1
1
  export * from "./props";
2
2
  export { CopilotPopup } from "./Popup";
3
3
  export { CopilotSidebar } from "./Sidebar";
4
+ export { useChatContext } from "./ChatContext";
@@ -40,6 +40,7 @@
40
40
  background: var(--copilot-kit-message-user-background-color);
41
41
  color: var(--copilot-kit-message-user-color);
42
42
  margin-left: auto;
43
+ white-space: pre-wrap;
43
44
  }
44
45
 
45
46
  .copilotKitMessage.copilotKitAssistantMessage {
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/chat/Popup.tsx"],"sourcesContent":["import { CopilotChat, CopilotChatProps } from \"./Chat\";\n\nexport const CopilotPopup = (props: CopilotChatProps) => {\n props = {\n ...props,\n className: props.className ? props.className + \" copilotKitPopup\" : \"copilotKitPopup\",\n };\n return <CopilotChat {...props} />;\n};\n"],"mappings":";;;;;;;;;AAOS;AALF,IAAM,eAAe,CAAC,UAA4B;AACvD,UAAQ,iCACH,QADG;AAAA,IAEN,WAAW,MAAM,YAAY,MAAM,YAAY,qBAAqB;AAAA,EACtE;AACA,SAAO,oBAAC,gCAAgB,MAAO;AACjC;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/chat/ChatContext.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport * as DefaultIcons from \"./Icons\";\n\n/**\n * Icons for CopilotChat component.\n */\nexport interface CopilotChatIcons {\n /**\n * The icon to use for the open chat button.\n * @default <OpenIcon />\n */\n openIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button.\n * @default <CloseIcon />\n */\n closeIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button in the header.\n * @default <HeaderCloseIcon />\n */\n headerCloseIcon?: React.ReactNode;\n\n /**\n * The icon to use for the send button.\n * @default <SendIcon />\n */\n sendIcon?: React.ReactNode;\n\n /**\n * The icon to use for the activity indicator.\n * @default <ActivityIcon />\n */\n activityIcon?: React.ReactNode;\n\n /**\n * The icon to use for the spinner.\n * @default <SpinnerIcon />\n */\n spinnerIcon?: React.ReactNode;\n\n /**\n * The icon to use for the stop button.\n * @default <StopIcon />\n */\n stopIcon?: React.ReactNode;\n\n /**\n * The icon to use for the regenerate button.\n * @default <RegenerateIcon />\n */\n regenerateIcon?: React.ReactNode;\n}\n\n/**\n * Labels for CopilotChat component.\n */\nexport interface CopilotChatLabels {\n /**\n * The initial message(s) to display in the chat window.\n */\n initial?: string | string[];\n\n /**\n * The title to display in the header.\n * @default \"CopilotKit\"\n */\n title?: string;\n\n /**\n * The placeholder to display in the input.\n * @default \"Type a message...\"\n */\n placeholder?: string;\n\n /**\n * The message to display while the chat GPT is \"thinking\".\n * @default \"Thinking...\"\n */\n thinking?: string;\n\n /**\n * The message to display when an error occurs.\n * @default \"❌ An error occurred. Please try again.\"\n */\n error?: string;\n\n /**\n * The label to display on the stop button.\n * @default \"Stop generating\"\n */\n stopGenerating?: string;\n\n /**\n * The label to display on the regenerate button.\n * @default \"Regenerate response\"\n */\n regenerateResponse?: string;\n}\n\ninterface ChatContext {\n labels: Required<CopilotChatLabels>;\n icons: Required<CopilotChatIcons>;\n}\n\nexport const ChatContext = React.createContext<ChatContext | undefined>(undefined);\n\nexport function useChatContext(): ChatContext {\n const context = React.useContext(ChatContext);\n if (context === undefined) {\n throw new Error(\n \"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?\",\n );\n }\n return context;\n}\n\ninterface ChatContextProps {\n // temperature?: number;\n // instructions?: string;\n // maxFeedback?: number;\n labels?: CopilotChatLabels;\n icons?: CopilotChatIcons;\n children?: React.ReactNode;\n}\n\nexport const ChatContextProvider = ({\n // temperature,\n // instructions,\n // maxFeedback,\n labels,\n icons,\n children,\n}: ChatContextProps) => {\n const context = useMemo(\n () => ({\n labels: {\n ...{\n initial: \"\",\n title: \"CopilotKit\",\n placeholder: \"Type a message...\",\n thinking: \"Thinking...\",\n error: \"❌ An error occurred. Please try again.\",\n stopGenerating: \"Stop generating\",\n regenerateResponse: \"Regenerate response\",\n },\n ...labels,\n },\n\n icons: {\n ...{\n openIcon: DefaultIcons.OpenIcon,\n closeIcon: DefaultIcons.CloseIcon,\n headerCloseIcon: DefaultIcons.HeaderCloseIcon,\n sendIcon: DefaultIcons.SendIcon,\n activityIcon: DefaultIcons.ActivityIcon,\n spinnerIcon: DefaultIcons.SpinnerIcon,\n stopIcon: DefaultIcons.StopIcon,\n regenerateIcon: DefaultIcons.RegenerateIcon,\n },\n icons,\n },\n }),\n [labels, icons],\n );\n return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAO,SAAS,eAAe;AAuKtB;AA5DF,IAAM,cAAc,MAAM,cAAuC,MAAS;AAE1E,SAAS,iBAA8B;AAC5C,QAAM,UAAU,MAAM,WAAW,WAAW;AAC5C,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAWO,IAAM,sBAAsB,CAAC;AAAA;AAAA;AAAA;AAAA,EAIlC;AAAA,EACA;AAAA,EACA;AACF,MAAwB;AACtB,QAAM,UAAU;AAAA,IACd,OAAO;AAAA,MACL,QAAQ,kCACH;AAAA,QACD,SAAS;AAAA,QACT,OAAO;AAAA,QACP,aAAa;AAAA,QACb,UAAU;AAAA,QACV,OAAO;AAAA,QACP,gBAAgB;AAAA,QAChB,oBAAoB;AAAA,MACtB,IACG;AAAA,MAGL,OAAO,iCACF;AAAA,QACD,UAAuB;AAAA,QACvB,WAAwB;AAAA,QACxB,iBAA8B;AAAA,QAC9B,UAAuB;AAAA,QACvB,cAA2B;AAAA,QAC3B,aAA0B;AAAA,QAC1B,UAAuB;AAAA,QACvB,gBAA6B;AAAA,MAC/B,IAVK;AAAA,QAWL;AAAA,MACF;AAAA,IACF;AAAA,IACA,CAAC,QAAQ,KAAK;AAAA,EAChB;AACA,SAAO,oBAAC,YAAY,UAAZ,EAAqB,OAAO,SAAU,UAAS;AACzD;","names":[]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-P4GBO6MW.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/chat/Markdown.tsx"],"sourcesContent":["import { FC, memo } from \"react\";\nimport ReactMarkdown, { Options, Components } from \"react-markdown\";\nimport { CodeBlock } from \"./CodeBlock\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkMath from \"remark-math\";\n\nconst MemoizedReactMarkdown: FC<Options> = memo(\n ReactMarkdown,\n (prevProps, nextProps) =>\n prevProps.children === nextProps.children && prevProps.className === nextProps.className,\n);\n\ntype MarkdownProps = {\n content: string;\n};\n\nexport const Markdown = ({ content }: MarkdownProps) => {\n return (\n <div className=\"copilotKitMarkdown\">\n <MemoizedReactMarkdown components={components} remarkPlugins={[remarkGfm, remarkMath]}>\n {content}\n </MemoizedReactMarkdown>\n </div>\n );\n};\n\nconst components: Components = {\n p({ children }) {\n return <p>{children}</p>;\n },\n code({ children, className, inline, ...props }) {\n if (children.length) {\n if (children[0] == \"▍\") {\n return (\n <span\n style={{\n animation: \"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite\",\n marginTop: \"0.25rem\",\n }}\n >\n ▍\n </span>\n );\n }\n\n children[0] = (children[0] as string).replace(\"`▍`\", \"▍\");\n }\n\n const match = /language-(\\w+)/.exec(className || \"\");\n\n if (inline) {\n return (\n <code className={className} {...props}>\n {children}\n </code>\n );\n }\n\n return (\n <CodeBlock\n key={Math.random()}\n language={(match && match[1]) || \"\"}\n value={String(children).replace(/\\n$/, \"\")}\n {...props}\n />\n );\n },\n};\n"],"mappings":";;;;;;;;;;AAAA,SAAa,YAAY;AACzB,OAAO,mBAA4C;AAEnD,OAAO,eAAe;AACtB,OAAO,gBAAgB;AAejB;AAbN,IAAM,wBAAqC;AAAA,EACzC;AAAA,EACA,CAAC,WAAW,cACV,UAAU,aAAa,UAAU,YAAY,UAAU,cAAc,UAAU;AACnF;AAMO,IAAM,WAAW,CAAC,EAAE,QAAQ,MAAqB;AACtD,SACE,oBAAC,SAAI,WAAU,sBACb,8BAAC,yBAAsB,YAAwB,eAAe,CAAC,WAAW,UAAU,GACjF,mBACH,GACF;AAEJ;AAEA,IAAM,aAAyB;AAAA,EAC7B,EAAE,EAAE,SAAS,GAAG;AACd,WAAO,oBAAC,OAAG,UAAS;AAAA,EACtB;AAAA,EACA,KAAK,IAA2C;AAA3C,iBAAE,YAAU,WAAW,OA9B9B,IA8BO,IAAkC,kBAAlC,IAAkC,CAAhC,YAAU,aAAW;AAC1B,QAAI,SAAS,QAAQ;AACnB,UAAI,SAAS,CAAC,KAAK,UAAK;AACtB,eACE;AAAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,cACL,WAAW;AAAA,cACX,WAAW;AAAA,YACb;AAAA,YACD;AAAA;AAAA,QAED;AAAA,MAEJ;AAEA,eAAS,CAAC,IAAK,SAAS,CAAC,EAAa,QAAQ,YAAO,QAAG;AAAA,IAC1D;AAEA,UAAM,QAAQ,iBAAiB,KAAK,aAAa,EAAE;AAEnD,QAAI,QAAQ;AACV,aACE,oBAAC,uCAAK,aAA0B,QAA/B,EACE,WACH;AAAA,IAEJ;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QAEC,UAAW,SAAS,MAAM,CAAC,KAAM;AAAA,QACjC,OAAO,OAAO,QAAQ,EAAE,QAAQ,OAAO,EAAE;AAAA,SACrC;AAAA,MAHC,KAAK,OAAO;AAAA,IAInB;AAAA,EAEJ;AACF;","names":[]}