@haklex/rich-ext-chat 0.5.0 → 0.6.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.
- package/README.md +106 -0
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# @haklex/rich-ext-chat
|
|
2
|
+
|
|
3
|
+
Static chat-snapshot blocks for assistant / conversation transcripts. Renders multi-participant message lists with variant-aware bubble styling.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @haklex/rich-ext-chat
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Peer Dependencies
|
|
12
|
+
|
|
13
|
+
| Package | Version |
|
|
14
|
+
| --------- | --------- |
|
|
15
|
+
| `lexical` | `^0.44.0` |
|
|
16
|
+
| `react` | `>= 19` |
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
### Register nodes
|
|
21
|
+
|
|
22
|
+
Edit (read + write):
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { chatEditNodes } from '@haklex/rich-ext-chat/edit';
|
|
26
|
+
|
|
27
|
+
const editorConfig = { nodes: [...chatEditNodes] };
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Static / read-only:
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { chatNodes } from '@haklex/rich-ext-chat/node';
|
|
34
|
+
|
|
35
|
+
const staticConfig = { nodes: [...chatNodes] };
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Use renderers
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { ChatEditRenderer } from '@haklex/rich-ext-chat/edit';
|
|
42
|
+
import { ChatRenderer } from '@haklex/rich-ext-chat/renderer';
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Tree-shake the default renderer
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { CHAT_NODE_KEY, chatNodes } from '@haklex/rich-ext-chat/node';
|
|
49
|
+
import type { RichRendererModule } from '@haklex/rich-compose';
|
|
50
|
+
|
|
51
|
+
const lightModule: RichRendererModule = {
|
|
52
|
+
name: 'chat',
|
|
53
|
+
nodes: chatNodes,
|
|
54
|
+
renderers: { [CHAT_NODE_KEY]: MyLightChat },
|
|
55
|
+
};
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Import styles
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
import '@haklex/rich-ext-chat/style.css';
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Exports
|
|
65
|
+
|
|
66
|
+
### Nodes
|
|
67
|
+
|
|
68
|
+
- `ChatNode` -- static (read-only) node
|
|
69
|
+
- `ChatEditNode` -- edit node
|
|
70
|
+
- `$createChatNode()` / `$isChatNode()` -- Lexical helpers
|
|
71
|
+
- `chatNodes` -- array of static nodes for config registration
|
|
72
|
+
- `chatEditNodes` -- array of edit nodes for config registration
|
|
73
|
+
|
|
74
|
+
### Renderers
|
|
75
|
+
|
|
76
|
+
- `ChatRenderer` -- static renderer
|
|
77
|
+
- `ChatEditRenderer` -- edit renderer with participant management
|
|
78
|
+
|
|
79
|
+
### Slot Key
|
|
80
|
+
|
|
81
|
+
- `CHAT_NODE_KEY` -- `'Chat'` constant for `RendererConfig` slot lookup
|
|
82
|
+
|
|
83
|
+
### Types
|
|
84
|
+
|
|
85
|
+
- `ChatMessage`, `ChatParticipant`, `ChatParticipantKind`, `ChatVariant`
|
|
86
|
+
- `ChatRendererProps` (also flowed into `RendererConfig.Chat` via module augmentation)
|
|
87
|
+
- `SerializedChatNode`
|
|
88
|
+
|
|
89
|
+
## Sub-path Exports
|
|
90
|
+
|
|
91
|
+
| Path | Description |
|
|
92
|
+
| --------------------------------- | --------------------------------------------------------- |
|
|
93
|
+
| `@haklex/rich-ext-chat` | Full exports (node + renderer + edit) |
|
|
94
|
+
| `@haklex/rich-ext-chat/node` | Lightweight node + slot key + types — no default renderer |
|
|
95
|
+
| `@haklex/rich-ext-chat/renderer` | Default `ChatRenderer` (heavy) |
|
|
96
|
+
| `@haklex/rich-ext-chat/edit` | Edit-mode node + `ChatEditRenderer` |
|
|
97
|
+
| `@haklex/rich-ext-chat/static` | Convenience: node + renderer (SSR bundle) |
|
|
98
|
+
| `@haklex/rich-ext-chat/style.css` | Stylesheet |
|
|
99
|
+
|
|
100
|
+
## Part of Haklex
|
|
101
|
+
|
|
102
|
+
This package is part of the [Haklex](../../README.md) rich editor ecosystem.
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haklex/rich-ext-chat",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Static chat-snapshot node for the haklex rich editor",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -53,15 +53,15 @@
|
|
|
53
53
|
"typescript": "^5.9.3",
|
|
54
54
|
"vite": "^8.0.10",
|
|
55
55
|
"vite-plugin-dts": "^4.5.4",
|
|
56
|
-
"@haklex/rich-editor": "0.
|
|
56
|
+
"@haklex/rich-editor": "0.6.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"lexical": "^0.44.0",
|
|
60
60
|
"lucide-react": "^1.0.0",
|
|
61
61
|
"react": ">=19",
|
|
62
|
-
"@haklex/rich-editor": "0.
|
|
63
|
-
"@haklex/rich-editor-ui": "0.
|
|
64
|
-
"@haklex/rich-style-token": "0.
|
|
62
|
+
"@haklex/rich-editor": "0.6.0",
|
|
63
|
+
"@haklex/rich-editor-ui": "0.6.0",
|
|
64
|
+
"@haklex/rich-style-token": "0.6.0"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|