@abstractframework/panel-chat 0.1.2 → 0.1.6
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/README.md +2 -2
- package/dist/chat_message_card.js +2 -2
- package/dist/chat_thread.d.ts +1 -1
- package/dist/chat_thread.d.ts.map +1 -1
- package/dist/chat_thread.js +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -7
- package/dist/markdown.d.ts.map +1 -1
- package/dist/markdown.js +6 -2
- package/dist/message_content.js +3 -3
- package/package.json +5 -5
- package/src/panel_chat.css +3 -1
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Declared in `panel-chat/package.json`:
|
|
|
12
12
|
## Install
|
|
13
13
|
|
|
14
14
|
- Workspace: add a dependency on `@abstractframework/panel-chat`
|
|
15
|
-
- npm
|
|
15
|
+
- npm: `npm i @abstractframework/panel-chat`
|
|
16
16
|
|
|
17
17
|
## Exported API
|
|
18
18
|
|
|
@@ -49,7 +49,7 @@ export function ChatView() {
|
|
|
49
49
|
- JSON ⇒ `JsonViewer`
|
|
50
50
|
- otherwise ⇒ `Markdown` (or your `renderMarkdown` override)
|
|
51
51
|
|
|
52
|
-
Markdown is intentionally minimal and implemented in `panel-chat/src/markdown.tsx` (headings 1–
|
|
52
|
+
Markdown is intentionally minimal and implemented in `panel-chat/src/markdown.tsx` (headings 1–5, code fences, lists, tables, blockquotes, hr, emphasis, and optional highlighting).
|
|
53
53
|
|
|
54
54
|
## Styling & theming
|
|
55
55
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useState } from "react";
|
|
3
3
|
import { Icon } from "@abstractframework/ui-kit";
|
|
4
|
-
import { ChatMessageContent } from "./message_content";
|
|
5
|
-
import { copyText } from "./utils";
|
|
4
|
+
import { ChatMessageContent } from "./message_content.js";
|
|
5
|
+
import { copyText } from "./utils.js";
|
|
6
6
|
function _role_ui(m) {
|
|
7
7
|
const role = String(m.role || "").trim().toLowerCase() || "system";
|
|
8
8
|
const kind = String(m.kind || "").trim().toLowerCase();
|
package/dist/chat_thread.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { type ChatMessage, type ChatMessageCardProps } from "./chat_message_card";
|
|
2
|
+
import { type ChatMessage, type ChatMessageCardProps } from "./chat_message_card.js";
|
|
3
3
|
export type ChatThreadProps = {
|
|
4
4
|
messages: ChatMessage[];
|
|
5
5
|
className?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat_thread.d.ts","sourceRoot":"","sources":["../src/chat_thread.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAEpE,OAAO,EAAmB,KAAK,WAAW,EAAE,KAAK,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"chat_thread.d.ts","sourceRoot":"","sources":["../src/chat_thread.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAEpE,OAAO,EAAmB,KAAK,WAAW,EAAE,KAAK,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEtG,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,YAAY,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,SAAS,CAAC,CAAC;CACtD,CAAC;AAQF,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,KAAK,CAAC,YAAY,CAoCrE;AAED,eAAe,UAAU,CAAC"}
|
package/dist/chat_thread.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
-
import { ChatMessageCard } from "./chat_message_card";
|
|
3
|
+
import { ChatMessageCard } from "./chat_message_card.js";
|
|
4
4
|
function is_near_bottom(el, thresholdPx) {
|
|
5
5
|
const thr = Math.max(0, Math.trunc(thresholdPx));
|
|
6
6
|
const remaining = el.scrollHeight - el.scrollTop - el.clientHeight;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { ChatMessageContent } from "./message_content";
|
|
2
|
-
export { ChatComposer } from "./chat_composer";
|
|
3
|
-
export { Markdown } from "./markdown";
|
|
4
|
-
export { JsonViewer } from "./json_viewer";
|
|
5
|
-
export { ChatMessageCard } from "./chat_message_card";
|
|
6
|
-
export { ChatThread } from "./chat_thread";
|
|
7
|
-
export type { PanelChatMessage } from "./types";
|
|
8
|
-
export type { ChatAttachment, ChatMessage, ChatMessageLevel, ChatStat } from "./chat_message_card";
|
|
9
|
-
export { chatToMarkdown, copyText, downloadTextFile, tryParseJson } from "./utils";
|
|
1
|
+
export { ChatMessageContent } from "./message_content.js";
|
|
2
|
+
export { ChatComposer } from "./chat_composer.js";
|
|
3
|
+
export { Markdown } from "./markdown.js";
|
|
4
|
+
export { JsonViewer } from "./json_viewer.js";
|
|
5
|
+
export { ChatMessageCard } from "./chat_message_card.js";
|
|
6
|
+
export { ChatThread } from "./chat_thread.js";
|
|
7
|
+
export type { PanelChatMessage } from "./types.js";
|
|
8
|
+
export type { ChatAttachment, ChatMessage, ChatMessageLevel, ChatStat } from "./chat_message_card.js";
|
|
9
|
+
export { chatToMarkdown, copyText, downloadTextFile, tryParseJson } from "./utils.js";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACtG,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { ChatMessageContent } from "./message_content";
|
|
2
|
-
export { ChatComposer } from "./chat_composer";
|
|
3
|
-
export { Markdown } from "./markdown";
|
|
4
|
-
export { JsonViewer } from "./json_viewer";
|
|
5
|
-
export { ChatMessageCard } from "./chat_message_card";
|
|
6
|
-
export { ChatThread } from "./chat_thread";
|
|
7
|
-
export { chatToMarkdown, copyText, downloadTextFile, tryParseJson } from "./utils";
|
|
1
|
+
export { ChatMessageContent } from "./message_content.js";
|
|
2
|
+
export { ChatComposer } from "./chat_composer.js";
|
|
3
|
+
export { Markdown } from "./markdown.js";
|
|
4
|
+
export { JsonViewer } from "./json_viewer.js";
|
|
5
|
+
export { ChatMessageCard } from "./chat_message_card.js";
|
|
6
|
+
export { ChatThread } from "./chat_thread.js";
|
|
7
|
+
export { chatToMarkdown, copyText, downloadTextFile, tryParseJson } from "./utils.js";
|
package/dist/markdown.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../src/markdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAqI1B,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,SAAS,EACT,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,WAAW,GACZ,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,KAAK,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../src/markdown.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAqI1B,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,SAAS,EACT,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,WAAW,GACZ,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,KAAK,CAAC,YAAY,CAyLrB"}
|
package/dist/markdown.js
CHANGED
|
@@ -162,7 +162,7 @@ export function Markdown({ text, className, highlight, highlights, highlightClas
|
|
|
162
162
|
blocks.push(_jsx("pre", { className: "pc-md_pre", children: _jsx("code", { className: lang ? `language-${lang}` : undefined, children: code }) }, `pre:${i}`));
|
|
163
163
|
continue;
|
|
164
164
|
}
|
|
165
|
-
const headingM = line.match(/^(#{1,
|
|
165
|
+
const headingM = line.match(/^(#{1,5})\s+(.*)$/);
|
|
166
166
|
if (headingM) {
|
|
167
167
|
const level = headingM[1].length;
|
|
168
168
|
const content = headingM[2] || "";
|
|
@@ -171,8 +171,12 @@ export function Markdown({ text, className, highlight, highlights, highlightClas
|
|
|
171
171
|
blocks.push(_jsx("h1", { children: nodes }, `h1:${i}`));
|
|
172
172
|
else if (level === 2)
|
|
173
173
|
blocks.push(_jsx("h2", { children: nodes }, `h2:${i}`));
|
|
174
|
-
else
|
|
174
|
+
else if (level === 3)
|
|
175
175
|
blocks.push(_jsx("h3", { children: nodes }, `h3:${i}`));
|
|
176
|
+
else if (level === 4)
|
|
177
|
+
blocks.push(_jsx("h4", { children: nodes }, `h4:${i}`));
|
|
178
|
+
else
|
|
179
|
+
blocks.push(_jsx("h5", { children: nodes }, `h5:${i}`));
|
|
176
180
|
i += 1;
|
|
177
181
|
continue;
|
|
178
182
|
}
|
package/dist/message_content.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { JsonViewer } from "./json_viewer";
|
|
3
|
-
import { Markdown } from "./markdown";
|
|
4
|
-
import { tryParseJson } from "./utils";
|
|
2
|
+
import { JsonViewer } from "./json_viewer.js";
|
|
3
|
+
import { Markdown } from "./markdown.js";
|
|
4
|
+
import { tryParseJson } from "./utils.js";
|
|
5
5
|
export function ChatMessageContent(props) {
|
|
6
6
|
const text = String(props.text ?? "");
|
|
7
7
|
const parsed = tryParseJson(text);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abstractframework/panel-chat",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Shared chat panel components for AbstractFramework (extracted from AbstractCode; reusable by other UIs).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Laurent-Philippe Albou",
|
|
@@ -39,16 +39,16 @@
|
|
|
39
39
|
"prepublishOnly": "npm run build"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@abstractframework/ui-kit": "^0.1.
|
|
42
|
+
"@abstractframework/ui-kit": "^0.1.6",
|
|
43
43
|
"react": "^18.0.0",
|
|
44
44
|
"react-dom": "^18.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@abstractframework/ui-kit": "^0.1.
|
|
48
|
-
"react": "^18.0.0",
|
|
49
|
-
"react-dom": "^18.0.0",
|
|
47
|
+
"@abstractframework/ui-kit": "^0.1.6",
|
|
50
48
|
"@types/react": "^18.2.48",
|
|
51
49
|
"@types/react-dom": "^18.2.18",
|
|
50
|
+
"react": "^18.0.0",
|
|
51
|
+
"react-dom": "^18.0.0",
|
|
52
52
|
"typescript": "^5.3.3"
|
|
53
53
|
},
|
|
54
54
|
"sideEffects": [
|