@infinilabs/doc-detail 0.0.5 → 0.0.7

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.ts CHANGED
@@ -53,9 +53,6 @@ declare interface DocDetailProps extends HTMLAttributes<HTMLDivElement> {
53
53
  };
54
54
  };
55
55
  i18n?: {
56
- buttons?: {
57
- openSource?: string;
58
- };
59
56
  labels?: {
60
57
  type?: string;
61
58
  size?: string;
@@ -66,8 +63,7 @@ declare interface DocDetailProps extends HTMLAttributes<HTMLDivElement> {
66
63
  aiInterpretation?: string;
67
64
  };
68
65
  };
69
- extraButtons?: ReactNode[];
70
- openSourceButtonProps?: ActionButtonProps;
66
+ actionButtons?: ReactNode[];
71
67
  }
72
68
 
73
69
  declare type MetadataContentType = "image" | "video" | "markdown" | "pdf" | "docx" | "pptx" | "xlsx";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@infinilabs/doc-detail",
3
3
  "private": false,
4
- "version": "0.0.5",
4
+ "version": "0.0.7",
5
5
  "type": "module",
6
6
  "main": "dist/doc-detail.cjs",
7
7
  "module": "dist/doc-detail.js",
package/src/App.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { Bot } from "lucide-react";
1
+ import { Bot, SquareArrowOutUpRight } from "lucide-react";
2
2
  import { ActionButton, DocDetail } from "./components";
3
3
 
