v0.6.0: beautifului 整合 + 会话/工作区/队列/权限/命令/附件全链路

- beautifului.dev 组件直连:Sidebar Nav、Tool Chips、Approval Card(抽屉化)、Streaming/Thinking、Code Block、Selection Actions、Prompt Bar、Search
This commit is contained in:
Rick Ye
2026-09-06 09:57:14 +08:00
parent 3c2e9e96c5
commit a5951849c8
96 changed files with 11828 additions and 4649 deletions
+41
View File
@@ -0,0 +1,41 @@
// 验证 Markdown.tsx 的 parseBlocks 是否产出空内容
const INLINE = /^(\s*)([-*+]\s+|\d+[.)]\s+|>\s?|(#{1,3}\s+))?(.*)$/
function parseBlocks(text) {
const blocks = []
const lines = text.split('\n')
let current = null
const flush = () => {
if (current) blocks.push(current)
current = null
}
for (const line of lines) {
const m = line.match(INLINE)
if (!m) continue
const [, indent, marker, content] = m
const isListItem = Boolean(marker && /^([-*+]\s+|\d+[.)]\s+)/.test(marker))
const kind = marker
? marker.startsWith('#')
? 'h1'
: isListItem
? /^\d/.test(marker) ? 'ol' : 'ul'
: marker.startsWith('>') ? 'quote' : null
: 'p'
if (kind === 'p') {
if (!current || current.kind !== 'p') {
flush()
current = { kind: 'p', lines: [] }
}
current.lines.push(content)
continue
}
flush()
}
return blocks
}
for (const t of ['pong', 'Hello world', '# 标题', '- 列表项', '> 引用', '1. 有序']) {
const blocks = parseBlocks(t)
const rendered = blocks.map((b) => b.lines.join('\n'))
console.log(JSON.stringify(t), '->', JSON.stringify(rendered))
}