import { type JSX } from 'solid-js'; import type { CustomElement } from '..'; import { type JSXElement } from '../basic-config'; export type LanguageBase = 'bash' | 'shell' | 'sh' | 'clike' | 'css' | 'docker' | 'dockerfile' | 'git' | 'javascript' | 'js' | 'json' | 'webmanifest' | 'jsx' | 'tsx' | 'less' | 'html' | 'mathml' | 'svg' | 'xml' | 'ssml' | 'atom' | 'rss' | 'regex' | 'rust' | 'sql' | 'swift' | 'toml' | 'typescript' | 'ts' | 'yaml' | 'yml' | 'matlab'; type ExcludeLanguage = T extends U ? never : T; export type Language = LanguageBase | { [T in LanguageBase]: `${T} ${ExcludeLanguage}`; }[LanguageBase]; export interface CodeProps { /** 自定义类名 */ class?: string; /** 自定义样式表 */ css?: string; /** 内容 */ code?: string; /** 语言(支持多种语言配置:如 `html css javascript`) * @default 'markup' */ language?: Language; /** 支持编辑 */ edit?: boolean; /** 开启代码块工具条 */ toolbar?: boolean; /** 工具条上显示的文字 */ title?: string; /** 编辑修改时的回调 */ onChange?(code: string): void; children?: JSXElement; /** 主题风格 * @since 2.14.11 */ theme?: 'light' | 'dark'; /** 经典风格 * @since 2.14.11 * @default true */ classic?: boolean; } export type CodeElement = CustomElement; declare function Code(props: CodeProps): JSX.Element; declare namespace Code { var registry: () => void; } export default Code;