@agentiffai/design 1.3.11 → 1.3.13

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
@@ -2820,6 +2820,24 @@ function ItemWithLogs({
2820
2820
  isExpanded && /* @__PURE__ */ jsxRuntime.jsx(ItemDisclosurePanel, { children: run.customContent ? (
2821
2821
  // Render custom content directly
2822
2822
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { padding: "16px" }, children: run.customContent })
2823
+ ) : run.logsLoading ? (
2824
+ // Show loading spinner while logs are being fetched
2825
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", justifyContent: "center", padding: "16px" }, children: [
2826
+ /* @__PURE__ */ jsxRuntime.jsx(
2827
+ "div",
2828
+ {
2829
+ style: {
2830
+ width: "24px",
2831
+ height: "24px",
2832
+ border: `2px solid ${tokens.colors.border.default}`,
2833
+ borderTopColor: tokens.colors.primary,
2834
+ borderRadius: "50%",
2835
+ animation: "spin 1s linear infinite"
2836
+ }
2837
+ }
2838
+ ),
2839
+ /* @__PURE__ */ jsxRuntime.jsx("style", { children: `@keyframes spin { to { transform: rotate(360deg); } }` })
2840
+ ] })
2823
2841
  ) : run.logs && run.logs.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(DarkNotificationCard, { sections: logSections }) : /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: tokens.colors.text.tertiary, fontSize: "13px", padding: "8px" }, children: "No action logs available" }) })
2824
2842
  ] });
2825
2843
  }
@@ -5446,6 +5464,59 @@ var Input2 = ({
5446
5464
  )
5447
5465
  ] }) });
5448
5466
  };
5467
+ function parseMarkdown(text) {
5468
+ if (!text) return [];
5469
+ const elements = [];
5470
+ let key = 0;
5471
+ const paragraphs = text.split(/\n\n+/);
5472
+ paragraphs.forEach((paragraph, pIndex) => {
5473
+ if (pIndex > 0) {
5474
+ elements.push(/* @__PURE__ */ jsxRuntime.jsx("br", {}, key++));
5475
+ elements.push(/* @__PURE__ */ jsxRuntime.jsx("br", {}, key++));
5476
+ }
5477
+ const lines = paragraph.split("\n");
5478
+ lines.forEach((line, lineIndex) => {
5479
+ if (lineIndex > 0) {
5480
+ elements.push(/* @__PURE__ */ jsxRuntime.jsx("br", {}, key++));
5481
+ }
5482
+ const parsed = parseInlineMarkdown(line, key);
5483
+ elements.push(...parsed.elements);
5484
+ key = parsed.nextKey;
5485
+ });
5486
+ });
5487
+ return elements;
5488
+ }
5489
+ function parseInlineMarkdown(text, startKey) {
5490
+ const elements = [];
5491
+ let key = startKey;
5492
+ const inlineRegex = /(\*\*(.+?)\*\*)|(\*(.+?)\*)|(`([^`]+)`)|(\[([^\]]+)\]\(([^)]+)\))/g;
5493
+ let lastIndex = 0;
5494
+ let match;
5495
+ while ((match = inlineRegex.exec(text)) !== null) {
5496
+ if (match.index > lastIndex) {
5497
+ elements.push(text.slice(lastIndex, match.index));
5498
+ }
5499
+ if (match[1]) {
5500
+ elements.push(/* @__PURE__ */ jsxRuntime.jsx("strong", { children: match[2] }, key++));
5501
+ } else if (match[3]) {
5502
+ elements.push(/* @__PURE__ */ jsxRuntime.jsx("em", { children: match[4] }, key++));
5503
+ } else if (match[5]) {
5504
+ elements.push(/* @__PURE__ */ jsxRuntime.jsx("code", { children: match[6] }, key++));
5505
+ } else if (match[7]) {
5506
+ elements.push(
5507
+ /* @__PURE__ */ jsxRuntime.jsx("a", { href: match[9], target: "_blank", rel: "noopener noreferrer", children: match[8] }, key++)
5508
+ );
5509
+ }
5510
+ lastIndex = match.index + match[0].length;
5511
+ }
5512
+ if (lastIndex < text.length) {
5513
+ elements.push(text.slice(lastIndex));
5514
+ }
5515
+ if (elements.length === 0) {
5516
+ elements.push(text);
5517
+ }
5518
+ return { elements, nextKey: key };
5519
+ }
5449
5520
  var Container12 = styled47__default.default.div`
5450
5521
  font-family: ${(props) => props.$variant === "code" ? tokens.typography.fontFamily.monospace : tokens.typography.fontFamily.primary};
5451
5522
  white-space: pre-wrap;
@@ -5454,6 +5525,33 @@ var Container12 = styled47__default.default.div`
5454
5525
  /* Performance optimizations for streaming text */
5455
5526
  text-rendering: optimizeSpeed;
5456
5527
  contain: content;
5528
+
5529
+ /* Markdown element styles */
5530
+ strong {
5531
+ font-weight: ${tokens.typography.fontWeight.bold};
5532
+ color: ${tokens.colors.text.primary};
5533
+ }
5534
+
5535
+ em {
5536
+ font-style: italic;
5537
+ }
5538
+
5539
+ code {
5540
+ font-family: ${tokens.typography.fontFamily.monospace};
5541
+ background: ${tokens.colors.surface.overlay};
5542
+ padding: 0.15em 0.4em;
5543
+ border-radius: ${tokens.borderRadius.sm};
5544
+ font-size: 0.9em;
5545
+ }
5546
+
5547
+ a {
5548
+ color: ${tokens.colors.primary};
5549
+ text-decoration: none;
5550
+
5551
+ &:hover {
5552
+ text-decoration: underline;
5553
+ }
5554
+ }
5457
5555
  `;
