@djangocfg/ui-tools 2.1.91 → 2.1.92

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.d.cts CHANGED
@@ -1577,6 +1577,7 @@ interface MarkdownMessageProps {
1577
1577
  * - Mermaid diagram rendering
1578
1578
  * - Tables, lists, blockquotes
1579
1579
  * - User/assistant styling modes
1580
+ * - Plain text optimization (skips ReactMarkdown for simple text)
1580
1581
  *
1581
1582
  * @example
1582
1583
  * ```tsx
package/dist/index.d.ts CHANGED
@@ -1577,6 +1577,7 @@ interface MarkdownMessageProps {
1577
1577
  * - Mermaid diagram rendering
1578
1578
  * - Tables, lists, blockquotes
1579
1579
  * - User/assistant styling modes
1580
+ * - Plain text optimization (skips ReactMarkdown for simple text)
1580
1581
  *
1581
1582
  * @example
1582
1583
  * ```tsx
package/dist/index.mjs CHANGED
@@ -4899,6 +4899,41 @@ var createMarkdownComponents = /* @__PURE__ */ __name((isUser = false, isCompact
4899
4899
  em: /* @__PURE__ */ __name(({ children }) => /* @__PURE__ */ jsx("em", { className: "italic", children }), "em")
4900
4900
  };
4901
4901
  }, "createMarkdownComponents");
4902
+ var hasMarkdownSyntax = /* @__PURE__ */ __name((text) => {
4903
+ const markdownPatterns = [
4904
+ /^#{1,6}\s/m,
4905
+ // Headers
4906
+ /\*\*[^*]+\*\*/,
4907
+ // Bold
4908
+ /\*[^*]+\*/,
4909
+ // Italic
4910
+ /__[^_]+__/,
4911
+ // Bold (underscore)
4912
+ /_[^_]+_/,
4913
+ // Italic (underscore)
4914
+ /\[.+\]\(.+\)/,
4915
+ // Links
4916
+ /!\[.*\]\(.+\)/,
4917
+ // Images
4918
+ /```[\s\S]*```/,
4919
+ // Code blocks
4920
+ /`[^`]+`/,
4921
+ // Inline code
4922
+ /^\s*[-*+]\s/m,
4923
+ // Unordered lists
4924
+ /^\s*\d+\.\s/m,
4925
+ // Ordered lists
4926
+ /^\s*>/m,
4927
+ // Blockquotes
4928
+ /\|.+\|/,
4929
+ // Tables
4930
+ /^---+$/m,
4931
+ // Horizontal rules
4932
+ /~~[^~]+~~/
4933
+ // Strikethrough
4934
+ ];
4935
+ return markdownPatterns.some((pattern) => pattern.test(text));
4936
+ }, "hasMarkdownSyntax");
4902
4937
  var MarkdownMessage = /* @__PURE__ */ __name(({
4903
4938
  content,
4904
4939
  className = "",
@@ -4908,6 +4943,10 @@ var MarkdownMessage = /* @__PURE__ */ __name(({
4908
4943
  const components = React17.useMemo(() => createMarkdownComponents(isUser, isCompact), [isUser, isCompact]);
4909
4944
  const textSizeClass = isCompact ? "text-xs" : "text-sm";
4910
4945
  const proseClass = isCompact ? "prose-xs" : "prose-sm";
4946
+ const isPlainText = !hasMarkdownSyntax(content);
4947
+ if (isPlainText) {
4948
+ return /* @__PURE__ */ jsx("span", { className: `${textSizeClass} leading-relaxed break-words ${className}`, children: content });
4949
+ }
4911
4950
  return /* @__PURE__ */ jsx(
4912
4951
  "div",
4913
4952
  {