生态产品多个设计器现已发布候选版本

查看生态总览
Skip to content

MarkdownStream alpha ​

AI chat component. This page is the API reference, generated from the source code. Usage guidance and live examples are on the Chinese page.

Anatomy ​

Parts in bold are required.

data-scope="markdown-stream": root · content · block · live-region

API reference ​

Descriptions of individual props, events and slots are written in Chinese and appear on the Chinese page.

Artifacts ​

LayerValue
Custom element<xh-markdown-stream>
Vue componentsXhMarkdownStreamContent XhMarkdownStreamLiveRegion XhMarkdownStreamRoot
ComposableuseMarkdownStream
State machineNone: connect computes attributes from props directly
Skin@xihan-ui/styles/markdown-stream.css

Props ​

PropTypeRequired
announce'off' | 'polite' | 'assertive'
blocksreadonly MarkdownBlock[]Yes
caretboolean
sizeSize
streamingboolean
translationsPartial<MarkdownStreamTranslations>

MarkdownBlock ​

Elements of blocks.

FieldTypeRequired
keystringYes
kind'markdown' | 'code' | 'math' | 'html'Yes
htmlstringYes
completebooleanYes
langstring
sourcestring
inlinesreadonly MarkdownInline[]

Events ​

Custom elements put the payload in detail; Vue emits an event of the same name.

EventPayload
inline-mountCustomEvent

Slots ​

Only slots with a payload are listed.

Vue componentSlotPayload
XhMarkdownStreamContentblockMarkdownStreamBlockSlotProps
XhMarkdownStreamContentcitationMarkdownStreamCitationSlotProps
XhMarkdownStreamContentmathMarkdownStreamMathSlotProps
XhMarkdownStreamRootdefaultMarkdownStreamRootSlotProps

React adapter props ​

Only the props each component declares itself: DOM attributes inherited from ComponentPropsWithRef are left out, and root props already listed in the Props table are not repeated. The Vue counterpart is the slot table above.

React componentPropTypeRequired
XhMarkdownStreamContentchildrenSlotChildren<MarkdownStreamBlockSlotProps>
XhMarkdownStreamContentrenderCitation(props: MarkdownStreamCitationSlotProps) => ReactNode
XhMarkdownStreamContentrenderMath(props: MarkdownStreamMathSlotProps) => ReactNode
XhMarkdownStreamRootchildrenSlotChildren<MarkdownStreamRootSlotProps>

State ​

Public state is written to data-state.

PartValues
root'streaming' | 'complete'

connect API ​

getXxxProps() returns the host attributes of the matching part.

MemberType
blocksreadonly MarkdownBlock[]
streamingboolean
announcementstring | undefined
getRootProps() => T['element']
getContentProps() => T['element']
getBlockProps(props: { block: MarkdownBlock }) => T['element']
getLiveRegionProps() => T['element']

Accessibility ​

Keyboard ​

Specification: W3C APG. Each row is a stable behavior id that the conformance tests cover; the conditions and effects are described on the Chinese page.

KeysBehavior
markdown-stream.kbd.none

ARIA ​

These attributes are produced by connect.

PartAttributeValue
live-regionaria-atomic'true'
live-regionaria-live'assertive' | 'polite'
live-regionrole'alert' | 'status'

Style reference ​

Skin ​

@xihan-ui/styles/markdown-stream.css is written against [data-scope="markdown-stream"][data-part="root"] part selectors; the published build uses the mount class .xh-scope-markdown-stream in place of data-scope (same specificity) and sits in the xihan.components and xihan.motion layers. Put overrides in xihan.overrides; the part selectors work as usual.

Data attributes ​

Produced by connect; valueless attributes are omitted while their condition does not hold.

PartAttributeValue
rootdata-caret'' (present only while the condition holds)
rootdata-sizeprops.size
rootdata-state'streaming' | 'complete'
blockdata-caret'' (present only while the condition holds)
blockdata-complete'' (present only while the condition holds)
blockdata-kindblock.kind
blockdata-langblock.lang
blockdata-live'' (present only while the condition holds)

CSS variables ​

The public override slots, generated from what the standalone skin actually consumes.

VariablePartCSS propertyStateDefault from
--xh-markdown-stream-caret-bgblock
root
backgroundcaret--xh-fg-default
--xh-markdown-stream-caret-durationrootanimationcaret--xh-motion-loop-caret
--xh-markdown-stream-caret-enter-durationblockanimationcaret--xh-motion-duration-enter
--xh-markdown-stream-caret-gapblock
root
margin-inline-startcaret0.1em
--xh-markdown-stream-caret-hblock
root
block-sizecaret1.05em
--xh-markdown-stream-caret-radiusblock
root
border-radiuscaret--xh-shape-inset
--xh-markdown-stream-caret-shiftblock
root
translatecaret-0.5px
--xh-markdown-stream-caret-wblock
root
inline-sizecaret--xh-stroke-thick
--xh-markdown-stream-fgrootcolordefault--xh-fg-default
--xh-markdown-stream-font-sizerootfont-sizedefault--xh-_markdown-stream-font-size
--xh-markdown-stream-gapcontentgapdefault--xh-_markdown-stream-gap
--xh-markdown-stream-leadingrootline-heightdefault--xh-text-prose-leading
--xh-markdown-stream-monoblockfont-familykind=code
kind=math
--xh-font-family-mono

Released under The MIT License