5458
5556
  var Cursor = styled47__default.default.span`
5459
5557
  display: inline-block;
@@ -5498,8 +5596,14 @@ var StreamingTextBase = ({
5498
5596
  wasStreamingRef.current = isStreaming;
5499
5597
  }, [isStreaming, onStreamComplete]);
5500
5598
  const showCursor = isStreaming && cursor;
5599
+ const renderedContent = react.useMemo(() => {
5600
+ if (variant === "markdown") {
5601
+ return parseMarkdown(content);
5602
+ }
5603
+ return content;
5604
+ }, [content, variant]);
5501
5605
  return /* @__PURE__ */ jsxRuntime.jsxs(Container12, { $variant: variant, className, children: [
5502
- content,
5606
+ renderedContent,
5503
5607
  showCursor && /* @__PURE__ */ jsxRuntime.jsx(Cursor, {})
5504
5608
  ] });
5505
5609
  };
@@ -6103,27 +6207,6 @@ var ActionsContainer3 = styled47__default.default.div`
6103
6207
  gap: ${tokens.spacing.xs};
6104
6208
  flex-wrap: wrap;
6105
6209
  `;
6106
- var StreamingIndicator2 = styled47__default.default.span`
6107
- display: inline-block;
6108
- width: ${tokens.spacing.xs};
6109
- height: ${tokens.spacing.xs};
6110
- margin-left: ${tokens.spacing.xs};
6111
- background-color: ${tokens.colors.text.tertiary};
6112
- border-radius: ${tokens.borderRadius.full};
6113
- animation: pulse 1.5s ease-in-out infinite;
6114
-
6115
- @keyframes pulse {
6116
- 0%,
6117
- 100% {
6118
- opacity: 0.3;
6119
- transform: scale(0.8);
6120
- }
6121
- 50% {
6122
- opacity: 1;
6123
- transform: scale(1.2);
6124
- }
6125
- }
6126
- `;
6127
6210
  var Avatar3 = styled47__default.default.img`
6128
6211
  width: ${tokens.spacing.xl};
6129
6212
  height: ${tokens.spacing.xl};
@@ -6139,15 +6222,21 @@ var UserMessage2 = ({
6139
6222
  avatarUrl,
6140
6223
  username,
6141
6224
  isStreaming = false,
6142
- actions = []
6225
+ actions = [],
6226
+ enableMarkdown = true
6143
6227
  }) => {
6144
6228
  return /* @__PURE__ */ jsxRuntime.jsxs(StyledUserMessage2, { className, children: [
6145
6229
  /* @__PURE__ */ jsxRuntime.jsxs(MessageBubble, { children: [
6146
6230
  username && /* @__PURE__ */ jsxRuntime.jsx("strong", { children: username }),
6147
- /* @__PURE__ */ jsxRuntime.jsxs(MessageContent2, { children: [
6148
- content,
6149
- isStreaming && /* @__PURE__ */ jsxRuntime.jsx(StreamingIndicator2, {})
6150
- ] }),
6231
+ /* @__PURE__ */ jsxRuntime.jsx(MessageContent2, { children: /* @__PURE__ */ jsxRuntime.jsx(
6232
+ StreamingText2,
6233
+ {
6234
+ content,
6235
+ isStreaming,
6236
+ variant: enableMarkdown ? "markdown" : "default",
6237
+ cursor: false
6238
+ }
6239
+ ) }),
6151
6240
  timestamp && /* @__PURE__ */ jsxRuntime.jsx(MessageTime2, { children: timestamp }),
6152
6241
  actions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(ActionsContainer3, { children: actions.map((action, index) => /* @__PURE__ */ jsxRuntime.jsxs(ActionButton4, { onClick: action.onClick, children: [
6153
6242
  action.icon,
@@ -7874,6 +7963,7 @@ var CATEGORY_CONFIGS = {
7874
7963
  }
7875
7964
  };
7876
7965
  function categorizeProgress(message) {
7966
+ if (!message) return "setup";
7877
7967
  if (message.includes("Notion")) return "notion";
7878
7968
  if (message.includes("prompts") || message.includes("Loading")) return "setup";
7879
7969
  if (message.includes("accounts") || message.includes("Fetching connected")) return "integration";
@@ -7890,6 +7980,7 @@ function getCategoryColor(category) {
7890
7980
  return CATEGORY_CONFIGS[category]?.color ?? "bg-gray-500";
7891
7981
  }
7892
7982
  function normalizePlatform(platform) {
7983
+ if (!platform) return null;
7893
7984
  const normalized = platform.toLowerCase();
7894
7985
  if (normalized === "twitter") return "x";
7895
7986
  if (Object.keys(PLATFORM_CONFIGS).includes(normalized)) {
@@ -9138,6 +9229,7 @@ var SUBREDDIT_COLORS = {
9138
9229
  startups: tokens.colors.seaGreen
9139
9230
  };
9140
9231
  function getSubredditColor(subreddit) {
9232
+ if (!subreddit) return REDDIT_COLORS.orange;
9141
9233
  const lower = subreddit.toLowerCase();
9142
9234
  return SUBREDDIT_COLORS[lower] || REDDIT_COLORS.orange;
9143
9235
  }