- 新 src/client/builtins/ 目录:tabs.tsx(6 个 tab descriptor + TERMINAL_LIMIT/uiTerminalCount,terminal 配额知识离开 state.ts)、 viewers.tsx(8 个 viewer descriptor)、index.ts(registerBuiltins 聚合 注册 + 幂等 disposer);删除旧 builtins.tsx - icons.tsx:删除零调用者的 tabTypeIcon 及多余 import(图标已归 descriptor.icon,映射随 tab 类型一起注册化) - OrphanedTab:内联 style → sidebar.module.css 新增 .orphanedType 类 - 新增 tests/builtins.spec.ts(6 tab + 8 viewer 注册断言、code catch-all、 binary-download NUL detect、office 优先级、disposer 幂等) - 新增 tests/orphaned-tab.spec.tsx(sanitize 保留未注册类型 tab、 OrphanedTab 占位渲染);tests/browser-globals.ts 供拉入 xterm/ CodeMirror 的 spec 首个 import(模块求值期需要 self/document/navigator) - service.spec 补 openDiffTab 与 diff dedupeKey 一致性用例
28 lines
1.0 KiB
TypeScript
28 lines
1.0 KiB
TypeScript
/**
|
|
* Placeholder shown when a persisted tab's type is not registered (the
|
|
* contributing plugin is not installed / not yet loaded). The tab is kept
|
|
* in state so it can recover if the plugin loads later; the user can close
|
|
* it through the tab bar's X button as usual. This is the graceful-
|
|
* degradation path for the open tab-type set: {@link Sidebar} renders this
|
|
* instead of crashing on an unknown type.
|
|
*/
|
|
import type { ReactNode } from 'react'
|
|
import { t } from './locales.ts'
|
|
import css from './sidebar.module.css'
|
|
import type { TabComponentProps } from './service.ts'
|
|
|
|
export function OrphanedTab(props: TabComponentProps): ReactNode {
|
|
const { tab } = props
|
|
return (
|
|
<div className={css.editor}>
|
|
<div className={css.editorHeader}>
|
|
<span className={css.editorTitle} title={tab.type}>{tab.title}</span>
|
|
</div>
|
|
<div className={css.editorPlaceholder}>
|
|
<span>{t('pluginNotLoaded')}</span>
|
|
<code className={css.orphanedType}>{tab.type}</code>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|