4
4
  const App = () => {
@@ -43,6 +43,17 @@ Approximately ten individuals, mostly men with one woman visible, are depicted w
43
43
  ## Relationships and Synthesis
44
44
  The document intertwines physical setting, human activity, and symbolic communication to portray a snapshot of corporate culture. The environment supports the event's purpose, the participants' uniformity reflects organizational cohesion, and the banner bridges corporate messaging with cultural tradition. Together, these elements construct a narrative of a modern, globally-aware company marking a moment of collective planning and aspirational growth.
45
45
 
46
+
47
+ \`\`\`ts
48
+ const analysisSummary = {
49
+ eventContext: "INFINI.com All Hands Meeting in 2023, Year of the Rabbit",
50
+ environment: "Modern conference room with professional yet relaxed atmosphere",
51
+ culturalElements: "Bilingual banner with metaphor for rapid advancement",
52
+ visualDetails: "Cohesive color palette, organized composition, branded attire",
53
+ humanElement: "Team identity through uniform clothing and active engagement",
54
+ };
55
+ \`\`\`
56
+
46
57
  \`\`\`mermaid
47
58
  mindmap
48
59
  root("Document Analysis: 106862408.jpg")
@@ -79,9 +90,11 @@ mindmap
79
90
  created: "2026-01-09T02:30:10.188Z",
80
91
  updated: "2026-01-09T02:30:10.188Z",
81
92
  }}
82
- extraButtons={[
83
- <ActionButton key="bot" icon={<Bot />}>
84
- Continue Chat
93
+ actionButtons={[
94
+ <ActionButton icon={<Bot />}>Continue Chat</ActionButton>,
95
+
96
+ <ActionButton icon={<SquareArrowOutUpRight />}>
97
+ Open Source
85
98
  </ActionButton>,
86
99
  ]}
87
100
  />
@@ -4,8 +4,9 @@ import {
4
4
  type XMarkdownProps,
5
5
  } from "@ant-design/x-markdown";
6
6
  import { useEffect, useState, type FC } from "react";
7
- import { Mermaid } from "@ant-design/x";
7
+ import { Mermaid, CodeHighlighter } from "@ant-design/x";
8
8
  import { Typography } from "antd";
9
+ import clsx from "clsx";
9
10
 
10
11
  const { Text } = Typography;
11
12
 
@@ -19,6 +20,10 @@ const Code: FC<ComponentProps> = (props) => {
19
20
  return <Mermaid>{children}</Mermaid>;
20
21
  }
21
22
 
23
+ if (lang) {
24
+ return <CodeHighlighter lang={lang}>{children}</CodeHighlighter>;
25
+ }
26
+
22
27
  return <Text code>{children}</Text>;
23
28
  };
24
29
 
@@ -27,7 +32,7 @@ interface MarkdownProps extends XMarkdownProps {
27
32
  }
28
33
 
29
34
  const Markdown: FC<MarkdownProps> = (props) => {
30
- const { url, ...rest } = props;
35
+ const { url, className, ...rest } = props;
31
36
 
32
37
  const [content, setContent] = useState(rest.content);
33
38
 
@@ -45,7 +50,14 @@ const Markdown: FC<MarkdownProps> = (props) => {
45
50
  fetchContent(url);
46
51
  }, [url]);
47
52
 
48
- return <XMarkdown {...rest} content={content} components={{ code: Code }} />;
53
+ return (
54
+ <XMarkdown
55
+ {...rest}
56
+ className={clsx("[&_h1,h2,h3,h4,h5,h6,ul,ol,p]:[all:revert]", className)}
57
+ content={content}
58
+ components={{ code: Code }}
59
+ />
60
+ );
49
61
  };
50
62
 
51
63
  export default Markdown;
@@ -1,18 +1,17 @@
1
1
  import { Typography } from "antd";
2
- import {
3
- ChevronRight,
4
- Dot,
5
- Ellipsis,
6
- Minus,
7
- SquareArrowOutUpRight,
8
- } from "lucide-react";
2
+ import { ChevronRight, Dot, Ellipsis, Minus } from "lucide-react";
9
3
  import { motion } from "motion/react";
10
4
 
11
- import { useState, type FC, type HTMLAttributes, type ReactNode } from "react";
5
+ import {
6
+ Fragment,
7
+ useState,
8
+ type FC,
9
+ type HTMLAttributes,
10
+ type ReactNode,
11
+ } from "react";
12
12
  import Preview from "./components/Preview";
13
13
  import AIInterpretation from "./components/AIInterpretation";
14
14
  import { cn } from "@/utils/cn";
15
- import ActionButton, { type ActionButtonProps } from "../ActionButton";
16
15
 
17
16
  const { Text } = Typography;
18
17
 
@@ -69,9 +68,6 @@ export interface DocDetailProps extends HTMLAttributes<HTMLDivElement> {
69
68
  };
70
69
  };
71
70
  i18n?: {
72
- buttons?: {
73
- openSource?: string;
74
- };
75
71
  labels?: {
76
72
  type?: string;
77
73
  size?: string;
@@ -82,19 +78,11 @@ export interface DocDetailProps extends HTMLAttributes<HTMLDivElement> {
82
78
  aiInterpretation?: string;
83
79
  };
84
80
  };
85
- extraButtons?: ReactNode[];
86
- openSourceButtonProps?: ActionButtonProps;
81
+ actionButtons?: ReactNode[];
87
82
  }
88
83
 
89
84
  const DocDetail: FC<DocDetailProps> = (props) => {
90
- const {
91
- data,
92
- i18n,
93
- extraButtons,
94
- className,
95
- openSourceButtonProps,
96
- ...rest
97
- } = props;
85
+ const { data, i18n, actionButtons, className, ...rest } = props;
98
86
 
99
87
  const [visibleMore, setVisibleMore] = useState(false);
100
88
 
@@ -154,17 +142,9 @@ const DocDetail: FC<DocDetailProps> = (props) => {
154
142
  </Text>
155
143
 
156
144
  <div className="inline-flex gap-2">
157
- {extraButtons}
158
-
159
- <ActionButton
160
- icon={<SquareArrowOutUpRight />}
161
- onClick={() => {
162
- window.open(data.url);
163
- }}
164
- {...openSourceButtonProps}
165
- >
166
- {i18n?.buttons?.openSource ?? "Open Source"}
167
- </ActionButton>
145
+ {actionButtons?.map((button, index) => (
146
+ <Fragment key={index}>{button}</Fragment>
147
+ ))}
168
148
  </div>
169
149
  </div>
170
150