@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.js
CHANGED
|
@@ -3897,11 +3897,10 @@ var ChatSidebar = ({
|
|
|
3897
3897
|
style: {
|
|
3898
3898
|
fontSize: "14px",
|
|
3899
3899
|
fontWeight: 700,
|
|
3900
|
-
textTransform: "uppercase",
|
|
3901
3900
|
letterSpacing: "-0.01em",
|
|
3902
3901
|
color: "var(--chatllm-text)"
|
|
3903
3902
|
},
|
|
3904
|
-
children: "
|
|
3903
|
+
children: "AI \uCC44\uD305"
|
|
3905
3904
|
}
|
|
3906
3905
|
)
|
|
3907
3906
|
] })
|
|
@@ -5573,45 +5572,99 @@ var parseTableRow = (row) => {
|
|
|
5573
5572
|
return row.split("|").slice(1, -1).map((cell) => cell.trim());
|
|
5574
5573
|
};
|
|
5575
5574
|
var MarkdownTable = ({ data }) => {
|
|
5575
|
+
const [copied, setCopied] = import_react11.default.useState(false);
|
|
5576
|
+
const [isHovered, setIsHovered] = import_react11.default.useState(false);
|
|
5577
|
+
const handleCopy = async () => {
|
|
5578
|
+
const headerLine = data.headers.join(" ");
|
|
5579
|
+
const bodyLines = data.rows.map((row) => row.join(" "));
|
|
5580
|
+
const text = [headerLine, ...bodyLines].join("\n");
|
|
5581
|
+
try {
|
|
5582
|
+
await navigator.clipboard.writeText(text);
|
|
5583
|
+
setCopied(true);
|
|
5584
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
5585
|
+
} catch {
|
|
5586
|
+
console.error("Failed to copy table");
|
|
5587
|
+
}
|
|
5588
|
+
};
|
|
5576
5589
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
5577
|
-
"
|
|
5590
|
+
"div",
|
|
5578
5591
|
{
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
borderCollapse: "collapse",
|
|
5583
|
-
margin: "12px 0",
|
|
5584
|
-
fontSize: "14px"
|
|
5585
|
-
},
|
|
5592
|
+
style: { position: "relative", margin: "12px 0" },
|
|
5593
|
+
onMouseEnter: () => setIsHovered(true),
|
|
5594
|
+
onMouseLeave: () => setIsHovered(false),
|
|
5586
5595
|
children: [
|
|
5587
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.
|
|
5588
|
-
"
|
|
5596
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
5597
|
+
"table",
|
|
5589
5598
|
{
|
|
5599
|
+
className: "chatllm-table",
|
|
5590
5600
|
style: {
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
backgroundColor: "var(--chatllm-bg-secondary, #f9fafb)",
|
|
5595
|
-
fontWeight: 600,
|
|
5596
|
-
color: "var(--chatllm-text, #374151)"
|
|
5601
|
+
width: "100%",
|
|
5602
|
+
borderCollapse: "collapse",
|
|
5603
|
+
fontSize: "14px"
|
|
5597
5604
|
},
|
|
5598
|
-
children:
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
|
|
5603
|
-
|
|
5605
|
+
children: [
|
|
5606
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("tr", { children: data.headers.map((header, i) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5607
|
+
"th",
|
|
5608
|
+
{
|
|
5609
|
+
style: {
|
|
5610
|
+
border: "1px solid var(--chatllm-border, #e5e7eb)",
|
|
5611
|
+
padding: "10px 12px",
|
|
5612
|
+
textAlign: data.alignments[i] || "left",
|
|
5613
|
+
backgroundColor: "var(--chatllm-bg-secondary, #f9fafb)",
|
|
5614
|
+
fontWeight: 600,
|
|
5615
|
+
color: "var(--chatllm-text, #374151)"
|
|
5616
|
+
},
|
|
5617
|
+
children: parseInlineElements(header, `th-${i}`)
|
|
5618
|
+
},
|
|
5619
|
+
i
|
|
5620
|
+
)) }) }),
|
|
5621
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("tbody", { children: data.rows.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("tr", { children: row.map((cell, cellIndex) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
5622
|
+
"td",
|
|
5623
|
+
{
|
|
5624
|
+
style: {
|
|
5625
|
+
border: "1px solid var(--chatllm-border, #e5e7eb)",
|
|
5626
|
+
padding: "10px 12px",
|
|
5627
|
+
textAlign: data.alignments[cellIndex] || "left",
|
|
5628
|
+
color: "var(--chatllm-text, #374151)"
|
|
5629
|
+
},
|
|
5630
|
+
children: parseInlineElements(cell, `td-${rowIndex}-${cellIndex}`)
|
|
5631
|
+
},
|
|
5632
|
+
cellIndex
|
|
5633
|
+
)) }, rowIndex)) })
|
|
5634
|
+
]
|
|
5635
|
+
}
|
|
5636
|
+
),
|
|
5637
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
5638
|
+
"button",
|
|
5604
5639
|
{
|
|
5640
|
+
onClick: handleCopy,
|
|
5605
5641
|
style: {
|
|
5642
|
+
position: "absolute",
|
|
5643
|
+
top: "4px",
|
|
5644
|
+
right: "4px",
|
|
5645
|
+
padding: "4px 8px",
|
|
5646
|
+
fontSize: "12px",
|
|
5647
|
+
backgroundColor: "var(--chatllm-bg, #ffffff)",
|
|
5606
5648
|
border: "1px solid var(--chatllm-border, #e5e7eb)",
|
|
5607
|
-
|
|
5608
|
-
|
|
5609
|
-
color: "var(--chatllm-text, #
|
|
5649
|
+
borderRadius: "6px",
|
|
5650
|
+
cursor: "pointer",
|
|
5651
|
+
color: copied ? "var(--chatllm-success, #22c55e)" : "var(--chatllm-text-muted, #9ca3af)",
|
|
5652
|
+
opacity: isHovered || copied ? 1 : 0,
|
|
5653
|
+
transition: "opacity 0.15s",
|
|
5654
|
+
display: "flex",
|
|
5655
|
+
alignItems: "center",
|
|
5656
|
+
gap: "4px",
|
|
5657
|
+
boxShadow: "0 1px 3px rgba(0,0,0,0.08)"
|
|
5610
5658
|
},
|
|
5611
|
-
children:
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5659
|
+
children: [
|
|
5660
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: copied ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("polyline", { points: "20 6 9 17 4 12" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
5661
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
|
|
5662
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
5663
|
+
] }) }),
|
|
5664
|
+
copied ? "\uBCF5\uC0AC\uB428" : "\uBCF5\uC0AC"
|
|
5665
|
+
]
|
|
5666
|
+
}
|
|
5667
|
+
)
|
|
5615
5668
|
]
|
|
5616
5669
|
}
|
|
5617
5670
|
);
|