@liveblocks/react-ui 2.25.0-aiprivatebeta8 → 2.25.0-aiprivatebeta9
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/_private/index.cjs +10 -12
- package/dist/_private/index.cjs.map +1 -1
- package/dist/_private/index.d.cts +141 -112
- package/dist/_private/index.d.ts +141 -112
- package/dist/_private/index.js +8 -5
- package/dist/_private/index.js.map +1 -1
- package/dist/components/AiChat.cjs +74 -106
- package/dist/components/AiChat.cjs.map +1 -1
- package/dist/components/AiChat.js +75 -107
- package/dist/components/AiChat.js.map +1 -1
- package/dist/components/AiTool.cjs +164 -0
- package/dist/components/AiTool.cjs.map +1 -0
- package/dist/components/AiTool.js +162 -0
- package/dist/components/AiTool.js.map +1 -0
- package/dist/components/Comment.cjs +5 -3
- package/dist/components/Comment.cjs.map +1 -1
- package/dist/components/Comment.js +6 -4
- package/dist/components/Comment.js.map +1 -1
- package/dist/components/InboxNotificationList.cjs +11 -3
- package/dist/components/InboxNotificationList.cjs.map +1 -1
- package/dist/components/InboxNotificationList.js +12 -4
- package/dist/components/InboxNotificationList.js.map +1 -1
- package/dist/components/internal/AiChatAssistantMessage.cjs +43 -199
- package/dist/components/internal/AiChatAssistantMessage.cjs.map +1 -1
- package/dist/components/internal/AiChatAssistantMessage.js +44 -200
- package/dist/components/internal/AiChatAssistantMessage.js.map +1 -1
- package/dist/components/internal/AiChatComposer.cjs +1 -1
- package/dist/components/internal/AiChatComposer.cjs.map +1 -1
- package/dist/components/internal/AiChatComposer.js +1 -1
- package/dist/components/internal/AiChatComposer.js.map +1 -1
- package/dist/components/internal/AiChatUserMessage.cjs +17 -10
- package/dist/components/internal/AiChatUserMessage.cjs.map +1 -1
- package/dist/components/internal/AiChatUserMessage.js +17 -10
- package/dist/components/internal/AiChatUserMessage.js.map +1 -1
- package/dist/components/internal/Button.cjs.map +1 -1
- package/dist/components/internal/Button.js.map +1 -1
- package/dist/components/internal/CodeBlock.cjs +72 -0
- package/dist/components/internal/CodeBlock.cjs.map +1 -0
- package/dist/components/internal/CodeBlock.js +70 -0
- package/dist/components/internal/CodeBlock.js.map +1 -0
- package/dist/components/internal/Emoji.cjs +12 -4
- package/dist/components/internal/Emoji.cjs.map +1 -1
- package/dist/components/internal/Emoji.js +12 -4
- package/dist/components/internal/Emoji.js.map +1 -1
- package/dist/components/internal/Prose.cjs +37 -0
- package/dist/components/internal/Prose.cjs.map +1 -0
- package/dist/components/internal/Prose.js +35 -0
- package/dist/components/internal/Prose.js.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +50 -9
- package/dist/index.d.ts +50 -9
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/overrides.cjs +2 -4
- package/dist/overrides.cjs.map +1 -1
- package/dist/overrides.js +2 -4
- package/dist/overrides.js.map +1 -1
- package/dist/primitives/AiMessage/contexts.cjs +18 -0
- package/dist/primitives/AiMessage/contexts.cjs.map +1 -0
- package/dist/primitives/AiMessage/contexts.js +15 -0
- package/dist/primitives/AiMessage/contexts.js.map +1 -0
- package/dist/primitives/AiMessage/index.cjs +133 -0
- package/dist/primitives/AiMessage/index.cjs.map +1 -0
- package/dist/primitives/AiMessage/index.js +131 -0
- package/dist/primitives/AiMessage/index.js.map +1 -0
- package/dist/primitives/{internal/Collapsible → Collapsible}/index.cjs +39 -17
- package/dist/primitives/Collapsible/index.cjs.map +1 -0
- package/dist/primitives/{internal/Collapsible → Collapsible}/index.js +37 -15
- package/dist/primitives/Collapsible/index.js.map +1 -0
- package/dist/primitives/{internal/Markdown.cjs → Markdown.cjs} +99 -63
- package/dist/primitives/Markdown.cjs.map +1 -0
- package/dist/primitives/{internal/Markdown.js → Markdown.js} +100 -63
- package/dist/primitives/Markdown.js.map +1 -0
- package/dist/primitives/index.cjs +4 -6
- package/dist/primitives/index.cjs.map +1 -1
- package/dist/primitives/index.d.cts +2 -75
- package/dist/primitives/index.d.ts +2 -75
- package/dist/primitives/index.js +4 -6
- package/dist/primitives/index.js.map +1 -1
- package/dist/utils/ErrorBoundary.cjs +48 -0
- package/dist/utils/ErrorBoundary.cjs.map +1 -0
- package/dist/utils/ErrorBoundary.js +45 -0
- package/dist/utils/ErrorBoundary.js.map +1 -0
- package/dist/utils/use-visible.cjs +63 -45
- package/dist/utils/use-visible.cjs.map +1 -1
- package/dist/utils/use-visible.js +64 -46
- package/dist/utils/use-visible.js.map +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/src/styles/constants.css +1 -1
- package/src/styles/dark/index.css +7 -3
- package/src/styles/index.css +555 -253
- package/src/styles/utils.css +1 -1
- package/styles/dark/attributes.css +1 -1
- package/styles/dark/attributes.css.map +1 -1
- package/styles/dark/media-query.css +1 -1
- package/styles/dark/media-query.css.map +1 -1
- package/styles.css +1 -1
- package/styles.css.map +1 -1
- package/dist/components/AiToolDebugger.cjs +0 -74
- package/dist/components/AiToolDebugger.cjs.map +0 -1
- package/dist/components/AiToolDebugger.js +0 -72
- package/dist/components/AiToolDebugger.js.map +0 -1
- package/dist/primitives/internal/Collapsible/index.cjs.map +0 -1
- package/dist/primitives/internal/Collapsible/index.js.map +0 -1
- package/dist/primitives/internal/Emoji.cjs +0 -32
- package/dist/primitives/internal/Emoji.cjs.map +0 -1
- package/dist/primitives/internal/Emoji.js +0 -30
- package/dist/primitives/internal/Emoji.js.map +0 -1
- package/dist/primitives/internal/Markdown.cjs.map +0 -1
- package/dist/primitives/internal/Markdown.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AiChatUserMessage.js","sources":["../../../src/components/internal/AiChatUserMessage.tsx"],"sourcesContent":["import type { UiUserMessage } from \"@liveblocks/core\";\nimport type { ComponentProps } from \"react\";\nimport { forwardRef, memo } from \"react\";\n\nimport { type GlobalOverrides, useOverrides } from \"../../overrides\";\nimport { classNames } from \"../../utils/class-names\";\n\n/* -------------------------------------------------------------------------------------------------\n * AiChatUserMessage\n * -----------------------------------------------------------------------------------------------*/\nexport interface AiChatUserMessageProps extends ComponentProps<\"div\"> {\n /**\n * The message to display.\n */\n message: UiUserMessage;\n /**\n * Override the component's strings.\n */\n overrides?: Partial<GlobalOverrides>;\n}\n\nexport const AiChatUserMessage = memo(\n forwardRef<HTMLDivElement, AiChatUserMessageProps>(\n ({ message, className, overrides }, forwardedRef) => {\n const $ = useOverrides(overrides);\n
|
|
1
|
+
{"version":3,"file":"AiChatUserMessage.js","sources":["../../../src/components/internal/AiChatUserMessage.tsx"],"sourcesContent":["import type { AiTextPart, UiUserMessage } from \"@liveblocks/core\";\nimport type { ComponentProps } from \"react\";\nimport { forwardRef, memo } from \"react\";\n\nimport { AiMessage } from \"../../_private\";\nimport { type GlobalOverrides, useOverrides } from \"../../overrides\";\nimport { classNames } from \"../../utils/class-names\";\n\n/* -------------------------------------------------------------------------------------------------\n * AiChatUserMessage\n * -----------------------------------------------------------------------------------------------*/\nexport interface AiChatUserMessageProps extends ComponentProps<\"div\"> {\n /**\n * The message to display.\n */\n message: UiUserMessage;\n /**\n * Override the component's strings.\n */\n overrides?: Partial<GlobalOverrides>;\n}\n\ntype PlainTextPartProps = {\n part: AiTextPart;\n};\n\nfunction PlainTextPart({ part }: PlainTextPartProps) {\n return <p>{part.text}</p>;\n}\n\nexport const AiChatUserMessage = memo(\n forwardRef<HTMLDivElement, AiChatUserMessageProps>(\n ({ message, className, overrides }, forwardedRef) => {\n const $ = useOverrides(overrides);\n return (\n <div\n ref={forwardedRef}\n className={classNames(\n \"lb-ai-chat-message lb-ai-chat-user-message\",\n className\n )}\n >\n {message.deletedAt !== undefined ? (\n <div className=\"lb-ai-chat-message-deleted\">\n {$.AI_CHAT_MESSAGE_DELETED}\n </div>\n ) : (\n <div className=\"lb-ai-chat-message-content\">\n <AiMessage.Content\n message={message}\n components={{\n TextPart: PlainTextPart,\n }}\n className=\"lb-prose lb-ai-chat-message-text\"\n />\n </div>\n )}\n </div>\n );\n }\n )\n);\n"],"names":["AiMessage.Content"],"mappings":";;;;;;;AA0BA,SAAS,aAAA,CAAc,EAAE,IAAA,EAA4B,EAAA;AACnD,EAAA,uBAAQ,GAAA,CAAA,GAAA,EAAA;AAAA,IAAG,QAAK,EAAA,IAAA,CAAA,IAAA;AAAA,GAAK,CAAA,CAAA;AACvB,CAAA;AAEO,MAAM,iBAAoB,GAAA,IAAA;AAAA,EAC/B,UAAA;AAAA,IACE,CAAC,EAAE,OAAA,EAAS,SAAW,EAAA,SAAA,IAAa,YAAiB,KAAA;AACnD,MAAM,MAAA,CAAA,GAAI,aAAa,SAAS,CAAA,CAAA;AAChC,MAAA,uBACG,GAAA,CAAA,KAAA,EAAA;AAAA,QACC,GAAK,EAAA,YAAA;AAAA,QACL,SAAW,EAAA,UAAA;AAAA,UACT,4CAAA;AAAA,UACA,SAAA;AAAA,SACF;AAAA,QAEC,QAAA,EAAA,OAAA,CAAQ,SAAc,KAAA,KAAA,CAAA,mBACpB,GAAA,CAAA,KAAA,EAAA;AAAA,UAAI,SAAU,EAAA,4BAAA;AAAA,UACZ,QAAE,EAAA,CAAA,CAAA,uBAAA;AAAA,SACL,oBAEC,GAAA,CAAA,KAAA,EAAA;AAAA,UAAI,SAAU,EAAA,4BAAA;AAAA,UACb,QAAA,kBAAA,GAAA,CAACA,gBAAA,EAAA;AAAA,YACC,OAAA;AAAA,YACA,UAAY,EAAA;AAAA,cACV,QAAU,EAAA,aAAA;AAAA,aACZ;AAAA,YACA,SAAU,EAAA,kCAAA;AAAA,WACZ,CAAA;AAAA,SACF,CAAA;AAAA,OAEJ,CAAA,CAAA;AAAA,KAEJ;AAAA,GACF;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.cjs","sources":["../../../src/components/internal/Button.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { forwardRef } from \"react\";\n\nimport { ChevronDownIcon } from \"../../icons/ChevronDown\";\nimport { classNames } from \"../../utils/class-names\";\n\nexport interface ButtonProps extends ComponentProps<\"button\"> {\n variant
|
|
1
|
+
{"version":3,"file":"Button.cjs","sources":["../../../src/components/internal/Button.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { forwardRef } from \"react\";\n\nimport { ChevronDownIcon } from \"../../icons/ChevronDown\";\nimport { classNames } from \"../../utils/class-names\";\n\nexport interface ButtonProps extends ComponentProps<\"button\"> {\n variant?:\n | \"default\"\n | \"toolbar\"\n | \"outline\"\n | \"primary\"\n | \"secondary\"\n | \"destructive\";\n size?: \"default\" | \"large\";\n disableable?: boolean;\n icon?: ReactNode;\n}\n\nexport const CustomButton = forwardRef<\n HTMLButtonElement,\n Omit<ButtonProps, \"icon\">\n>(\n (\n {\n variant = \"default\",\n size = \"default\",\n disableable = true,\n className,\n children,\n ...props\n },\n forwardedRef\n ) => {\n return (\n <button\n type=\"button\"\n className={classNames(\n \"lb-button\",\n !disableable && \"lb-button:non-disableable\",\n className\n )}\n data-variant={variant}\n data-size={size}\n {...props}\n ref={forwardedRef}\n >\n {children}\n </button>\n );\n }\n);\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n ({ icon, children, ...props }, forwardedRef) => {\n return (\n <CustomButton {...props} ref={forwardedRef}>\n {icon ? <span className=\"lb-icon-container\">{icon}</span> : null}\n {children ? <span className=\"lb-button-label\">{children}</span> : null}\n </CustomButton>\n );\n }\n);\n\nexport const SelectButton = forwardRef<HTMLButtonElement, ButtonProps>(\n ({ icon, children, className, ...props }, forwardedRef) => {\n return (\n <CustomButton\n {...props}\n type=\"button\"\n className={classNames(\"lb-select-button\", className)}\n ref={forwardedRef}\n >\n {icon ? <span className=\"lb-icon-container\">{icon}</span> : null}\n {children ? <span className=\"lb-button-label\">{children}</span> : null}\n <span className=\"lb-select-button-chevron\">\n <ChevronDownIcon />\n </span>\n </CustomButton>\n );\n }\n);\n"],"names":[],"mappings":";;;;;;;;;AAqBO;AAAqB;AAKxB;AACY;AACH;AACO;AACd;AACA;AACG;AAIL;AACG;AACM;AACM;AACT;AACgB;AAChB;AACF;AACc;AACH;AACP;AACC;AAEJ;AACH;AAGN;AAEO;AAAe;AAElB;AACG;AAAiB;AAAY;AAC3B;AAAQ;AAAe;AAAqB;AAAe;AAC/C;AAAe;AAAmB;AAAmB;AAAA;AACpE;AAGN;AAEO;AAAqB;AAExB;AACG;AACK;AACC;AAC8C;AAC9C;AAEJ;AAAQ;AAAe;AAAqB;AAAe;AAC/C;AAAe;AAAmB;AAAmB;AACjE;AAAe;AACG;AACnB;AAAA;AACF;AAGN;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../src/components/internal/Button.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { forwardRef } from \"react\";\n\nimport { ChevronDownIcon } from \"../../icons/ChevronDown\";\nimport { classNames } from \"../../utils/class-names\";\n\nexport interface ButtonProps extends ComponentProps<\"button\"> {\n variant
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../src/components/internal/Button.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentProps, ReactNode } from \"react\";\nimport { forwardRef } from \"react\";\n\nimport { ChevronDownIcon } from \"../../icons/ChevronDown\";\nimport { classNames } from \"../../utils/class-names\";\n\nexport interface ButtonProps extends ComponentProps<\"button\"> {\n variant?:\n | \"default\"\n | \"toolbar\"\n | \"outline\"\n | \"primary\"\n | \"secondary\"\n | \"destructive\";\n size?: \"default\" | \"large\";\n disableable?: boolean;\n icon?: ReactNode;\n}\n\nexport const CustomButton = forwardRef<\n HTMLButtonElement,\n Omit<ButtonProps, \"icon\">\n>(\n (\n {\n variant = \"default\",\n size = \"default\",\n disableable = true,\n className,\n children,\n ...props\n },\n forwardedRef\n ) => {\n return (\n <button\n type=\"button\"\n className={classNames(\n \"lb-button\",\n !disableable && \"lb-button:non-disableable\",\n className\n )}\n data-variant={variant}\n data-size={size}\n {...props}\n ref={forwardedRef}\n >\n {children}\n </button>\n );\n }\n);\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n ({ icon, children, ...props }, forwardedRef) => {\n return (\n <CustomButton {...props} ref={forwardedRef}>\n {icon ? <span className=\"lb-icon-container\">{icon}</span> : null}\n {children ? <span className=\"lb-button-label\">{children}</span> : null}\n </CustomButton>\n );\n }\n);\n\nexport const SelectButton = forwardRef<HTMLButtonElement, ButtonProps>(\n ({ icon, children, className, ...props }, forwardedRef) => {\n return (\n <CustomButton\n {...props}\n type=\"button\"\n className={classNames(\"lb-select-button\", className)}\n ref={forwardedRef}\n >\n {icon ? <span className=\"lb-icon-container\">{icon}</span> : null}\n {children ? <span className=\"lb-button-label\">{children}</span> : null}\n <span className=\"lb-select-button-chevron\">\n <ChevronDownIcon />\n </span>\n </CustomButton>\n );\n }\n);\n"],"names":[],"mappings":";;;;;;;AAqBO;AAAqB;AAKxB;AACY;AACH;AACO;AACd;AACA;AACG;AAIL;AACG;AACM;AACM;AACT;AACgB;AAChB;AACF;AACc;AACH;AACP;AACC;AAEJ;AACH;AAGN;AAEO;AAAe;AAElB;AACG;AAAiB;AAAY;AAC3B;AAAQ;AAAe;AAAqB;AAAe;AAC/C;AAAe;AAAmB;AAAmB;AAAA;AACpE;AAGN;AAEO;AAAqB;AAExB;AACG;AACK;AACC;AAC8C;AAC9C;AAEJ;AAAQ;AAAe;AAAqB;AAAe;AAC/C;AAAe;AAAmB;AAAmB;AACjE;AAAe;AACG;AACnB;AAAA;AACF;AAGN;;"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
require('../../icons/index.cjs');
|
|
6
|
+
var Button = require('./Button.cjs');
|
|
7
|
+
var Tooltip = require('./Tooltip.cjs');
|
|
8
|
+
var TooltipPrimitive = require('@radix-ui/react-tooltip');
|
|
9
|
+
var Check = require('../../icons/Check.cjs');
|
|
10
|
+
var Copy = require('../../icons/Copy.cjs');
|
|
11
|
+
|
|
12
|
+
const COPY_DELAY = 1500;
|
|
13
|
+
function CodeBlock({ title, code }) {
|
|
14
|
+
const [isCopied, setCopied] = react.useState(false);
|
|
15
|
+
const timeoutRef = react.useRef(null);
|
|
16
|
+
react.useEffect(() => {
|
|
17
|
+
if (isCopied) {
|
|
18
|
+
timeoutRef.current = setTimeout(() => {
|
|
19
|
+
setCopied(false);
|
|
20
|
+
}, COPY_DELAY);
|
|
21
|
+
}
|
|
22
|
+
return () => {
|
|
23
|
+
if (timeoutRef.current) {
|
|
24
|
+
clearTimeout(timeoutRef.current);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}, [isCopied]);
|
|
28
|
+
const handleCopy = react.useCallback(() => {
|
|
29
|
+
try {
|
|
30
|
+
navigator.clipboard.writeText(code);
|
|
31
|
+
setCopied(true);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.error(error);
|
|
34
|
+
}
|
|
35
|
+
}, [code]);
|
|
36
|
+
return /* @__PURE__ */ jsxRuntime.jsx(TooltipPrimitive.TooltipProvider, {
|
|
37
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
38
|
+
className: "lb-code-block",
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", {
|
|
41
|
+
className: "lb-code-block-header",
|
|
42
|
+
children: [
|
|
43
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
44
|
+
className: "lb-code-block-title",
|
|
45
|
+
children: title
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
48
|
+
className: "lb-code-block-header-actions",
|
|
49
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Tooltip.Tooltip, {
|
|
50
|
+
content: isCopied ? null : "Copy",
|
|
51
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(Button.Button, {
|
|
52
|
+
className: "lb-code-block-header-action",
|
|
53
|
+
icon: isCopied ? /* @__PURE__ */ jsxRuntime.jsx(Check.CheckIcon, {}) : /* @__PURE__ */ jsxRuntime.jsx(Copy.CopyIcon, {}),
|
|
54
|
+
onClick: handleCopy
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
}),
|
|
60
|
+
/* @__PURE__ */ jsxRuntime.jsx("pre", {
|
|
61
|
+
className: "lb-code-block-content",
|
|
62
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("code", {
|
|
63
|
+
children: code
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
exports.CodeBlock = CodeBlock;
|
|
72
|
+
//# sourceMappingURL=CodeBlock.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeBlock.cjs","sources":["../../../src/components/internal/CodeBlock.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { CheckIcon, CopyIcon } from \"../../icons\";\nimport { Button } from \"./Button\";\nimport { Tooltip, TooltipProvider } from \"./Tooltip\";\n\nconst COPY_DELAY = 1500;\n\ninterface CodeBlockProps extends Omit<ComponentProps<\"div\">, \"title\"> {\n title: string;\n code: string;\n}\n\nexport function CodeBlock({ title, code }: CodeBlockProps) {\n const [isCopied, setCopied] = useState(false);\n const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n if (isCopied) {\n timeoutRef.current = setTimeout(() => {\n setCopied(false);\n }, COPY_DELAY);\n }\n\n return () => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n };\n }, [isCopied]);\n\n const handleCopy = useCallback(() => {\n try {\n navigator.clipboard.writeText(code);\n setCopied(true);\n } catch (error) {\n console.error(error);\n }\n }, [code]);\n\n return (\n <TooltipProvider>\n <div className=\"lb-code-block\">\n <div className=\"lb-code-block-header\">\n <span className=\"lb-code-block-title\">{title}</span>\n <div className=\"lb-code-block-header-actions\">\n <Tooltip content={isCopied ? null : \"Copy\"}>\n <Button\n className=\"lb-code-block-header-action\"\n icon={isCopied ? <CheckIcon /> : <CopyIcon />}\n onClick={handleCopy}\n />\n </Tooltip>\n </div>\n </div>\n <pre className=\"lb-code-block-content\">\n <code>{code}</code>\n </pre>\n </div>\n </TooltipProvider>\n );\n}\n"],"names":["useState","useRef","useEffect","useCallback","jsx","TooltipProvider","jsxs","Tooltip","Button","CheckIcon","CopyIcon"],"mappings":";;;;;;;;;;;AAOA,MAAM,UAAa,GAAA,IAAA,CAAA;AAOZ,SAAS,SAAU,CAAA,EAAE,KAAO,EAAA,IAAA,EAAwB,EAAA;AACzD,EAAA,MAAM,CAAC,QAAA,EAAU,SAAS,CAAA,GAAIA,eAAS,KAAK,CAAA,CAAA;AAC5C,EAAM,MAAA,UAAA,GAAaC,aAA6C,IAAI,CAAA,CAAA;AAEpE,EAAAC,eAAA,CAAU,MAAM;AACd,IAAA,IAAI,QAAU,EAAA;AACZ,MAAW,UAAA,CAAA,OAAA,GAAU,WAAW,MAAM;AACpC,QAAA,SAAA,CAAU,KAAK,CAAA,CAAA;AAAA,SACd,UAAU,CAAA,CAAA;AAAA,KACf;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,IAAI,WAAW,OAAS,EAAA;AACtB,QAAA,YAAA,CAAa,WAAW,OAAO,CAAA,CAAA;AAAA,OACjC;AAAA,KACF,CAAA;AAAA,GACF,EAAG,CAAC,QAAQ,CAAC,CAAA,CAAA;AAEb,EAAM,MAAA,UAAA,GAAaC,kBAAY,MAAM;AACnC,IAAI,IAAA;AACF,MAAU,SAAA,CAAA,SAAA,CAAU,UAAU,IAAI,CAAA,CAAA;AAClC,MAAA,SAAA,CAAU,IAAI,CAAA,CAAA;AAAA,aACP,KAAP,EAAA;AACA,MAAA,OAAA,CAAQ,MAAM,KAAK,CAAA,CAAA;AAAA,KACrB;AAAA,GACF,EAAG,CAAC,IAAI,CAAC,CAAA,CAAA;AAET,EAAA,uBACGC,cAAA,CAAAC,gCAAA,EAAA;AAAA,IACC,QAAC,kBAAAC,eAAA,CAAA,KAAA,EAAA;AAAA,MAAI,SAAU,EAAA,eAAA;AAAA,MACb,QAAA,EAAA;AAAA,wBAACA,eAAA,CAAA,KAAA,EAAA;AAAA,UAAI,SAAU,EAAA,sBAAA;AAAA,UACb,QAAA,EAAA;AAAA,4BAACF,cAAA,CAAA,MAAA,EAAA;AAAA,cAAK,SAAU,EAAA,qBAAA;AAAA,cAAuB,QAAA,EAAA,KAAA;AAAA,aAAM,CAAA;AAAA,4BAC5CA,cAAA,CAAA,KAAA,EAAA;AAAA,cAAI,SAAU,EAAA,8BAAA;AAAA,cACb,QAAC,kBAAAA,cAAA,CAAAG,eAAA,EAAA;AAAA,gBAAQ,OAAA,EAAS,WAAW,IAAO,GAAA,MAAA;AAAA,gBAClC,QAAC,kBAAAH,cAAA,CAAAI,aAAA,EAAA;AAAA,kBACC,SAAU,EAAA,6BAAA;AAAA,kBACV,MAAM,QAAW,mBAAAJ,cAAA,CAACK,eAAU,EAAA,EAAA,CAAA,kCAAMC,aAAS,EAAA,EAAA,CAAA;AAAA,kBAC3C,OAAS,EAAA,UAAA;AAAA,iBACX,CAAA;AAAA,eACF,CAAA;AAAA,aACF,CAAA;AAAA,WAAA;AAAA,SACF,CAAA;AAAA,wBACCN,cAAA,CAAA,KAAA,EAAA;AAAA,UAAI,SAAU,EAAA,uBAAA;AAAA,UACb,QAAC,kBAAAA,cAAA,CAAA,MAAA,EAAA;AAAA,YAAM,QAAA,EAAA,IAAA;AAAA,WAAK,CAAA;AAAA,SACd,CAAA;AAAA,OAAA;AAAA,KACF,CAAA;AAAA,GACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
3
|
+
import '../../icons/index.js';
|
|
4
|
+
import { Button } from './Button.js';
|
|
5
|
+
import { Tooltip } from './Tooltip.js';
|
|
6
|
+
import { TooltipProvider } from '@radix-ui/react-tooltip';
|
|
7
|
+
import { CheckIcon } from '../../icons/Check.js';
|
|
8
|
+
import { CopyIcon } from '../../icons/Copy.js';
|
|
9
|
+
|
|
10
|
+
const COPY_DELAY = 1500;
|
|
11
|
+
function CodeBlock({ title, code }) {
|
|
12
|
+
const [isCopied, setCopied] = useState(false);
|
|
13
|
+
const timeoutRef = useRef(null);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (isCopied) {
|
|
16
|
+
timeoutRef.current = setTimeout(() => {
|
|
17
|
+
setCopied(false);
|
|
18
|
+
}, COPY_DELAY);
|
|
19
|
+
}
|
|
20
|
+
return () => {
|
|
21
|
+
if (timeoutRef.current) {
|
|
22
|
+
clearTimeout(timeoutRef.current);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}, [isCopied]);
|
|
26
|
+
const handleCopy = useCallback(() => {
|
|
27
|
+
try {
|
|
28
|
+
navigator.clipboard.writeText(code);
|
|
29
|
+
setCopied(true);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error(error);
|
|
32
|
+
}
|
|
33
|
+
}, [code]);
|
|
34
|
+
return /* @__PURE__ */ jsx(TooltipProvider, {
|
|
35
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
36
|
+
className: "lb-code-block",
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ jsxs("div", {
|
|
39
|
+
className: "lb-code-block-header",
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ jsx("span", {
|
|
42
|
+
className: "lb-code-block-title",
|
|
43
|
+
children: title
|
|
44
|
+
}),
|
|
45
|
+
/* @__PURE__ */ jsx("div", {
|
|
46
|
+
className: "lb-code-block-header-actions",
|
|
47
|
+
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
48
|
+
content: isCopied ? null : "Copy",
|
|
49
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
50
|
+
className: "lb-code-block-header-action",
|
|
51
|
+
icon: isCopied ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(CopyIcon, {}),
|
|
52
|
+
onClick: handleCopy
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ jsx("pre", {
|
|
59
|
+
className: "lb-code-block-content",
|
|
60
|
+
children: /* @__PURE__ */ jsx("code", {
|
|
61
|
+
children: code
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { CodeBlock };
|
|
70
|
+
//# sourceMappingURL=CodeBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CodeBlock.js","sources":["../../../src/components/internal/CodeBlock.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { CheckIcon, CopyIcon } from \"../../icons\";\nimport { Button } from \"./Button\";\nimport { Tooltip, TooltipProvider } from \"./Tooltip\";\n\nconst COPY_DELAY = 1500;\n\ninterface CodeBlockProps extends Omit<ComponentProps<\"div\">, \"title\"> {\n title: string;\n code: string;\n}\n\nexport function CodeBlock({ title, code }: CodeBlockProps) {\n const [isCopied, setCopied] = useState(false);\n const timeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n useEffect(() => {\n if (isCopied) {\n timeoutRef.current = setTimeout(() => {\n setCopied(false);\n }, COPY_DELAY);\n }\n\n return () => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n }\n };\n }, [isCopied]);\n\n const handleCopy = useCallback(() => {\n try {\n navigator.clipboard.writeText(code);\n setCopied(true);\n } catch (error) {\n console.error(error);\n }\n }, [code]);\n\n return (\n <TooltipProvider>\n <div className=\"lb-code-block\">\n <div className=\"lb-code-block-header\">\n <span className=\"lb-code-block-title\">{title}</span>\n <div className=\"lb-code-block-header-actions\">\n <Tooltip content={isCopied ? null : \"Copy\"}>\n <Button\n className=\"lb-code-block-header-action\"\n icon={isCopied ? <CheckIcon /> : <CopyIcon />}\n onClick={handleCopy}\n />\n </Tooltip>\n </div>\n </div>\n <pre className=\"lb-code-block-content\">\n <code>{code}</code>\n </pre>\n </div>\n </TooltipProvider>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAOA,MAAM,UAAa,GAAA,IAAA,CAAA;AAOZ,SAAS,SAAU,CAAA,EAAE,KAAO,EAAA,IAAA,EAAwB,EAAA;AACzD,EAAA,MAAM,CAAC,QAAA,EAAU,SAAS,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AAC5C,EAAM,MAAA,UAAA,GAAa,OAA6C,IAAI,CAAA,CAAA;AAEpE,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,QAAU,EAAA;AACZ,MAAW,UAAA,CAAA,OAAA,GAAU,WAAW,MAAM;AACpC,QAAA,SAAA,CAAU,KAAK,CAAA,CAAA;AAAA,SACd,UAAU,CAAA,CAAA;AAAA,KACf;AAEA,IAAA,OAAO,MAAM;AACX,MAAA,IAAI,WAAW,OAAS,EAAA;AACtB,QAAA,YAAA,CAAa,WAAW,OAAO,CAAA,CAAA;AAAA,OACjC;AAAA,KACF,CAAA;AAAA,GACF,EAAG,CAAC,QAAQ,CAAC,CAAA,CAAA;AAEb,EAAM,MAAA,UAAA,GAAa,YAAY,MAAM;AACnC,IAAI,IAAA;AACF,MAAU,SAAA,CAAA,SAAA,CAAU,UAAU,IAAI,CAAA,CAAA;AAClC,MAAA,SAAA,CAAU,IAAI,CAAA,CAAA;AAAA,aACP,KAAP,EAAA;AACA,MAAA,OAAA,CAAQ,MAAM,KAAK,CAAA,CAAA;AAAA,KACrB;AAAA,GACF,EAAG,CAAC,IAAI,CAAC,CAAA,CAAA;AAET,EAAA,uBACG,GAAA,CAAA,eAAA,EAAA;AAAA,IACC,QAAC,kBAAA,IAAA,CAAA,KAAA,EAAA;AAAA,MAAI,SAAU,EAAA,eAAA;AAAA,MACb,QAAA,EAAA;AAAA,wBAAC,IAAA,CAAA,KAAA,EAAA;AAAA,UAAI,SAAU,EAAA,sBAAA;AAAA,UACb,QAAA,EAAA;AAAA,4BAAC,GAAA,CAAA,MAAA,EAAA;AAAA,cAAK,SAAU,EAAA,qBAAA;AAAA,cAAuB,QAAA,EAAA,KAAA;AAAA,aAAM,CAAA;AAAA,4BAC5C,GAAA,CAAA,KAAA,EAAA;AAAA,cAAI,SAAU,EAAA,8BAAA;AAAA,cACb,QAAC,kBAAA,GAAA,CAAA,OAAA,EAAA;AAAA,gBAAQ,OAAA,EAAS,WAAW,IAAO,GAAA,MAAA;AAAA,gBAClC,QAAC,kBAAA,GAAA,CAAA,MAAA,EAAA;AAAA,kBACC,SAAU,EAAA,6BAAA;AAAA,kBACV,MAAM,QAAW,mBAAA,GAAA,CAAC,SAAU,EAAA,EAAA,CAAA,uBAAM,QAAS,EAAA,EAAA,CAAA;AAAA,kBAC3C,OAAS,EAAA,UAAA;AAAA,iBACX,CAAA;AAAA,eACF,CAAA;AAAA,aACF,CAAA;AAAA,WAAA;AAAA,SACF,CAAA;AAAA,wBACC,GAAA,CAAA,KAAA,EAAA;AAAA,UAAI,SAAU,EAAA,uBAAA;AAAA,UACb,QAAC,kBAAA,GAAA,CAAA,MAAA,EAAA;AAAA,YAAM,QAAA,EAAA,IAAA;AAAA,WAAK,CAAA;AAAA,SACd,CAAA;AAAA,OAAA;AAAA,KACF,CAAA;AAAA,GACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -2,15 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var react = require('react');
|
|
5
|
-
var
|
|
5
|
+
var constants = require('../../constants.cjs');
|
|
6
6
|
var classNames = require('../../utils/class-names.cjs');
|
|
7
7
|
|
|
8
8
|
const Emoji = react.forwardRef(
|
|
9
|
-
({ className, ...props }, forwardedRef) => {
|
|
10
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9
|
+
({ emoji, className, style, ...props }, forwardedRef) => {
|
|
10
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
11
|
+
role: "img",
|
|
12
|
+
"aria-label": emoji,
|
|
13
|
+
"data-emoji": emoji,
|
|
11
14
|
className: classNames.classNames("lb-emoji", className),
|
|
15
|
+
style: {
|
|
16
|
+
...style,
|
|
17
|
+
fontFamily: constants.EMOJI_FONT_FAMILY
|
|
18
|
+
},
|
|
12
19
|
...props,
|
|
13
|
-
ref: forwardedRef
|
|
20
|
+
ref: forwardedRef,
|
|
21
|
+
children: emoji
|
|
14
22
|
});
|
|
15
23
|
}
|
|
16
24
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Emoji.cjs","sources":["../../../src/components/internal/Emoji.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\n\nimport
|
|
1
|
+
{"version":3,"file":"Emoji.cjs","sources":["../../../src/components/internal/Emoji.tsx"],"sourcesContent":["import { type ComponentProps, forwardRef } from \"react\";\n\nimport { EMOJI_FONT_FAMILY } from \"../../constants\";\nimport { classNames } from \"../../utils/class-names\";\n\ninterface EmojiProps extends ComponentProps<\"span\"> {\n emoji: string;\n}\n\nexport const Emoji = forwardRef<HTMLSpanElement, EmojiProps>(\n ({ emoji, className, style, ...props }, forwardedRef) => {\n return (\n <span\n role=\"img\"\n aria-label={emoji}\n data-emoji={emoji}\n className={classNames(\"lb-emoji\", className)}\n style={{\n ...style,\n fontFamily: EMOJI_FONT_FAMILY,\n }}\n {...props}\n ref={forwardedRef}\n >\n {emoji}\n </span>\n );\n }\n);\n"],"names":["forwardRef","jsx","classNames","EMOJI_FONT_FAMILY"],"mappings":";;;;;;;AASO,MAAM,KAAQ,GAAAA,gBAAA;AAAA,EACnB,CAAC,EAAE,KAAA,EAAO,WAAW,KAAU,EAAA,GAAA,KAAA,IAAS,YAAiB,KAAA;AACvD,IAAA,uBACGC,cAAA,CAAA,MAAA,EAAA;AAAA,MACC,IAAK,EAAA,KAAA;AAAA,MACL,YAAY,EAAA,KAAA;AAAA,MACZ,YAAY,EAAA,KAAA;AAAA,MACZ,SAAA,EAAWC,qBAAW,CAAA,UAAA,EAAY,SAAS,CAAA;AAAA,MAC3C,KAAO,EAAA;AAAA,QACL,GAAG,KAAA;AAAA,QACH,UAAY,EAAAC,2BAAA;AAAA,OACd;AAAA,MACC,GAAG,KAAA;AAAA,MACJ,GAAK,EAAA,YAAA;AAAA,MAEJ,QAAA,EAAA,KAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { EMOJI_FONT_FAMILY } from '../../constants.js';
|
|
4
4
|
import { classNames } from '../../utils/class-names.js';
|
|
5
5
|
|
|
6
6
|
const Emoji = forwardRef(
|
|
7
|
-
({ className, ...props }, forwardedRef) => {
|
|
8
|
-
return /* @__PURE__ */ jsx(
|
|
7
|
+
({ emoji, className, style, ...props }, forwardedRef) => {
|
|
8
|
+
return /* @__PURE__ */ jsx("span", {
|
|
9
|
+
role: "img",
|
|
10
|
+
"aria-label": emoji,
|
|
11
|
+
"data-emoji": emoji,
|
|
9
12
|
className: classNames("lb-emoji", className),
|
|
13
|
+
style: {
|
|
14
|
+
...style,
|
|
15
|
+
fontFamily: EMOJI_FONT_FAMILY
|
|
16
|
+
},
|
|
10
17
|
...props,
|
|
11
|
-
ref: forwardedRef
|
|
18
|
+
ref: forwardedRef,
|
|
19
|
+
children: emoji
|
|
12
20
|
});
|
|
13
21
|
}
|
|
14
22
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Emoji.js","sources":["../../../src/components/internal/Emoji.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\n\nimport
|
|
1
|
+
{"version":3,"file":"Emoji.js","sources":["../../../src/components/internal/Emoji.tsx"],"sourcesContent":["import { type ComponentProps, forwardRef } from \"react\";\n\nimport { EMOJI_FONT_FAMILY } from \"../../constants\";\nimport { classNames } from \"../../utils/class-names\";\n\ninterface EmojiProps extends ComponentProps<\"span\"> {\n emoji: string;\n}\n\nexport const Emoji = forwardRef<HTMLSpanElement, EmojiProps>(\n ({ emoji, className, style, ...props }, forwardedRef) => {\n return (\n <span\n role=\"img\"\n aria-label={emoji}\n data-emoji={emoji}\n className={classNames(\"lb-emoji\", className)}\n style={{\n ...style,\n fontFamily: EMOJI_FONT_FAMILY,\n }}\n {...props}\n ref={forwardedRef}\n >\n {emoji}\n </span>\n );\n }\n);\n"],"names":[],"mappings":";;;;;AASO,MAAM,KAAQ,GAAA,UAAA;AAAA,EACnB,CAAC,EAAE,KAAA,EAAO,WAAW,KAAU,EAAA,GAAA,KAAA,IAAS,YAAiB,KAAA;AACvD,IAAA,uBACG,GAAA,CAAA,MAAA,EAAA;AAAA,MACC,IAAK,EAAA,KAAA;AAAA,MACL,YAAY,EAAA,KAAA;AAAA,MACZ,YAAY,EAAA,KAAA;AAAA,MACZ,SAAA,EAAW,UAAW,CAAA,UAAA,EAAY,SAAS,CAAA;AAAA,MAC3C,KAAO,EAAA;AAAA,QACL,GAAG,KAAA;AAAA,QACH,UAAY,EAAA,iBAAA;AAAA,OACd;AAAA,MACC,GAAG,KAAA;AAAA,MACJ,GAAK,EAAA,YAAA;AAAA,MAEJ,QAAA,EAAA,KAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var components = require('../../components.cjs');
|
|
5
|
+
var Markdown = require('../../primitives/Markdown.cjs');
|
|
6
|
+
var classNames = require('../../utils/class-names.cjs');
|
|
7
|
+
var CodeBlock$1 = require('./CodeBlock.cjs');
|
|
8
|
+
|
|
9
|
+
function Link({ href, title, children }) {
|
|
10
|
+
const { Anchor } = components.useComponents();
|
|
11
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Anchor, {
|
|
12
|
+
href,
|
|
13
|
+
title,
|
|
14
|
+
children
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function CodeBlock({ language, code }) {
|
|
18
|
+
return /* @__PURE__ */ jsxRuntime.jsx(CodeBlock$1.CodeBlock, {
|
|
19
|
+
title: language || "Plain text",
|
|
20
|
+
code
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
const markdownComponents = {
|
|
24
|
+
Link,
|
|
25
|
+
CodeBlock
|
|
26
|
+
};
|
|
27
|
+
function Prose({ content, className, ...props }) {
|
|
28
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Markdown.Markdown, {
|
|
29
|
+
content,
|
|
30
|
+
components: markdownComponents,
|
|
31
|
+
className: classNames.classNames("lb-prose", className),
|
|
32
|
+
...props
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
exports.Prose = Prose;
|
|
37
|
+
//# sourceMappingURL=Prose.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Prose.cjs","sources":["../../../src/components/internal/Prose.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\n\nimport { useComponents } from \"../../components\";\nimport type {\n MarkdownComponents,\n MarkdownComponentsCodeBlockProps,\n MarkdownComponentsLinkProps,\n} from \"../../primitives/Markdown\";\nimport { Markdown } from \"../../primitives/Markdown\";\nimport { classNames } from \"../../utils/class-names\";\nimport { CodeBlock as DefaultCodeBlock } from \"./CodeBlock\";\n\ninterface ProseProps extends ComponentProps<\"div\"> {\n content: string;\n}\n\nfunction Link({ href, title, children }: MarkdownComponentsLinkProps) {\n const { Anchor } = useComponents();\n\n return (\n <Anchor href={href} title={title}>\n {children}\n </Anchor>\n );\n}\n\nfunction CodeBlock({ language, code }: MarkdownComponentsCodeBlockProps) {\n return <DefaultCodeBlock title={language || \"Plain text\"} code={code} />;\n}\n\nconst markdownComponents: Partial<MarkdownComponents> = {\n Link,\n CodeBlock,\n};\n\n/**\n * This component renders Markdown content with `lb-prose`\n * styles and custom components (code blocks, etc)\n */\nexport function Prose({ content, className, ...props }: ProseProps) {\n return (\n <Markdown\n content={content}\n components={markdownComponents}\n className={classNames(\"lb-prose\", className)}\n {...props}\n />\n );\n}\n"],"names":["useComponents","jsx","DefaultCodeBlock","Markdown","classNames"],"mappings":";;;;;;;;AAgBA,SAAS,IAAK,CAAA,EAAE,IAAM,EAAA,KAAA,EAAO,UAAyC,EAAA;AACpE,EAAM,MAAA,EAAE,MAAO,EAAA,GAAIA,wBAAc,EAAA,CAAA;AAEjC,EAAA,uBACGC,cAAA,CAAA,MAAA,EAAA;AAAA,IAAO,IAAA;AAAA,IAAY,KAAA;AAAA,IACjB,QAAA;AAAA,GACH,CAAA,CAAA;AAEJ,CAAA;AAEA,SAAS,SAAU,CAAA,EAAE,QAAU,EAAA,IAAA,EAA0C,EAAA;AACvE,EAAA,uBAAQA,cAAA,CAAAC,qBAAA,EAAA;AAAA,IAAiB,OAAO,QAAY,IAAA,YAAA;AAAA,IAAc,IAAA;AAAA,GAAY,CAAA,CAAA;AACxE,CAAA;AAEA,MAAM,kBAAkD,GAAA;AAAA,EACtD,IAAA;AAAA,EACA,SAAA;AACF,CAAA,CAAA;AAMO,SAAS,KAAM,CAAA,EAAE,OAAS,EAAA,SAAA,EAAA,GAAc,OAAqB,EAAA;AAClE,EAAA,uBACGD,cAAA,CAAAE,iBAAA,EAAA;AAAA,IACC,OAAA;AAAA,IACA,UAAY,EAAA,kBAAA;AAAA,IACZ,SAAA,EAAWC,qBAAW,CAAA,UAAA,EAAY,SAAS,CAAA;AAAA,IAC1C,GAAG,KAAA;AAAA,GACN,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useComponents } from '../../components.js';
|
|
3
|
+
import { Markdown } from '../../primitives/Markdown.js';
|
|
4
|
+
import { classNames } from '../../utils/class-names.js';
|
|
5
|
+
import { CodeBlock as CodeBlock$1 } from './CodeBlock.js';
|
|
6
|
+
|
|
7
|
+
function Link({ href, title, children }) {
|
|
8
|
+
const { Anchor } = useComponents();
|
|
9
|
+
return /* @__PURE__ */ jsx(Anchor, {
|
|
10
|
+
href,
|
|
11
|
+
title,
|
|
12
|
+
children
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function CodeBlock({ language, code }) {
|
|
16
|
+
return /* @__PURE__ */ jsx(CodeBlock$1, {
|
|
17
|
+
title: language || "Plain text",
|
|
18
|
+
code
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
const markdownComponents = {
|
|
22
|
+
Link,
|
|
23
|
+
CodeBlock
|
|
24
|
+
};
|
|
25
|
+
function Prose({ content, className, ...props }) {
|
|
26
|
+
return /* @__PURE__ */ jsx(Markdown, {
|
|
27
|
+
content,
|
|
28
|
+
components: markdownComponents,
|
|
29
|
+
className: classNames("lb-prose", className),
|
|
30
|
+
...props
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { Prose };
|
|
35
|
+
//# sourceMappingURL=Prose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Prose.js","sources":["../../../src/components/internal/Prose.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\n\nimport { useComponents } from \"../../components\";\nimport type {\n MarkdownComponents,\n MarkdownComponentsCodeBlockProps,\n MarkdownComponentsLinkProps,\n} from \"../../primitives/Markdown\";\nimport { Markdown } from \"../../primitives/Markdown\";\nimport { classNames } from \"../../utils/class-names\";\nimport { CodeBlock as DefaultCodeBlock } from \"./CodeBlock\";\n\ninterface ProseProps extends ComponentProps<\"div\"> {\n content: string;\n}\n\nfunction Link({ href, title, children }: MarkdownComponentsLinkProps) {\n const { Anchor } = useComponents();\n\n return (\n <Anchor href={href} title={title}>\n {children}\n </Anchor>\n );\n}\n\nfunction CodeBlock({ language, code }: MarkdownComponentsCodeBlockProps) {\n return <DefaultCodeBlock title={language || \"Plain text\"} code={code} />;\n}\n\nconst markdownComponents: Partial<MarkdownComponents> = {\n Link,\n CodeBlock,\n};\n\n/**\n * This component renders Markdown content with `lb-prose`\n * styles and custom components (code blocks, etc)\n */\nexport function Prose({ content, className, ...props }: ProseProps) {\n return (\n <Markdown\n content={content}\n components={markdownComponents}\n className={classNames(\"lb-prose\", className)}\n {...props}\n />\n );\n}\n"],"names":["DefaultCodeBlock"],"mappings":";;;;;;AAgBA,SAAS,IAAK,CAAA,EAAE,IAAM,EAAA,KAAA,EAAO,UAAyC,EAAA;AACpE,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,aAAc,EAAA,CAAA;AAEjC,EAAA,uBACG,GAAA,CAAA,MAAA,EAAA;AAAA,IAAO,IAAA;AAAA,IAAY,KAAA;AAAA,IACjB,QAAA;AAAA,GACH,CAAA,CAAA;AAEJ,CAAA;AAEA,SAAS,SAAU,CAAA,EAAE,QAAU,EAAA,IAAA,EAA0C,EAAA;AACvE,EAAA,uBAAQ,GAAA,CAAAA,WAAA,EAAA;AAAA,IAAiB,OAAO,QAAY,IAAA,YAAA;AAAA,IAAc,IAAA;AAAA,GAAY,CAAA,CAAA;AACxE,CAAA;AAEA,MAAM,kBAAkD,GAAA;AAAA,EACtD,IAAA;AAAA,EACA,SAAA;AACF,CAAA,CAAA;AAMO,SAAS,KAAM,CAAA,EAAE,OAAS,EAAA,SAAA,EAAA,GAAc,OAAqB,EAAA;AAClE,EAAA,uBACG,GAAA,CAAA,QAAA,EAAA;AAAA,IACC,OAAA;AAAA,IACA,UAAY,EAAA,kBAAA;AAAA,IACZ,SAAA,EAAW,UAAW,CAAA,UAAA,EAAY,SAAS,CAAA;AAAA,IAC1C,GAAG,KAAA;AAAA,GACN,CAAA,CAAA;AAEJ;;;;"}
|
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var core = require('@liveblocks/core');
|
|
4
4
|
var version = require('./version.cjs');
|
|
5
5
|
var AiChat = require('./components/AiChat.cjs');
|
|
6
|
-
var
|
|
6
|
+
var AiTool = require('./components/AiTool.cjs');
|
|
7
7
|
var Comment = require('./components/Comment.cjs');
|
|
8
8
|
var Composer = require('./components/Composer.cjs');
|
|
9
9
|
var HistoryVersionSummary = require('./components/HistoryVersionSummary.cjs');
|
|
@@ -18,7 +18,7 @@ var overrides = require('./overrides.cjs');
|
|
|
18
18
|
core.detectDupes(version.PKG_NAME, version.PKG_VERSION, version.PKG_FORMAT);
|
|
19
19
|
|
|
20
20
|
exports.AiChat = AiChat.AiChat;
|
|
21
|
-
exports.
|
|
21
|
+
exports.AiTool = AiTool.AiTool;
|
|
22
22
|
exports.Comment = Comment.Comment;
|
|
23
23
|
exports.Composer = Composer.Composer;
|
|
24
24
|
exports.HistoryVersionSummary = HistoryVersionSummary.HistoryVersionSummary;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport type { AiChatProps } from \"./components/AiChat\";\nexport { AiChat } from \"./components/AiChat\";\nexport {
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import { detectDupes } from \"@liveblocks/core\";\n\nimport { PKG_FORMAT, PKG_NAME, PKG_VERSION } from \"./version\";\n\ndetectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);\n\nexport type { AiChatProps } from \"./components/AiChat\";\nexport { AiChat } from \"./components/AiChat\";\nexport type { AiToolIconProps, AiToolProps } from \"./components/AiTool\";\nexport { AiTool } from \"./components/AiTool\";\nexport type { CommentProps } from \"./components/Comment\";\nexport { Comment } from \"./components/Comment\";\nexport type { ComposerProps } from \"./components/Composer\";\nexport { Composer } from \"./components/Composer\";\nexport type { HistoryVersionSummaryProps } from \"./components/HistoryVersionSummary\";\nexport { HistoryVersionSummary } from \"./components/HistoryVersionSummary\";\nexport type { HistoryVersionSummaryListProps } from \"./components/HistoryVersionSummaryList\";\nexport { HistoryVersionSummaryList } from \"./components/HistoryVersionSummaryList\";\nexport type {\n InboxNotificationAvatarProps,\n InboxNotificationCustomKindProps,\n InboxNotificationCustomProps,\n InboxNotificationIconProps,\n InboxNotificationProps,\n InboxNotificationTextMentionKindProps,\n InboxNotificationTextMentionProps,\n InboxNotificationThreadKindProps,\n InboxNotificationThreadProps,\n} from \"./components/InboxNotification\";\nexport { InboxNotification } from \"./components/InboxNotification\";\nexport type { InboxNotificationListProps } from \"./components/InboxNotificationList\";\nexport { InboxNotificationList } from \"./components/InboxNotificationList\";\nexport type { ThreadProps } from \"./components/Thread\";\nexport { Thread } from \"./components/Thread\";\nexport { LiveblocksUIConfig } from \"./config\";\nexport * as Icon from \"./icon\";\nexport type {\n CommentOverrides,\n ComposerOverrides,\n GlobalOverrides,\n InboxNotificationOverrides,\n LocalizationOverrides,\n Overrides,\n ThreadOverrides,\n} from \"./overrides\";\nexport { useOverrides } from \"./overrides\";\nexport type { ComposerSubmitComment } from \"./primitives\";\nexport type {\n CommentAttachmentArgs,\n ComposerBodyMark,\n ComposerBodyMarks,\n} from \"./types\";\n"],"names":["detectDupes","PKG_NAME","PKG_VERSION","PKG_FORMAT"],"mappings":";;;;;;;;;;;;;;;;;AAIAA,gBAAY,CAAAC,gBAAA,EAAUC,qBAAaC,kBAAU,CAAA;;;;;;;;;;;;;;;"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentType, ComponentPropsWithoutRef, ElementType, ReactNode, ComponentProps, FormEvent, RefAttributes, MouseEvent, PropsWithChildren } from 'react';
|
|
3
|
-
import { CommentAttachment, AiKnowledgeSource,
|
|
3
|
+
import { CommentAttachment, AiKnowledgeSource, AiOpaqueToolDefinition, AiToolTypePack, JsonObject, ToolResultData, AiToolExecuteCallback, CommentBody, BaseMetadata, DM, CommentData, HistoryVersion, InboxNotificationData, InboxNotificationThreadData, InboxNotificationTextMentionData, InboxNotificationCustomData, KDAD, ThreadData } from '@liveblocks/core';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
interface GlobalComponents {
|
|
@@ -117,6 +117,12 @@ interface HistoryVersionPreviewOverrides {
|
|
|
117
117
|
type Overrides = LocalizationOverrides & GlobalOverrides & ComposerOverrides & CommentOverrides & ThreadOverrides & InboxNotificationOverrides & HistoryVersionPreviewOverrides & AiChatComposerOverrides & AiChatMessageOverrides & AiChatOverrides;
|
|
118
118
|
declare function useOverrides(overrides?: Partial<Overrides>): Overrides;
|
|
119
119
|
|
|
120
|
+
type AiChatComponentsEmptyProps = Record<string, never>;
|
|
121
|
+
type AiChatComponentsLoadingProps = Record<string, never>;
|
|
122
|
+
type AiChatComponents = {
|
|
123
|
+
Empty: ComponentType<AiChatComponentsEmptyProps>;
|
|
124
|
+
Loading: ComponentType<AiChatComponentsLoadingProps>;
|
|
125
|
+
};
|
|
120
126
|
interface AiChatProps extends ComponentProps<"div"> {
|
|
121
127
|
/**
|
|
122
128
|
* The id of the chat the composer belongs to.
|
|
@@ -138,7 +144,11 @@ interface AiChatProps extends ComponentProps<"div"> {
|
|
|
138
144
|
/**
|
|
139
145
|
* Tool definitions to make available within this chat. May be used by the assistant when generating responses.
|
|
140
146
|
*/
|
|
141
|
-
tools?: Record<string,
|
|
147
|
+
tools?: Record<string, AiOpaqueToolDefinition>;
|
|
148
|
+
/**
|
|
149
|
+
* The layout of the chat and its composer.
|
|
150
|
+
*/
|
|
151
|
+
layout?: "inset" | "compact";
|
|
142
152
|
/**
|
|
143
153
|
* Override the component's strings.
|
|
144
154
|
*/
|
|
@@ -146,18 +156,49 @@ interface AiChatProps extends ComponentProps<"div"> {
|
|
|
146
156
|
/**
|
|
147
157
|
* Override the component's components.
|
|
148
158
|
*/
|
|
149
|
-
components?: Partial<GlobalComponents>;
|
|
159
|
+
components?: Partial<GlobalComponents & AiChatComponents>;
|
|
150
160
|
}
|
|
151
161
|
declare const AiChat: react.ForwardRefExoticComponent<Omit<AiChatProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
152
162
|
|
|
163
|
+
interface AiToolProps extends Omit<ComponentProps<"div">, "title" | "children"> {
|
|
164
|
+
/**
|
|
165
|
+
* The tool's title.
|
|
166
|
+
*
|
|
167
|
+
* By default, a human-readable version of the tool's name is used:
|
|
168
|
+
* - `"showTodo"` → "Show todo"
|
|
169
|
+
* - `"get_weather"` → "Get weather"
|
|
170
|
+
*/
|
|
171
|
+
title?: string;
|
|
172
|
+
/**
|
|
173
|
+
* An optional icon displayed next to the title.
|
|
174
|
+
*/
|
|
175
|
+
icon?: ReactNode;
|
|
176
|
+
/**
|
|
177
|
+
* The content shown in the tool.
|
|
178
|
+
*/
|
|
179
|
+
children?: ReactNode;
|
|
180
|
+
}
|
|
181
|
+
type AiToolIconProps = ComponentProps<"div">;
|
|
182
|
+
type AiToolInspectorProps = ComponentProps<"div">;
|
|
153
183
|
/**
|
|
154
|
-
* @
|
|
155
|
-
* Helper to debug tool invocations.
|
|
184
|
+
* @private This API will change, and is not considered stable. DO NOT RELY on it.
|
|
156
185
|
*
|
|
157
|
-
*
|
|
158
|
-
* see what's going on with your tool calls.
|
|
186
|
+
* This component can be used to build human-in-the-loop interfaces.
|
|
159
187
|
*/
|
|
160
|
-
|
|
188
|
+
interface AiToolConfirmationProps<A extends JsonObject, R extends ToolResultData> extends ComponentProps<"div"> {
|
|
189
|
+
args?: A;
|
|
190
|
+
confirm: AiToolExecuteCallback<A, R>;
|
|
191
|
+
cancel: AiToolExecuteCallback<A, R>;
|
|
192
|
+
variant?: "default" | "destructive";
|
|
193
|
+
}
|
|
194
|
+
declare function AiToolIcon({ className, ...props }: AiToolIconProps): react_jsx_runtime.JSX.Element;
|
|
195
|
+
declare function AiToolInspector({ className, ...props }: AiToolInspectorProps): react_jsx_runtime.JSX.Element;
|
|
196
|
+
declare function AiToolConfirmation<TPack extends AiToolTypePack, A extends JsonObject = TPack["A"], R extends ToolResultData = TPack["R"]>({ children, variant, confirm, cancel, className, ...props }: AiToolConfirmationProps<A, R>): react_jsx_runtime.JSX.Element | null;
|
|
197
|
+
declare const AiTool: react.ForwardRefExoticComponent<Omit<AiToolProps, "ref"> & react.RefAttributes<HTMLDivElement>> & {
|
|
198
|
+
Icon: typeof AiToolIcon;
|
|
199
|
+
Inspector: typeof AiToolInspector;
|
|
200
|
+
Confirmation: typeof AiToolConfirmation;
|
|
201
|
+
};
|
|
161
202
|
|
|
162
203
|
interface ComposerEditorMentionProps {
|
|
163
204
|
/**
|
|
@@ -875,4 +916,4 @@ declare namespace icon {
|
|
|
875
916
|
};
|
|
876
917
|
}
|
|
877
918
|
|
|
878
|
-
export { AiChat, AiChatProps,
|
|
919
|
+
export { AiChat, AiChatProps, AiTool, AiToolIconProps, AiToolProps, Comment, CommentAttachmentArgs, CommentOverrides, CommentProps, Composer, ComposerBodyMark, ComposerBodyMarks, ComposerOverrides, ComposerProps, ComposerSubmitComment, GlobalOverrides, HistoryVersionSummary, HistoryVersionSummaryList, HistoryVersionSummaryListProps, HistoryVersionSummaryProps, icon as Icon, InboxNotification, InboxNotificationAvatarProps, InboxNotificationCustomKindProps, InboxNotificationCustomProps, InboxNotificationIconProps, InboxNotificationList, InboxNotificationListProps, InboxNotificationOverrides, InboxNotificationProps, InboxNotificationTextMentionKindProps, InboxNotificationTextMentionProps, InboxNotificationThreadKindProps, InboxNotificationThreadProps, LiveblocksUIConfig, LocalizationOverrides, Overrides, Thread, ThreadOverrides, ThreadProps, useOverrides };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentType, ComponentPropsWithoutRef, ElementType, ReactNode, ComponentProps, FormEvent, RefAttributes, MouseEvent, PropsWithChildren } from 'react';
|
|
3
|
-
import { CommentAttachment, AiKnowledgeSource,
|
|
3
|
+
import { CommentAttachment, AiKnowledgeSource, AiOpaqueToolDefinition, AiToolTypePack, JsonObject, ToolResultData, AiToolExecuteCallback, CommentBody, BaseMetadata, DM, CommentData, HistoryVersion, InboxNotificationData, InboxNotificationThreadData, InboxNotificationTextMentionData, InboxNotificationCustomData, KDAD, ThreadData } from '@liveblocks/core';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
interface GlobalComponents {
|
|
@@ -117,6 +117,12 @@ interface HistoryVersionPreviewOverrides {
|
|
|
117
117
|
type Overrides = LocalizationOverrides & GlobalOverrides & ComposerOverrides & CommentOverrides & ThreadOverrides & InboxNotificationOverrides & HistoryVersionPreviewOverrides & AiChatComposerOverrides & AiChatMessageOverrides & AiChatOverrides;
|
|
118
118
|
declare function useOverrides(overrides?: Partial<Overrides>): Overrides;
|
|
119
119
|
|
|
120
|
+
type AiChatComponentsEmptyProps = Record<string, never>;
|
|
121
|
+
type AiChatComponentsLoadingProps = Record<string, never>;
|
|
122
|
+
type AiChatComponents = {
|
|
123
|
+
Empty: ComponentType<AiChatComponentsEmptyProps>;
|
|
124
|
+
Loading: ComponentType<AiChatComponentsLoadingProps>;
|
|
125
|
+
};
|
|
120
126
|
interface AiChatProps extends ComponentProps<"div"> {
|
|
121
127
|
/**
|
|
122
128
|
* The id of the chat the composer belongs to.
|
|
@@ -138,7 +144,11 @@ interface AiChatProps extends ComponentProps<"div"> {
|
|
|
138
144
|
/**
|
|
139
145
|
* Tool definitions to make available within this chat. May be used by the assistant when generating responses.
|
|
140
146
|
*/
|
|
141
|
-
tools?: Record<string,
|
|
147
|
+
tools?: Record<string, AiOpaqueToolDefinition>;
|
|
148
|
+
/**
|
|
149
|
+
* The layout of the chat and its composer.
|
|
150
|
+
*/
|
|
151
|
+
layout?: "inset" | "compact";
|
|
142
152
|
/**
|
|
143
153
|
* Override the component's strings.
|
|
144
154
|
*/
|
|
@@ -146,18 +156,49 @@ interface AiChatProps extends ComponentProps<"div"> {
|
|
|
146
156
|
/**
|
|
147
157
|
* Override the component's components.
|
|
148
158
|
*/
|
|
149
|
-
components?: Partial<GlobalComponents>;
|
|
159
|
+
components?: Partial<GlobalComponents & AiChatComponents>;
|
|
150
160
|
}
|
|
151
161
|
declare const AiChat: react.ForwardRefExoticComponent<Omit<AiChatProps, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
152
162
|
|
|
163
|
+
interface AiToolProps extends Omit<ComponentProps<"div">, "title" | "children"> {
|
|
164
|
+
/**
|
|
165
|
+
* The tool's title.
|
|
166
|
+
*
|
|
167
|
+
* By default, a human-readable version of the tool's name is used:
|
|
168
|
+
* - `"showTodo"` → "Show todo"
|
|
169
|
+
* - `"get_weather"` → "Get weather"
|
|
170
|
+
*/
|
|
171
|
+
title?: string;
|
|
172
|
+
/**
|
|
173
|
+
* An optional icon displayed next to the title.
|
|
174
|
+
*/
|
|
175
|
+
icon?: ReactNode;
|
|
176
|
+
/**
|
|
177
|
+
* The content shown in the tool.
|
|
178
|
+
*/
|
|
179
|
+
children?: ReactNode;
|
|
180
|
+
}
|
|
181
|
+
type AiToolIconProps = ComponentProps<"div">;
|
|
182
|
+
type AiToolInspectorProps = ComponentProps<"div">;
|
|
153
183
|
/**
|
|
154
|
-
* @
|
|
155
|
-
* Helper to debug tool invocations.
|
|
184
|
+
* @private This API will change, and is not considered stable. DO NOT RELY on it.
|
|
156
185
|
*
|
|
157
|
-
*
|
|
158
|
-
* see what's going on with your tool calls.
|
|
186
|
+
* This component can be used to build human-in-the-loop interfaces.
|
|
159
187
|
*/
|
|
160
|
-
|
|
188
|
+
interface AiToolConfirmationProps<A extends JsonObject, R extends ToolResultData> extends ComponentProps<"div"> {
|
|
189
|
+
args?: A;
|
|
190
|
+
confirm: AiToolExecuteCallback<A, R>;
|
|
191
|
+
cancel: AiToolExecuteCallback<A, R>;
|
|
192
|
+
variant?: "default" | "destructive";
|
|
193
|
+
}
|
|
194
|
+
declare function AiToolIcon({ className, ...props }: AiToolIconProps): react_jsx_runtime.JSX.Element;
|
|
195
|
+
declare function AiToolInspector({ className, ...props }: AiToolInspectorProps): react_jsx_runtime.JSX.Element;
|
|
196
|
+
declare function AiToolConfirmation<TPack extends AiToolTypePack, A extends JsonObject = TPack["A"], R extends ToolResultData = TPack["R"]>({ children, variant, confirm, cancel, className, ...props }: AiToolConfirmationProps<A, R>): react_jsx_runtime.JSX.Element | null;
|
|
197
|
+
declare const AiTool: react.ForwardRefExoticComponent<Omit<AiToolProps, "ref"> & react.RefAttributes<HTMLDivElement>> & {
|
|
198
|
+
Icon: typeof AiToolIcon;
|
|
199
|
+
Inspector: typeof AiToolInspector;
|
|
200
|
+
Confirmation: typeof AiToolConfirmation;
|
|
201
|
+
};
|
|
161
202
|
|
|
162
203
|
interface ComposerEditorMentionProps {
|
|
163
204
|
/**
|
|
@@ -875,4 +916,4 @@ declare namespace icon {
|
|
|
875
916
|
};
|
|
876
917
|
}
|
|
877
918
|
|
|
878
|
-
export { AiChat, AiChatProps,
|
|
919
|
+
export { AiChat, AiChatProps, AiTool, AiToolIconProps, AiToolProps, Comment, CommentAttachmentArgs, CommentOverrides, CommentProps, Composer, ComposerBodyMark, ComposerBodyMarks, ComposerOverrides, ComposerProps, ComposerSubmitComment, GlobalOverrides, HistoryVersionSummary, HistoryVersionSummaryList, HistoryVersionSummaryListProps, HistoryVersionSummaryProps, icon as Icon, InboxNotification, InboxNotificationAvatarProps, InboxNotificationCustomKindProps, InboxNotificationCustomProps, InboxNotificationIconProps, InboxNotificationList, InboxNotificationListProps, InboxNotificationOverrides, InboxNotificationProps, InboxNotificationTextMentionKindProps, InboxNotificationTextMentionProps, InboxNotificationThreadKindProps, InboxNotificationThreadProps, LiveblocksUIConfig, LocalizationOverrides, Overrides, Thread, ThreadOverrides, ThreadProps, useOverrides };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { detectDupes } from '@liveblocks/core';
|
|
2
2
|
import { PKG_NAME, PKG_VERSION, PKG_FORMAT } from './version.js';
|
|
3
3
|
export { AiChat } from './components/AiChat.js';
|
|
4
|
-
export {
|
|
4
|
+
export { AiTool } from './components/AiTool.js';
|
|
5
5
|
export { Comment } from './components/Comment.js';
|
|
6
6
|
export { Composer } from './components/Composer.js';
|
|
7
7
|
export { HistoryVersionSummary } from './components/HistoryVersionSummary.js';
|