botchan 0.1.1 → 0.2.0

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.
@@ -630,9 +630,10 @@ function parsePostContent(text) {
630
630
  const body = text.slice(firstNewline + 1).trim();
631
631
  return { title, body: body || null };
632
632
  }
633
- function truncateTitle(title, maxLength = 70) {
634
- if (title.length <= maxLength) return title;
635
- return title.slice(0, maxLength - 3) + "...";
633
+ function truncateText(text, maxLength = 250) {
634
+ const trimmed = text.trim();
635
+ if (trimmed.length <= maxLength) return trimmed;
636
+ return trimmed.slice(0, maxLength - 3) + "...";
636
637
  }
637
638
  function PostList({
638
639
  feedName,
@@ -686,7 +687,7 @@ function PostList({
686
687
  const postKey = `${post.sender}:${post.timestamp}`;
687
688
  const commentCount = commentCounts.get(postKey) ?? 0;
688
689
  const { title, body } = parsePostContent(post.text);
689
- const displayTitle = title ? truncateTitle(title) : null;
690
+ const displayTitle = title ? truncateText(title) : null;
690
691
  const hasMore = body !== null;
691
692
  return /* @__PURE__ */ jsxs(
692
693
  Box,
@@ -741,10 +742,10 @@ function formatTimestamp2(timestamp) {
741
742
  minute: "2-digit"
742
743
  });
743
744
  }
744
- function collapseText(text, maxLength = 80) {
745
- const collapsed = text.replace(/\s+/g, " ").trim();
746
- if (collapsed.length <= maxLength) return collapsed;
747
- return collapsed.slice(0, maxLength - 3) + "...";
745
+ function truncateText2(text, maxLength = 500) {
746
+ const trimmed = text.trim();
747
+ if (trimmed.length <= maxLength) return trimmed;
748
+ return trimmed.slice(0, maxLength - 3) + "...";
748
749
  }
749
750
  function getTextLines(text, width) {
750
751
  const lines = [];
@@ -845,7 +846,7 @@ function CommentTree({
845
846
  const { comment, depth } = item;
846
847
  const key = `${comment.sender}:${comment.timestamp}`;
847
848
  const replyCount = replyCounts.get(key) ?? 0;
848
- const displayText = comment.text ? collapseText(comment.text) : null;
849
+ const displayText = comment.text ? truncateText2(comment.text) : null;
849
850
  const indent = " ".repeat(depth);
850
851
  const replyIndicator = depth > 0 ? "\u21B3 " : "";
851
852
  return /* @__PURE__ */ jsxs(