@gendive/chatllm 0.16.0 → 0.16.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/react/index.js +84 -31
- package/dist/react/index.js.map +1 -1
- package/dist/react/index.mjs +84 -31
- package/dist/react/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react/index.mjs
CHANGED
|
@@ -3831,11 +3831,10 @@ var ChatSidebar = ({
|
|
|
3831
3831
|
style: {
|
|
3832
3832
|
fontSize: "14px",
|
|
3833
3833
|
fontWeight: 700,
|
|
3834
|
-
textTransform: "uppercase",
|
|
3835
3834
|
letterSpacing: "-0.01em",
|
|
3836
3835
|
color: "var(--chatllm-text)"
|
|
3837
3836
|
},
|
|
3838
|
-
children: "
|
|
3837
|
+
children: "AI \uCC44\uD305"
|
|
3839
3838
|
}
|
|
3840
3839
|
)
|
|
3841
3840
|
] })
|
|
@@ -5507,45 +5506,99 @@ var parseTableRow = (row) => {
|
|
|
5507
5506
|
return row.split("|").slice(1, -1).map((cell) => cell.trim());
|
|
5508
5507
|
};
|
|
5509
5508
|
var MarkdownTable = ({ data }) => {
|
|
5509
|
+
const [copied, setCopied] = React6.useState(false);
|
|
5510
|
+
const [isHovered, setIsHovered] = React6.useState(false);
|
|
5511
|
+
const handleCopy = async () => {
|
|
5512
|
+
const headerLine = data.headers.join(" ");
|
|
5513
|
+
const bodyLines = data.rows.map((row) => row.join(" "));
|
|
5514
|
+
const text = [headerLine, ...bodyLines].join("\n");
|
|
5515
|
+
try {
|
|
5516
|
+
await navigator.clipboard.writeText(text);
|
|
5517
|
+
setCopied(true);
|
|
5518
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
5519
|
+
} catch {
|
|
5520
|
+
console.error("Failed to copy table");
|
|
5521
|
+
}
|
|
5522
|
+
};
|
|
5510
5523
|
return /* @__PURE__ */ jsxs6(
|
|
5511
|
-
"
|
|
5524
|
+
"div",
|
|
5512
5525
|
{
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
borderCollapse: "collapse",
|
|
5517
|
-
margin: "12px 0",
|
|
5518
|
-
fontSize: "14px"
|
|
5519
|
-
},
|
|
5526
|
+
style: { position: "relative", margin: "12px 0" },
|
|
5527
|
+
onMouseEnter: () => setIsHovered(true),
|
|
5528
|
+
onMouseLeave: () => setIsHovered(false),
|
|
5520
5529
|
children: [
|
|
5521
|
-
/* @__PURE__ */
|
|
5522
|
-
"
|
|
5530
|
+
/* @__PURE__ */ jsxs6(
|
|
5531
|
+
"table",
|
|
5523
5532
|
{
|
|
5533
|
+
className: "chatllm-table",
|
|
5524
5534
|
style: {
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
backgroundColor: "var(--chatllm-bg-secondary, #f9fafb)",
|
|
5529
|
-
fontWeight: 600,
|
|
5530
|
-
color: "var(--chatllm-text, #374151)"
|
|
5535
|
+
width: "100%",
|
|
5536
|
+
borderCollapse: "collapse",
|
|
5537
|
+
fontSize: "14px"
|
|
5531
5538
|
},
|
|
5532
|
-
children:
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5539
|
+
children: [
|
|
5540
|
+
/* @__PURE__ */ jsx7("thead", { children: /* @__PURE__ */ jsx7("tr", { children: data.headers.map((header, i) => /* @__PURE__ */ jsx7(
|
|
5541
|
+
"th",
|
|
5542
|
+
{
|
|
5543
|
+
style: {
|
|
5544
|
+
border: "1px solid var(--chatllm-border, #e5e7eb)",
|
|
5545
|
+
padding: "10px 12px",
|
|
5546
|
+
textAlign: data.alignments[i] || "left",
|
|
5547
|
+
backgroundColor: "var(--chatllm-bg-secondary, #f9fafb)",
|
|
5548
|
+
fontWeight: 600,
|
|
5549
|
+
color: "var(--chatllm-text, #374151)"
|
|
5550
|
+
},
|
|
5551
|
+
children: parseInlineElements(header, `th-${i}`)
|
|
5552
|
+
},
|
|
5553
|
+
i
|
|
5554
|
+
)) }) }),
|
|
5555
|
+
/* @__PURE__ */ jsx7("tbody", { children: data.rows.map((row, rowIndex) => /* @__PURE__ */ jsx7("tr", { children: row.map((cell, cellIndex) => /* @__PURE__ */ jsx7(
|
|
5556
|
+
"td",
|
|
5557
|
+
{
|
|
5558
|
+
style: {
|
|
5559
|
+
border: "1px solid var(--chatllm-border, #e5e7eb)",
|
|
5560
|
+
padding: "10px 12px",
|
|
5561
|
+
textAlign: data.alignments[cellIndex] || "left",
|
|
5562
|
+
color: "var(--chatllm-text, #374151)"
|
|
5563
|
+
},
|
|
5564
|
+
children: parseInlineElements(cell, `td-${rowIndex}-${cellIndex}`)
|
|
5565
|
+
},
|
|
5566
|
+
cellIndex
|
|
5567
|
+
)) }, rowIndex)) })
|
|
5568
|
+
]
|
|
5569
|
+
}
|
|
5570
|
+
),
|
|
5571
|
+
/* @__PURE__ */ jsxs6(
|
|
5572
|
+
"button",
|
|
5538
5573
|
{
|
|
5574
|
+
onClick: handleCopy,
|
|
5539
5575
|
style: {
|
|
5576
|
+
position: "absolute",
|
|
5577
|
+
top: "4px",
|
|
5578
|
+
right: "4px",
|
|
5579
|
+
padding: "4px 8px",
|
|
5580
|
+
fontSize: "12px",
|
|
5581
|
+
backgroundColor: "var(--chatllm-bg, #ffffff)",
|
|
5540
5582
|
border: "1px solid var(--chatllm-border, #e5e7eb)",
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
color: "var(--chatllm-text, #
|
|
5583
|
+
borderRadius: "6px",
|
|
5584
|
+
cursor: "pointer",
|
|
5585
|
+
color: copied ? "var(--chatllm-success, #22c55e)" : "var(--chatllm-text-muted, #9ca3af)",
|
|
5586
|
+
opacity: isHovered || copied ? 1 : 0,
|
|
5587
|
+
transition: "opacity 0.15s",
|
|
5588
|
+
display: "flex",
|
|
5589
|
+
alignItems: "center",
|
|
5590
|
+
gap: "4px",
|
|
5591
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.08)"
|
|
5544
5592
|
},
|
|
5545
|
-
children:
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5593
|
+
children: [
|
|
5594
|
+
/* @__PURE__ */ jsx7("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: copied ? /* @__PURE__ */ jsx7("polyline", { points: "20 6 9 17 4 12" }) : /* @__PURE__ */ jsxs6(Fragment4, { children: [
|
|
5595
|
+
/* @__PURE__ */ jsx7("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
|
|
5596
|
+
/* @__PURE__ */ jsx7("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
5597
|
+
] }) }),
|
|
5598
|
+
copied ? "\uBCF5\uC0AC\uB428" : "\uBCF5\uC0AC"
|
|
5599
|
+
]
|
|
5600
|
+
}
|
|
5601
|
+
)
|
|
5549
5602
|
]
|
|
5550
5603
|
}
|
|
5551
5604
|
);
|