440 lines
22 KiB
Vue
440 lines
22 KiB
Vue
<script setup lang="ts">
|
||
/**
|
||
* 「录一段音」:声音样本 / 克隆参考音色的第二个入口(第一个是上传文件)。
|
||
*
|
||
* 交互改成弹出小面板:录制 → 试听 → 保存三步在一个面板里走完。
|
||
* 之前控件是内联在表单行里的,录起来整行被撑开、试听条只有 96px,
|
||
* 录完连「存成哪条素材」都没得选,只能被动接受组件猜的文件名。
|
||
*/
|
||
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
||
import { MAX_RECORD_MS, MIC_WAIT_MS, MIN_RECOMMENDED_MS, MicUnavailableError, RecordingSession,
|
||
explainMicError, micErrorTag, micProbeHint, micResetCommand, micSettingsLinks, probeMicrophone,
|
||
recordingBlockedReason, recordingSupported, type MicProbe, type Recording } from '../recorder'
|
||
import { fmtMs } from '../format'
|
||
import { beginRecordingSheet } from '../recordingGuard'
|
||
import AudioPlay from './AudioPlay.vue'
|
||
|
||
const props = withDefaults(defineProps<{
|
||
/** 触发按钮文案 */
|
||
label?: string
|
||
/** 这段录音最终会变成什么(保存按钮文案,和实际入库的登记类型保持一致) */
|
||
target?: string
|
||
disabled?: boolean
|
||
/** 面板顶部说明 */
|
||
hint?: string
|
||
/** 已存在的素材名:选它 = 追加为下一个版本,写新名 = 新建一条素材 */
|
||
names?: string[]
|
||
/** 默认存到哪条素材(不传用 target) */
|
||
defaultName?: string
|
||
}>(), {
|
||
label: '录制', target: '新版本', disabled: false, names: () => [], defaultName: '',
|
||
hint: '用麦克风录一段真人声音,录完自动转成 WAV 上传',
|
||
})
|
||
|
||
const emit = defineEmits<{
|
||
(e: 'pick', file: File, meta: {
|
||
durationMs: number; warning: string; name: string; setCurrent: boolean;
|
||
fileSizeBytes: number
|
||
}): void
|
||
}>()
|
||
|
||
type Stage = 'idle' | 'recording' | 'preview'
|
||
const open = ref(false)
|
||
const stage = ref<Stage>('idle')
|
||
const elapsed = ref(0)
|
||
const level = ref(0)
|
||
const error = ref('')
|
||
const busy = ref('')
|
||
const taking = ref<Recording | null>(null)
|
||
const saveName = ref('')
|
||
const setCurrent = ref(true)
|
||
let session: RecordingSession | null = null
|
||
let meter: number | null = null
|
||
/** 一次「开始录制」的代次:关面板/清空后,迟到的授权结果必须作废 */
|
||
let runId = 0
|
||
/** 正在等系统授权框时的已等毫秒(0 = 没在等) */
|
||
const awaiting = ref(0)
|
||
/** 本次录音里出现过的最高电平:几秒还是平的,说明声音根本没进来 */
|
||
let peakSeen = 0
|
||
const previewUrl = ref('')
|
||
/** 面板开着就把页面轮询按住(见 recordingGuard):卡片被刷新重建会连本组件一起卸载 */
|
||
let releaseSheet: (() => void) | null = null
|
||
watch(open, (v) => {
|
||
if (v) releaseSheet = releaseSheet || beginRecordingSheet()
|
||
else if (releaseSheet) { releaseSheet(); releaseSheet = null }
|
||
})
|
||
/** 每个实例一个 datalist id:同屏多个录音入口时不能共用 */
|
||
const listId = `rec-names-${Math.random().toString(36).slice(2, 8)}`
|
||
|
||
const maxSec = computed(() => Math.round(MAX_RECORD_MS / 1000))
|
||
const minSec = computed(() => Math.round(MIN_RECOMMENDED_MS / 1000))
|
||
/** 已经在录、但一直没收到声音(选了错的输入设备、系统里静音、麦克风本身是坏的) */
|
||
const silent = computed(() => stage.value === 'recording' && elapsed.value > 4_000 && peakSeen < 0.03)
|
||
const supported = computed(() => recordingSupported())
|
||
const blocked = computed(() => recordingBlockedReason())
|
||
const canStart = computed(() => supported.value && !props.disabled && !busy.value)
|
||
/** 麦克风体检结果(未探测时为 null);探测本身不打扰用户,也不拦止录音 */
|
||
const probe = ref<MicProbe | null>(null)
|
||
/** 探测还没回来时也要能出诊断码,这里单独留一份浏览器名 */
|
||
const browserNote = ref(typeof navigator !== 'undefined' ? navigator.userAgent : '')
|
||
/** 事前就能看出的毛病(系统里没麦克风 / 权限被设为阻止),没毛病时为空 */
|
||
const preflight = computed(() => (probe.value ? micProbeHint(probe.value) : ''))
|
||
/** 体检已确认能录:把设备名直接回显出来,省得用户猜「到底有没有麦」 */
|
||
const micOk = computed(() => !!probe.value?.authorized)
|
||
const micStatusText = computed(() => {
|
||
if (!supported.value) return ''
|
||
if (!probe.value) return '麦克风自检中…'
|
||
if (probe.value.authorized) return `麦克风已就绪:${probe.value.devices[0]}`
|
||
return '麦克风未就绪:见下方说明'
|
||
})
|
||
/** macOS 把浏览器整个挡在门外时,唯一不需要重启浏览器的解法就是这条命令 */
|
||
const resetCmd = computed(() => (probe.value && !probe.value.authorized ? micResetCommand(probe.value) : ''))
|
||
const copied = ref('')
|
||
/** 提示语里用 **包起来** 的部分渲染成粗体(不动 v-html,免得中文标点被当标签吞) */
|
||
function segs(text: string): string[] {
|
||
return text ? text.split('**') : []
|
||
}
|
||
const preflightSegs = computed(() => segs(preflight.value))
|
||
const errorSegs = computed(() => segs(error.value))
|
||
|
||
async function copyText(text: string, ok: string) {
|
||
if (!text) return
|
||
try {
|
||
await navigator.clipboard.writeText(text)
|
||
copied.value = ok
|
||
} catch {
|
||
copied.value = text // 剪贴板被挡(非安全上下文)时至少让人能手抄
|
||
}
|
||
window.setTimeout(() => { copied.value = '' }, 6_000)
|
||
}
|
||
function copyReset() { return copyText(resetCmd.value, '命令已复制,粘到终端回车,然后回来点「重新检测」') }
|
||
function copyDiag() {
|
||
return copyText(`${location.origin} · ${browserNote.value} · ${rawError.value}`,
|
||
'诊断码已复制(地址 + 浏览器 + 原始报错),发给支持即可定位')
|
||
}
|
||
/** 浏览器原始报错标记:中文结论之外再给一行 name · message,截图就能定位分支 */
|
||
const rawError = ref('')
|
||
/** 系统隐私/声音设置的直达链接:只在「还没就绪」或「刚报过错」时露出来,就绪时不占地方 */
|
||
const settingsLinks = computed(() => (!micOk.value || !!error.value ? micSettingsLinks(probe.value) : []))
|
||
|
||
const knownNames = computed(() => [...new Set((props.names || []).map((x) => String(x || '').trim()).filter(Boolean))])
|
||
|
||
async function recheck() {
|
||
if (!supported.value) { probe.value = null; return }
|
||
probe.value = await probeMicrophone()
|
||
}
|
||
|
||
/** 插了麦克风、改了系统权限都不用刷新页面:设备一变就重新体检 */
|
||
function onDeviceChange() { void recheck() }
|
||
|
||
function onKey(ev: KeyboardEvent) {
|
||
if (ev.key === 'Escape' && open.value) { ev.stopPropagation(); close() }
|
||
}
|
||
|
||
onMounted(() => {
|
||
void recheck()
|
||
// devicechange 挂在 mediaDevices 上(不是 window):插入 USB 麦、系统改权限都会触发
|
||
navigator.mediaDevices?.addEventListener?.('devicechange', onDeviceChange)
|
||
window.addEventListener('keydown', onKey, true)
|
||
})
|
||
onBeforeUnmount(() => {
|
||
navigator.mediaDevices?.removeEventListener?.('devicechange', onDeviceChange)
|
||
window.removeEventListener('keydown', onKey, true)
|
||
})
|
||
const timeText = computed(() => fmtMs(elapsed.value))
|
||
const barHeight = computed(() => `${Math.max(6, Math.round(level.value * 100))}%`)
|
||
const warning = computed(() => taking.value?.warning || '')
|
||
|
||
function clearMeter() {
|
||
if (meter !== null) window.clearInterval(meter)
|
||
meter = null
|
||
level.value = 0
|
||
}
|
||
|
||
function revokePreview() {
|
||
if (previewUrl.value) URL.revokeObjectURL(previewUrl.value)
|
||
previewUrl.value = ''
|
||
}
|
||
|
||
/** 打开面板:每次进来都是干净的「待录」状态,名字默认落到 target 对应的素材 */
|
||
function openSheet() {
|
||
error.value = ''
|
||
rawError.value = ''
|
||
taking.value = null
|
||
revokePreview()
|
||
elapsed.value = 0
|
||
stage.value = 'idle'
|
||
saveName.value = String(props.defaultName || props.target || '录音').trim()
|
||
setCurrent.value = true
|
||
open.value = true
|
||
void recheck()
|
||
void nextTick(() => document.querySelector<HTMLButtonElement>('.rec-sheet .rec-big')?.focus())
|
||
}
|
||
|
||
function close() {
|
||
if (stage.value === 'recording') abandon()
|
||
runId += 1 // 录制还没起来就关面板:等的授权也别再认
|
||
awaiting.value = 0
|
||
open.value = false
|
||
}
|
||
|
||
async function start() {
|
||
const my = ++runId
|
||
error.value = ''
|
||
awaiting.value = 0
|
||
let opened: RecordingSession | null = null
|
||
try {
|
||
opened = await RecordingSession.start(probe.value || await probeMicrophone(),
|
||
(ms) => { if (my === runId) awaiting.value = ms })
|
||
} catch (exc: any) {
|
||
if (my !== runId) return // 等授权期间已经被关掉了,别把结论打到别的面板上
|
||
awaiting.value = 0
|
||
session = null
|
||
// recorder 抛的已经是中文结论;万一还是原始 DOMException,这里再兜一层
|
||
error.value = exc instanceof MicUnavailableError
|
||
? exc.message
|
||
: explainMicError(exc, probe.value || await probeMicrophone())
|
||
rawError.value = exc instanceof MicUnavailableError ? micErrorTag(exc.cause) : micErrorTag(exc)
|
||
void recheck() // 报错往往意味着设备/权限刚变过,顺手刷新体检结果
|
||
return
|
||
}
|
||
if (my !== runId) { opened?.discard(); return } // 授权框是迟到点出来的:麦克风立刻还给系统
|
||
awaiting.value = 0
|
||
session = opened
|
||
taking.value = null
|
||
revokePreview()
|
||
stage.value = 'recording'
|
||
elapsed.value = 0
|
||
peakSeen = 0
|
||
session.onTick = (ms) => { elapsed.value = ms }
|
||
session.setAutoStop(() => { void stop() })
|
||
meter = window.setInterval(() => {
|
||
level.value = session?.level() || 0
|
||
peakSeen = Math.max(peakSeen, level.value)
|
||
}, 60)
|
||
}
|
||
|
||
/** 停止采集并把 webm/opus 转成 WAV,成功后进入试听 */
|
||
async function stop() {
|
||
const active = session
|
||
if (!active) return
|
||
session = null
|
||
clearMeter()
|
||
busy.value = '转码中…'
|
||
try {
|
||
taking.value = await active.stop()
|
||
revokePreview()
|
||
previewUrl.value = URL.createObjectURL(taking.value.blob)
|
||
stage.value = 'preview'
|
||
void nextTick(() => document.querySelector<HTMLButtonElement>('.rec-sheet .primary')?.focus())
|
||
} catch (exc: any) {
|
||
active.discard()
|
||
error.value = `录音转 WAV 失败:${exc?.message || exc}。可以先用系统录音笔录好再走上传。`
|
||
stage.value = 'idle'
|
||
} finally {
|
||
busy.value = ''
|
||
}
|
||
}
|
||
|
||
/** 不要这段录音了:释放麦克风,回到未录状态 */
|
||
function abandon() {
|
||
runId += 1 // 作废还在等授权的 getUserMedia
|
||
awaiting.value = 0
|
||
session?.discard()
|
||
session = null
|
||
clearMeter()
|
||
taking.value = null
|
||
revokePreview()
|
||
elapsed.value = 0
|
||
error.value = ''
|
||
rawError.value = ''
|
||
stage.value = 'idle'
|
||
}
|
||
|
||
function safeFileName(name: string) {
|
||
return (String(name || '录音').replace(/[\\/:*?"<>|]+/g, '').trim() || '录音').slice(0, 40)
|
||
}
|
||
|
||
function confirmUpload() {
|
||
const rec = taking.value
|
||
if (!rec) return
|
||
const name = saveName.value.trim() || String(props.target || '录音')
|
||
const file = new File([rec.blob], `${safeFileName(name)}.wav`, { type: 'audio/wav' })
|
||
emit('pick', file, {
|
||
durationMs: rec.durationMs, warning: rec.warning, name,
|
||
setCurrent: setCurrent.value, fileSizeBytes: rec.blob.size,
|
||
})
|
||
session = null
|
||
taking.value = null
|
||
revokePreview()
|
||
elapsed.value = 0
|
||
stage.value = 'idle'
|
||
open.value = false
|
||
}
|
||
|
||
onBeforeUnmount(() => {
|
||
session?.discard()
|
||
clearMeter()
|
||
revokePreview()
|
||
releaseSheet?.() // 面板随列表一起没了:把轮询放开
|
||
releaseSheet = null
|
||
})
|
||
</script>
|
||
|
||
<template>
|
||
<button class="outline tiny rec-trigger" :class="{ recording: stage === 'recording' }"
|
||
:disabled="!canStart" :title="blocked || hint || '录一段真人声音'" @click="openSheet">
|
||
🎙 {{ supported ? label : '录音不可用' }}<span v-if="stage === 'recording'" class="live">{{ timeText }}</span>
|
||
</button>
|
||
|
||
<Teleport to="body">
|
||
<div v-if="open" class="rec-mask" @click.self="close">
|
||
<section class="rec-sheet" role="dialog" aria-modal="true" :aria-label="`录制${target}`">
|
||
<header class="rec-head">
|
||
<div><small class="rec-eyebrow">RECORD · {{ target }}</small>
|
||
<h3>{{ stage === 'recording' ? '正在录制…' : (stage === 'preview' ? '试听并保存' : '录一段声音') }}</h3></div>
|
||
<button class="rec-x" title="关闭(Esc)" @click="close">✕</button>
|
||
</header>
|
||
|
||
<ol class="rec-steps">
|
||
<li :class="{ on: stage === 'idle', done: stage !== 'idle' }">① 录制</li>
|
||
<li :class="{ on: stage === 'recording', done: stage === 'preview' }">② 试听</li>
|
||
<li :class="{ on: stage === 'preview' }">③ 保存</li>
|
||
</ol>
|
||
|
||
<p v-if="blocked" class="rec-bad">✕ {{ blocked }}</p>
|
||
<template v-else-if="supported">
|
||
<p class="rec-microw" :class="micOk ? 'ok' : 'warn'">
|
||
<span class="rec-status">{{ micOk ? '✓' : '⚠' }} {{ micStatusText }}</span>
|
||
<span class="rec-grow"></span>
|
||
<button class="rec-link" @click="recheck">重新检测</button>
|
||
<button v-if="resetCmd" class="rec-link" @click="copyReset">复制修复命令</button>
|
||
<a v-for="l in settingsLinks" :key="l.href" class="rec-link" :href="l.href">{{ l.label }}</a>
|
||
</p>
|
||
<p v-if="copied" class="rec-note">{{ copied }}</p>
|
||
<p v-if="!micOk && preflight" class="rec-warn"><template v-for="(s, i) in preflightSegs"
|
||
:key="i"><b v-if="i % 2">{{ s }}</b><template v-else>{{ s }}</template></template></p>
|
||
</template>
|
||
|
||
<div class="rec-stage" :class="stage">
|
||
<button v-if="stage !== 'recording'" class="rec-big" :disabled="!canStart" @click="start">
|
||
🎙 {{ stage === 'idle' ? '开始录制' : '重新录制' }}
|
||
</button>
|
||
<button v-else class="rec-big stop" @click="stop"><span class="rec-dot"></span>停止录制</button>
|
||
<div class="rec-meta">
|
||
<b class="rec-time">{{ timeText }}</b>
|
||
<span v-if="stage === 'recording'" class="rec-meter" title="麦克风电平"><i :style="{ height: barHeight }"></i></span>
|
||
<span class="rec-limit">{{ stage === 'preview'
|
||
? '已录好,点下面的 ▶ 试听确认后再保存'
|
||
: `建议念满 ${minSec} 秒 · 上限 ${maxSec} 秒自动停止` }}</span>
|
||
</div>
|
||
<p v-if="silent" class="rec-warn">已经录了 {{ Math.round(elapsed / 1000) }} 秒还没收到声音:
|
||
麦克风可能被静音,或选错了输入设备。点「停止录制」后重录。</p>
|
||
<p v-if="awaiting" class="rec-warn">⏳ 正在等系统授权(已等 {{ Math.ceil(awaiting / 1000) }} 秒):
|
||
授权框{{ probe?.macos ? '在屏幕左下角,不在网页里' : '在地址栏左侧' }},
|
||
看不到就把这个浏览器切到最前面再点一次;超过
|
||
{{ Math.round(MIC_WAIT_MS / 1000) }} 秒没点会自动取消。</p>
|
||
<p v-if="busy" class="rec-note">转码中,请稍候…</p>
|
||
<p v-if="error" class="rec-bad"><template v-for="(s, i) in errorSegs" :key="i">
|
||
<b v-if="i % 2">{{ s }}</b><template v-else>{{ s }}</template></template></p>
|
||
<p v-if="error && rawError" class="rec-raw">浏览器原始报错 <code>{{ rawError }}</code>
|
||
<button class="rec-link" @click="copyDiag">复制诊断码</button></p>
|
||
</div>
|
||
|
||
<div v-if="stage === 'preview'" class="rec-save">
|
||
<AudioPlay :src="previewUrl" label="刚才的录音" :duration-ms="taking?.durationMs || 0"
|
||
size="sm" :cover="false" />
|
||
<p v-if="warning" class="rec-warn">{{ warning }}</p>
|
||
<label class="rec-field">存到哪条素材
|
||
<input v-model="saveName" :list="listId" placeholder="素材名称" title="选已有名称=追加成它的下一个版本(之后可删版本 / 设为当前版本);写新名称=新建一条素材" />
|
||
<datalist :id="listId"><option v-for="n in knownNames" :key="n" :value="n" /></datalist>
|
||
</label>
|
||
<label class="rec-check"><input v-model="setCurrent" type="checkbox" />保存后设为当前版本</label>
|
||
</div>
|
||
|
||
<footer class="rec-foot">
|
||
<button class="outline tiny" :disabled="stage === 'recording'" @click="close">取消</button>
|
||
<button v-if="stage !== 'idle'" class="outline tiny" @click="abandon">清空重录</button>
|
||
<span class="rec-grow"></span>
|
||
<button v-if="stage === 'recording'" class="secondary tiny" @click="stop">■ 停止并试听</button>
|
||
<button v-else class="primary tiny" :disabled="stage !== 'preview' || !!busy || !saveName.trim()"
|
||
@click="confirmUpload">✓ 存为{{ target }}</button>
|
||
</footer>
|
||
</section>
|
||
</div>
|
||
</Teleport>
|
||
</template>
|
||
|
||
<style scoped>
|
||
.rec-trigger { white-space: nowrap }
|
||
.rec-trigger.recording { border-color: var(--c-danger-line); background: var(--c-danger-tint); color: var(--c-danger) }
|
||
.rec-trigger .live { margin-left: 6px; font-variant-numeric: tabular-nums }
|
||
|
||
.rec-mask { position: fixed; inset: 0; z-index: 260; display: grid; place-items: center; padding: 16px;
|
||
background: var(--c-scrim); backdrop-filter: blur(3px) }
|
||
.rec-sheet { width: min(430px, 100%); display: flex; flex-direction: column; gap: 10px; padding: 14px;
|
||
border: 1px solid var(--c-line); border-radius: 14px; background: var(--c-bg-panel);
|
||
box-shadow: 0 24px 60px rgba(0, 0, 0, .42) }
|
||
.rec-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px }
|
||
.rec-head h3 { margin: 3px 0 0; font-size: 15px }
|
||
.rec-eyebrow { font-size: 10px; letter-spacing: .1em; color: var(--c-text-faint) }
|
||
.rec-x { border: 0; background: none; color: var(--c-text-faint); font-size: 14px; cursor: pointer; padding: 2px 4px }
|
||
.rec-x:hover { color: var(--c-text) }
|
||
|
||
.rec-steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0 }
|
||
.rec-steps li { flex: 1; text-align: center; font-size: 10.5px; padding: 5px 0; border-radius: 7px;
|
||
border: 1px solid var(--c-line); color: var(--c-text-faint); background: var(--c-bg-sunken) }
|
||
.rec-steps li.on { border-color: var(--c-accent-line); color: var(--c-accent-bright); background: var(--c-tint-info) }
|
||
.rec-steps li.done { color: var(--c-success); border-color: var(--c-success-line) }
|
||
|
||
.rec-stage { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 10px;
|
||
border: 1px dashed var(--c-line); border-radius: 11px; background: var(--c-bg-sunken) }
|
||
.rec-stage.recording { border-color: var(--c-danger-line); border-style: solid }
|
||
/* 面板主操作钮:比 --ctl-h 大一档(48px),录音时要点准,不能只按普通按钮档位算。
|
||
已登记在 docs/UI规范.md §1.2.1 例外清单。 */
|
||
.rec-big { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
|
||
height: 48px; padding: 0 20px; border-radius: 999px;
|
||
border: 1px solid var(--c-accent-line); background: var(--c-accent-fill); color: var(--c-on-accent);
|
||
font-size: 13px; font-weight: 700; cursor: pointer }
|
||
.rec-big:disabled { opacity: .5; cursor: not-allowed }
|
||
.rec-big.stop { border-color: var(--c-danger-line); background: var(--c-danger-tint); color: var(--c-danger) }
|
||
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; animation: rec-pulse 1s ease-in-out infinite }
|
||
@keyframes rec-pulse { 0%, 100% { opacity: 1 } 50% { opacity: .2 } }
|
||
.rec-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center }
|
||
.rec-time { font-size: 13px; font-variant-numeric: tabular-nums }
|
||
.rec-limit { font-size: 10px; color: var(--c-text-faint) }
|
||
.rec-meter { display: inline-flex; align-items: flex-end; width: 46px; height: 22px; padding: 2px;
|
||
border: 1px solid var(--c-line); border-radius: 5px; background: var(--c-bg-shell) }
|
||
.rec-meter i { display: block; width: 100%; border-radius: 3px; background: var(--c-accent-fill); transition: height .06s linear }
|
||
|
||
.rec-save { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 11px; background: var(--c-tint-info) }
|
||
/* 全局 label{flex-direction:column;margin:10px 0}:这两条不显式覆盖,
|
||
勾选框会掉到文字上面、还多出 20px 上下空白,「存到哪条素材」也被撑得很松。 */
|
||
.rec-field { display: flex; flex-direction: column; gap: 4px; font-size: 11px; margin: 0 }
|
||
.rec-check { display: inline-flex; flex-direction: row; align-items: center; gap: 7px; width: fit-content;
|
||
margin: 0; font-size: 11.5px; color: var(--c-text-2); cursor: pointer }
|
||
.rec-check input { width: auto; height: auto; accent-color: var(--c-accent-fill) }
|
||
.rec-foot { display: flex; align-items: center; gap: 8px }
|
||
.rec-grow { flex: 1 }
|
||
.rec-note { margin: 0; font-size: 10.5px; line-height: 1.6; color: var(--c-text-faint) }
|
||
/* 麦克风自检行:常驻一行,就绪时绿色回显设备名,没就绪时把「复制修复命令」摆在手边 */
|
||
.rec-microw { display: flex; flex-direction: row; align-items: center; gap: 8px; margin: 0;
|
||
padding: 6px 8px; border-radius: 8px; font-size: 11px; border: 1px solid var(--c-line); flex-wrap: wrap }
|
||
.rec-microw.ok { color: var(--c-success); border-color: var(--c-success-line); background: var(--c-success-tint) }
|
||
.rec-microw.warn { color: var(--c-warn); border-color: var(--c-warn-line); background: var(--c-warn-tint) }
|
||
.rec-status { min-width: 0; overflow-wrap: anywhere }
|
||
.rec-warn { margin: 0; font-size: 11px; line-height: 1.6; color: var(--c-warn) }
|
||
.rec-bad { margin: 0; font-size: 11px; line-height: 1.6; color: var(--c-danger) }
|
||
/* 这些是行内文字链接,不是控件:nowrap 保证标签不被挤成两行(两行 15px 行盒 = 30px,
|
||
会被控件档位审计当成「野高度」),放不下时由 .rec-microw 整行换行 */
|
||
.rec-link { border: 0; background: none; color: var(--c-text-3); font-size: 10.5px; text-decoration: underline;
|
||
padding: 0; white-space: nowrap; line-height: 1.45 }
|
||
.rec-link:hover { color: var(--c-accent-bright) }
|
||
a.rec-link { text-underline-offset: 2px }
|
||
/* 原始报错留痕:中文结论之外再给一行可复制的诊断码,远程定位不用再猜 */
|
||
.rec-raw { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin: -2px 0 0;
|
||
font-size: 10px; color: var(--c-text-faint) }
|
||
.rec-raw code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
||
padding: 1px 5px; border-radius: 5px; background: var(--c-bg-sunken); border: 1px solid var(--c-line) }
|
||
</style>
|