@langchain/macaw-components 1.7.2 → 1.7.4
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/catalog.json +730 -713
- package/dist/components/Code/codeLanguages.js +4 -3
- package/dist/components/Code/codeLanguages.js.map +1 -1
- package/dist/components/MarkdownDisplay/MarkdownCodeBlock.d.ts +8 -0
- package/dist/components/MarkdownDisplay/MarkdownCodeBlock.js +25 -0
- package/dist/components/MarkdownDisplay/MarkdownCodeBlock.js.map +1 -0
- package/dist/components/MarkdownDisplay/MarkdownDisplay.d.ts +63 -0
- package/dist/components/MarkdownDisplay/MarkdownDisplay.js +318 -0
- package/dist/components/MarkdownDisplay/MarkdownDisplay.js.map +1 -0
- package/dist/components/MarkdownDisplay/index.d.ts +3 -0
- package/dist/components/MarkdownDisplay/index.js +3 -0
- package/dist/components/MarkdownDisplay/markdownPlugins.d.ts +18 -0
- package/dist/components/MarkdownDisplay/markdownPlugins.js +93 -0
- package/dist/components/MarkdownDisplay/markdownPlugins.js.map +1 -0
- package/dist/components/MarkdownDisplay/prepareMarkdownXml.d.ts +14 -0
- package/dist/components/MarkdownDisplay/prepareMarkdownXml.js +313 -0
- package/dist/components/MarkdownDisplay/prepareMarkdownXml.js.map +1 -0
- package/dist/icons/LongTailPhosphorIcons.js +1 -1
- package/dist/utilities.css +1 -1
- package/dist/utils/cn.js +2 -0
- package/dist/utils/cn.js.map +1 -1
- package/docs/DESIGN.md +73 -0
- package/docs/STYLES.md +5 -2
- package/package.json +13 -2
- package/tailwind.preset.cjs +1 -0
package/docs/DESIGN.md
CHANGED
|
@@ -126,6 +126,79 @@ unknown language labels, and reports supported `CodeLanguageType` values.
|
|
|
126
126
|
`showFoldGutter={false}` hides folding controls. Use `onChange` for user edits and
|
|
127
127
|
`onUpdate` when an integration also needs selection or programmatic updates.
|
|
128
128
|
|
|
129
|
+
## Markdown display
|
|
130
|
+
|
|
131
|
+
Import `MarkdownDisplay` from
|
|
132
|
+
`@langchain/macaw-components/MarkdownDisplay` for untrusted CommonMark and
|
|
133
|
+
GitHub Flavored Markdown. It is intentionally omitted from the root barrel so
|
|
134
|
+
applications that do not display Markdown avoid loading the parser. The
|
|
135
|
+
component uses Macaw typography, links, task checkboxes, and read-only code
|
|
136
|
+
blocks. Raw HTML is never parsed, so tags display as text and the Markdown
|
|
137
|
+
around them still renders. Images render as links unless `loadImages` is set,
|
|
138
|
+
because loading a remote image from untrusted content sends a request without
|
|
139
|
+
user action.
|
|
140
|
+
|
|
141
|
+
Use `components` for feature-specific element overrides, `trailingContent` for
|
|
142
|
+
content that continues the final paragraph, and `afterContent` for adjacent
|
|
143
|
+
feature-owned UI. Content over 20,000 characters skips Markdown and renders as
|
|
144
|
+
plain text: linkified and truncated behind Show more by default, in a
|
|
145
|
+
virtualized viewport without linkification when `containerHeight` is set, or in
|
|
146
|
+
full with `fullLength`. Markdown tables remain semantic, horizontally
|
|
147
|
+
scrollable tables; use a feature-owned data-grid integration when sorting,
|
|
148
|
+
selection, virtualization, copy, or export behavior is required.
|
|
149
|
+
|
|
150
|
+
Fenced code wraps by default to fit narrow chat panes. Set
|
|
151
|
+
`codeOverflow="scroll"` to preserve long lines with horizontal scrolling.
|
|
152
|
+
Tables and code regions support keyboard scrolling with a visible focus ring.
|
|
153
|
+
Task checkboxes are read-only indicators, retain their enabled appearance, and
|
|
154
|
+
stay out of the Tab order.
|
|
155
|
+
|
|
156
|
+
Set `isStreaming` while appending response content. Incomplete emphasis and
|
|
157
|
+
inline code render with their intended formatting, unfinished links stay
|
|
158
|
+
non-interactive, and the container exposes `aria-busy`. Pass `false` when the
|
|
159
|
+
response settles so the original Markdown is rendered without repair. The
|
|
160
|
+
host owns fetching, timing, cancellation, and status announcements. Compose
|
|
161
|
+
this with a `ChatMessage` custom content block; the `StreamingInChat` story
|
|
162
|
+
demonstrates incremental updates. Oversized content still uses the unchanged
|
|
163
|
+
plain-text fallback.
|
|
164
|
+
|
|
165
|
+
### Run Details XML compatibility
|
|
166
|
+
|
|
167
|
+
Use `xmlTags="sections"` with raw content to render custom XML wrappers such
|
|
168
|
+
as `<reasoning>` as bold labels inside nested blockquotes. This preserves the
|
|
169
|
+
Run Details XML conventions: mixed-case closing tags, `<input>` wrappers,
|
|
170
|
+
self-closing/void tags, inline labels, and literal fenced code. Inline code and
|
|
171
|
+
native Markdown blockquotes retain their syntax in section mode. CDATA payloads
|
|
172
|
+
keep their tags and entities literal, join split CDATA terminators, and still
|
|
173
|
+
render Markdown. Raw HTML is never executed. The default `xmlTags="literal"`
|
|
174
|
+
continues to display tags as text.
|
|
175
|
+
|
|
176
|
+
```tsx
|
|
177
|
+
<MarkdownDisplay content={rawRunContent} xmlTags="sections" />
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Consumers that already call Run Details’ `prepareMarkdownText` can continue to
|
|
181
|
+
pass `prepared.content` in the default mode and retain their plain-text branch.
|
|
182
|
+
Do not apply both XML adapters. `prepareMarkdownXml` is also exported from
|
|
183
|
+
`@langchain/macaw-components/MarkdownDisplay` so an application can share the
|
|
184
|
+
XML transformation with its search index. The renderer checks the size limit
|
|
185
|
+
before XML expansion or streaming repair and leaves oversized input unchanged.
|
|
186
|
+
|
|
187
|
+
For a Run Details renderer migration, keep the application’s `ListItem` export
|
|
188
|
+
used by other views, pass `toolCallsComponents` as `afterContent`, and retain
|
|
189
|
+
feature-owned component overrides, trailing content, and text options. Code
|
|
190
|
+
and table wrappers expose search block boundaries; code contents remain
|
|
191
|
+
searchable without including the toolbar or language label. The application
|
|
192
|
+
still owns its search index, including using the same Markdown parsing rules
|
|
193
|
+
as the renderer for literal tags.
|
|
194
|
+
|
|
195
|
+
The XML regression cases use the behavior of `prepareMarkdownText` at
|
|
196
|
+
LangChainPlus revision `dec09b917fddc52c73c7cba750869d432adaff64` as a baseline,
|
|
197
|
+
with additional cases for inline code and native blockquotes in section mode.
|
|
198
|
+
`XmlCompatibility` groups raw sections, preprocessed Markdown, literal tags,
|
|
199
|
+
and CDATA inputs. `CodeOverflow` compares the combined code/table/inline-code
|
|
200
|
+
layout at 224px with both code overflow modes.
|
|
201
|
+
|
|
129
202
|
## Chat composer
|
|
130
203
|
|
|
131
204
|
Import the parts from `@langchain/macaw-components/ChatComposer` and use them
|
package/docs/STYLES.md
CHANGED
|
@@ -294,10 +294,13 @@ Use the lowest level that creates enough separation. Avoid skipping levels unles
|
|
|
294
294
|
| `bg-elevated-selected` | Selected item inside a raised or floating surface |
|
|
295
295
|
| `bg-popover` | Floating tooltips, popovers, and menu surfaces |
|
|
296
296
|
| `bg-sidebar` | App navigation sidebar surface |
|
|
297
|
+
| `bg-sidebar-hover` | Hover state for items on the app navigation sidebar |
|
|
297
298
|
| `bg-overlay` | Modal backdrop / scrim |
|
|
298
299
|
|
|
299
|
-
`bg-sidebar` is reserved for app navigation: `neutral-
|
|
300
|
-
`neutral-35` in dark mode
|
|
300
|
+
`bg-sidebar` is reserved for app navigation: `neutral-75` in light mode and
|
|
301
|
+
`neutral-35` in dark mode. In both themes it sits one step behind
|
|
302
|
+
`bg-surface-level-1` and matches no surface level, so the app frame stays
|
|
303
|
+
distinct from page content. Items on it hover with `bg-sidebar-hover`.
|
|
301
304
|
|
|
302
305
|
`bg-input` is white in light mode; `bg-popover` uses `neutral-25`. Both use
|
|
303
306
|
`neutral-100` in dark mode and remain independent semantic roles. Raised
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/macaw-components",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.4",
|
|
4
4
|
"description": "React components and usage guidance for the Macaw Design System.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -208,6 +208,10 @@
|
|
|
208
208
|
"types": "./dist/components/Logo/index.d.ts",
|
|
209
209
|
"import": "./dist/components/Logo/index.js"
|
|
210
210
|
},
|
|
211
|
+
"./MarkdownDisplay": {
|
|
212
|
+
"types": "./dist/components/MarkdownDisplay/index.d.ts",
|
|
213
|
+
"import": "./dist/components/MarkdownDisplay/index.js"
|
|
214
|
+
},
|
|
211
215
|
"./MetricChart": {
|
|
212
216
|
"types": "./dist/components/MetricChart/index.d.ts",
|
|
213
217
|
"import": "./dist/components/MetricChart/index.js"
|
|
@@ -521,6 +525,10 @@
|
|
|
521
525
|
"types": "./dist/components/Logo/index.d.ts",
|
|
522
526
|
"import": "./dist/components/Logo/index.js"
|
|
523
527
|
},
|
|
528
|
+
"./components/MarkdownDisplay": {
|
|
529
|
+
"types": "./dist/components/MarkdownDisplay/index.d.ts",
|
|
530
|
+
"import": "./dist/components/MarkdownDisplay/index.js"
|
|
531
|
+
},
|
|
524
532
|
"./components/MetricChart": {
|
|
525
533
|
"types": "./dist/components/MetricChart/index.d.ts",
|
|
526
534
|
"import": "./dist/components/MetricChart/index.js"
|
|
@@ -645,7 +653,7 @@
|
|
|
645
653
|
"@fontsource/fira-code": "^5.2.7",
|
|
646
654
|
"@fontsource/inter": "^5.2.8",
|
|
647
655
|
"@headlessui/react": "^2.2.10",
|
|
648
|
-
"@langchain/macaw-tokens": "1.7.
|
|
656
|
+
"@langchain/macaw-tokens": "1.7.4",
|
|
649
657
|
"@lezer/common": "^1.2.1",
|
|
650
658
|
"@lezer/highlight": "^1.2.0",
|
|
651
659
|
"@lezer/yaml": "^1.0.4",
|
|
@@ -689,7 +697,10 @@
|
|
|
689
697
|
"d3-scale-chromatic": "^3.0.0",
|
|
690
698
|
"linkify-it": "^5.0.2",
|
|
691
699
|
"react-hotkeys-hook": "^4.5.0",
|
|
700
|
+
"react-markdown": "^10.1.0",
|
|
692
701
|
"react-virtuoso": "^4.18.6",
|
|
702
|
+
"remark-gfm": "^4.0.1",
|
|
703
|
+
"remend": "1.4.0",
|
|
693
704
|
"tailwind-merge": "^3.6.0",
|
|
694
705
|
"tailwindcss-animate": "^1.0.7",
|
|
695
706
|
"tiptap-markdown": "^0.9.0",
|
package/tailwind.preset.cjs
CHANGED
|
@@ -169,6 +169,7 @@ module.exports = {
|
|
|
169
169
|
'elevated-hover': 'var(--bg-elevated-hover)',
|
|
170
170
|
'elevated-selected': 'var(--bg-elevated-selected)',
|
|
171
171
|
sidebar: 'var(--bg-sidebar)',
|
|
172
|
+
'sidebar-hover': 'var(--bg-sidebar-hover)',
|
|
172
173
|
'popover-urgent': 'var(--bg-popover-urgent)',
|
|
173
174
|
|
|
174
175
|
disabled: 'var(--bg-disabled)',
|