jamis
Version:
一种支持通过JSON配置方式生成页面的组件库
68 lines (67 loc) • 1.65 kB
TypeScript
import type { RendererProps } from 'jamis-core';
import type { BaseSchema, StaticControlSchemaBase } from '../types';
export interface Token {
/**
* token 的正则
*/
regex: string;
/**
* 正则的 flag
*/
regexFlags?: string;
/**
* token 名称
*/
name: string;
/**
* 文字颜色
*/
color?: string;
/**
* 背景色,不过不知道为何没效果
*/
background?: string;
/**
* 文字样式
*/
fontStyle?: string;
}
export interface CustomLang {
/**
* 语言名字
*/
name: string;
/**
* token
*/
tokens: Token[];
}
/**
* 代码高亮组件
*
*/
export interface CodeSchema extends BaseSchema {
type: 'code';
/**
* 语言类型
*/
language?: 'bat' | 'c' | 'coffeescript' | 'cpp' | 'csharp' | 'css' | 'dockerfile' | 'fsharp' | 'go' | 'handlebars' | 'html' | 'ini' | 'java' | 'javascript' | 'json' | 'less' | 'lua' | 'markdown' | 'msdax' | 'objective-c' | 'php' | 'plaintext' | 'postiats' | 'powershell' | 'pug' | 'python' | 'r' | 'razor' | 'ruby' | 'sb' | 'scss' | 'shell' | 'sol' | 'sql' | 'swift' | 'typescript' | 'vb' | 'xml' | 'yaml' | string;
editorTheme?: string;
/**
* tab 大小
*/
tabSize?: number;
/**
* 是否折行
*/
wordWrap?: boolean;
/**
* 自定义语言
*/
customLang?: CustomLang;
}
export interface StaticCodeSchema extends Omit<CodeSchema, 'type'>, StaticControlSchemaBase {
type: 'static-code';
}
export interface CodeProps extends RendererProps, Omit<CodeSchema, 'type' | 'className' | 'data'> {
}