@page-speed/agent-everywhere 0.2.0 → 0.3.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.
package/dist/index.cjs CHANGED
@@ -6,6 +6,7 @@ var tailwindMerge = require('tailwind-merge');
6
6
  var React4 = require('react');
7
7
  var jsxRuntime = require('react/jsx-runtime');
8
8
  var react = require('motion/react');
9
+ var markdownToJsx = require('@page-speed/markdown-to-jsx');
9
10
  var lucideReact = require('lucide-react');
10
11
  var reactSlot = require('@radix-ui/react-slot');
11
12
  var classVarianceAuthority = require('class-variance-authority');
@@ -1006,8 +1007,70 @@ function MessageBubble({ role, children, className, unstyled }) {
1006
1007
  }
1007
1008
  );
1008
1009
  }
1009
- function MessageContent({ children, className }) {
1010
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("text-sm leading-relaxed whitespace-pre-wrap", className), children });
1010
+ var SPACE = "0.5rem";
1011
+ var mdStyle = { lineHeight: 1.6 };
1012
+ var MdP = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("p", { style: { margin: `${SPACE} 0` }, children });
1013
+ var MdUl = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("ul", { style: { margin: `${SPACE} 0`, paddingLeft: "1.25rem", listStyle: "disc" }, children });
1014
+ var MdOl = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(
1015
+ "ol",
1016
+ {
1017
+ style: { margin: `${SPACE} 0`, paddingLeft: "1.25rem", listStyle: "decimal" },
1018
+ children
1019
+ }
1020
+ );
1021
+ var MdLi = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx("li", { style: { margin: "0.2rem 0" }, children });
1022
+ var mkHeading = (level, fontSize) => ({ children }) => {
1023
+ const Tag = `h${level}`;
1024
+ return /* @__PURE__ */ jsxRuntime.jsx(Tag, { style: { margin: `${SPACE} 0 0.25rem`, fontSize, fontWeight: 600 }, children });
1025
+ };
1026
+ var MdBlockquote = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(
1027
+ "blockquote",
1028
+ {
1029
+ style: {
1030
+ margin: `${SPACE} 0`,
1031
+ paddingLeft: "0.75rem",
1032
+ borderLeft: "2px solid currentColor",
1033
+ opacity: 0.85
1034
+ },
1035
+ children
1036
+ }
1037
+ );
1038
+ var MARKDOWN_OVERRIDES = {
1039
+ p: MdP,
1040
+ ul: MdUl,
1041
+ ol: MdOl,
1042
+ li: MdLi,
1043
+ h1: mkHeading(1, "1rem"),
1044
+ h2: mkHeading(2, "0.95rem"),
1045
+ h3: mkHeading(3, "0.9rem"),
1046
+ blockquote: MdBlockquote
1047
+ };
1048
+ function MessageContent({
1049
+ children,
1050
+ className,
1051
+ markdown = true
1052
+ }) {
1053
+ if (markdown && typeof children === "string") {
1054
+ return /* @__PURE__ */ jsxRuntime.jsx(
1055
+ markdownToJsx.Markdown,
1056
+ {
1057
+ className: cn(
1058
+ "text-sm [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
1059
+ className
1060
+ ),
1061
+ overrides: MARKDOWN_OVERRIDES,
1062
+ children
1063
+ }
1064
+ );
1065
+ }
1066
+ return /* @__PURE__ */ jsxRuntime.jsx(
1067
+ "div",
1068
+ {
1069
+ className: cn("text-sm leading-relaxed whitespace-pre-wrap", className),
1070
+ style: mdStyle,
1071
+ children
1072
+ }
1073
+ );
1011
1074
  }
1012
1075
  function MessageContainer({ role, children, className }) {
1013
1076
  return /* @__PURE__ */ jsxRuntime.jsx(