UNPKG

@nasl/types

Version:

NASL types for TypeScript Declaration

976 lines (938 loc) 16.2 kB
/* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/adjacent-overload-signatures */ /** * 设置器基类 */ export type BaseSetter = CustomSetter | InputSetter | SwitchSetter | EnumSelectSetter | CapsulesSetter | NumberInputSetter | IconSetter | ImageSetter | PropertySelectSetter | PropertyTransformSetter | AnonymousFunctionSetter; /** * 自定义属性设置器 */ export interface CustomSetter { concept: 'CustomSetter'; /** * 节点变更时间 */ changedTime?: number; /** * 自定义属性设置器名称 */ name: string; /** * 参数映射 */ argumentMap: Record<string, string>; } /** * 输入框设置器 */ export interface InputSetter { concept: 'InputSetter'; /** * 节点变更时间 */ changedTime?: number; /** * 占位文本 */ placeholder?: string; /** * 空值自动删除 */ autoClear?: boolean; } /** * 切换设置器 */ export interface SwitchSetter { concept: 'SwitchSetter'; /** * 节点变更时间 */ changedTime?: number; } /** * 枚举选择设置器 */ export interface EnumSelectSetter { concept: 'EnumSelectSetter'; /** * 节点变更时间 */ changedTime?: number; /** * 枚举选项列表 */ options: Array<SetterOption>; /** * 是否多选 */ multiple?: boolean; /** * 是否可清空 */ clearable?: boolean; } /** * 设置器枚举选项 */ export interface SetterOption { concept: 'SetterOption'; /** * 节点变更时间 */ changedTime?: number; /** * 选项值 */ value: string; /** * 选项标题 */ title: string; /** * 选项图标 */ icon?: string; /** * 选项工具提示 */ tooltip?: string; /** * 是否显隐 * * 用 TS 写表达式,在 IDE 中直接 eval */ tsIf?: string; /** * 是否禁用 * * 用 TS 写表达式,在 IDE 中直接 eval */ tsDisabledIf?: string; } /** * 胶囊设置器 */ export interface CapsulesSetter { concept: 'CapsulesSetter'; /** * 节点变更时间 */ changedTime?: number; /** * 枚举选项列表 */ options: Array<SetterOption>; /** * 是否多选 */ multiple?: boolean; } /** * 数字输入设置器 */ export interface NumberInputSetter { concept: 'NumberInputSetter'; /** * 节点变更时间 */ changedTime?: number; /** * 按钮位置 */ placement?: string; /** * 最小值 */ min?: number; /** * 最大值 */ max?: number; /** * 精度 */ precision?: number; /** * 占位文本 */ placeholder?: string; } /** * 图标设置器 */ export interface IconSetter { concept: 'IconSetter'; /** * 节点变更时间 */ changedTime?: number; /** * 图标标题 */ title?: string; /** * 使用自定义 iconfont 库 */ customIconFont?: string; /** * 隐藏上传图标功能 */ hideUploadIcon?: boolean; } /** * 图片设置器 */ export interface ImageSetter { concept: 'ImageSetter'; /** * 节点变更时间 */ changedTime?: number; } /** * 属性选择设置器 */ export interface PropertySelectSetter { concept: 'PropertySelectSetter'; /** * 节点变更时间 */ changedTime?: number; } /** * 属性选择设置器 */ export interface PropertyTransformSetter { concept: 'PropertyTransformSetter'; /** * 节点变更时间 */ changedTime?: number; } /** * 匿名函数设置器 */ export interface AnonymousFunctionSetter { concept: 'AnonymousFunctionSetter'; /** * 节点变更时间 */ changedTime?: number; } /** * 页面组件 */ export interface ViewComponentDeclaration { concept: 'ViewComponentDeclaration'; /** * 节点变更时间 */ changedTime?: number; /** * 页面组件名称 */ name: string; /** * 页面组件中划线名称 */ kebabName: string; /** * 页面组件标题 */ title: string; /** * 所在分组 */ group: string; /** * 页面组件图标 */ icon: string; /** * 页面组件描述 */ description?: string; /** * 关于 TS 的 typeParams */ tsTypeParams?: string; /** * 组件属性列表 */ props: Array<PropDeclaration>; /** * 可访问的组件属性列表 */ readableProps: Array<PropDeclaration>; /** * 组件事件列表 */ events: Array<EventDeclaration>; /** * 插槽列表 */ slots: Array<SlotDeclaration>; /** * 逻辑列表 */ methods: Array<LogicDeclaration>; /** * 页面组件列表 */ children: Array<ViewComponentDeclaration>; /** * 页面组件的代码块列表 */ blocks: Array<ViewBlockWithImage>; /** * 主题变量 */ themeVariables: Array<ThemeVariable>; /** * 国际化配置列表 */ i18nMap?: Record<string, Record<string, string>>; } /** * 组件属性 */ export interface PropDeclaration { concept: 'PropDeclaration'; /** * 节点变更时间 */ changedTime?: number; /** * 组件属性名称 */ name: string; /** * 组件属性标题 */ title: string; /** * 组件属性分组 */ group: '基础信息' | '数据属性' | '主要属性' | '交互属性' | '状态属性' | '样式属性' | '工具属性' | '高级属性'; /** * 组件属性图标 */ icon?: string; /** * 组件属性描述 */ description?: string; /** * 类型 * * 直接写 TS 类型 */ tsType: string; /** * 是否支持双向绑定 */ sync: boolean; /** * 是否将任意类型隐式转换成String * * 仅在属性类型为 string(不包括字符串枚举)的情况下,且 sync 为 falsy 时可配置 */ implicitToString?: boolean; /** * 允许该组件在逻辑中设置 */ settable?: boolean; /** * 该属性是否为数据源 */ isDataSource?: boolean; /** * 工具提示链接 */ tooltipLink?: string; /** * 文档描述 */ docDescription?: string; /** * 隐藏绑定属性按钮 */ bindHide: boolean; /** * 绑定属性并打开弹窗 */ bindOpen: boolean; /** * 所在的 tab 页 */ tabKind: 'property' | 'style'; /** * 属性设置器 */ setter: BaseSetter; /** * 属性在面板中的布局方式 * * block 表示标题与设置器分行展示;inline 表示同一行展示 */ layout: 'block' | 'inline'; /** * 默认值 */ defaultValue?: DefaultValue; /** * 渲染时的设计值 */ tsDesignerValue?: string; /** * 是否显隐 * * 用 TS 写表达式,在 IDE 中直接 eval */ tsIf?: string; /** * 是否禁用 * * 用 TS 写表达式,在 IDE 中直接 eval */ tsDisabledIf?: string; /** * 在属性切换时发生的事件 * * 用 TS 写表达式,在 IDE 中直接 eval */ tsOnChange?: string; } /** * 默认值 */ export interface DefaultValue { concept: 'DefaultValue'; /** * 节点变更时间 */ changedTime?: number; /** * 根表达式 */ expression?: LogicItem; /** * 草稿态 */ playground: Array<LogicItem>; } /** * 逻辑项 */ export type LogicItem = NullLiteral | BooleanLiteral | StringLiteral | NumericLiteral | NewList; /** * 类型标注 */ export interface TypeAnnotation { concept: 'TypeAnnotation'; /** * 节点变更时间 */ changedTime?: number; /** * 类型种类 */ typeKind: 'primitive' | 'reference' | 'generic' | 'typeParam' | 'function' | 'union' | 'anonymousStructure'; /** * 类型命名空间 */ typeNamespace?: string; /** * 类型名称 */ typeName?: string; /** * 类型参数 */ typeArguments?: Array<TypeAnnotation>; /** * 返回类型 */ returnType?: Array<TypeAnnotation>; /** * 匿名数据结构属性 */ properties?: Array<StructureProperty>; /** * 规则对象 */ ruleMap?: Record<string, number>; } /** * 数据结构属性 */ export interface StructureProperty { concept: 'StructureProperty'; /** * 节点变更时间 */ changedTime?: number; /** * 数据结构属性名称 */ name: string; /** * 数据结构属性标题 */ label?: string; /** * 数据结构属性描述 */ description?: string; /** * 类型 */ typeAnnotation?: TypeAnnotation; /** * 默认值 * * defaultValue结构体 */ defaultValue?: DefaultValue; /** * 数据结构字段 JSON 的序列化别名 * * JSON 字符串别名 */ jsonName?: string; } /** * 组件事件 */ export interface EventDeclaration { concept: 'EventDeclaration'; /** * 节点变更时间 */ changedTime?: number; /** * 组件事件名称 */ name: string; /** * 组件事件标题 */ title: string; /** * 组件事件描述 */ description?: string; /** * 类型 * * 直接写 TS 类型,这里是个函数类型 */ tsType: string; } /** * 插槽 */ export interface SlotDeclaration { concept: 'SlotDeclaration'; /** * 节点变更时间 */ changedTime?: number; /** * 插槽名称 */ name: string; /** * 插槽标题 */ title: string; /** * 插槽描述 */ description?: string; /** * 类型 * * 直接写 TS 类型 */ tsType: string; /** * 输入参数列表 */ params: Array<Param>; /** * 空的占位图 */ emptyBackground?: string; /** * 插槽代码块 */ snippets: Array<ViewBlockWithImage>; } /** * 输入参数 */ export interface Param { concept: 'Param'; /** * 节点变更时间 */ changedTime?: number; /** * 输入参数名称 */ name: string; /** * 输入参数描述 */ description?: string; /** * 是否为展开参数 */ spread?: boolean; /** * 类型 */ typeAnnotation?: TypeAnnotation; /** * 默认值 */ defaultValue?: DefaultValue; } /** * 页面组件的代码块 */ export interface ViewBlock { concept: 'ViewBlock'; /** * 节点变更时间 */ changedTime?: number; /** * 标题 */ title: string; /** * 代码 */ code: string; /** * 描述 */ description?: string; } /** * 带截图的代码块 */ export interface ViewBlockWithImage { concept: 'ViewBlockWithImage'; /** * 节点变更时间 */ changedTime?: number; /** * 标题 */ title: string; /** * 代码 */ code: string; /** * 描述 */ description?: string; /** * 截图 */ screenshot: string; /** * 手绘 */ drawing: string; } /** * 逻辑声明 */ export interface LogicDeclaration { concept: 'LogicDeclaration'; /** * 节点变更时间 */ changedTime?: number; /** * 逻辑名称 */ name: string; /** * 逻辑标题 */ title: string; /** * 逻辑描述 */ description: string; /** * 类型参数列表 */ typeParams?: Array<TypeParam>; /** * 输入参数列表 */ params: Array<Param>; /** * 输出参数列表 */ returns: Array<Return>; } /** * 类型参数 */ export interface TypeParam { concept: 'TypeParam'; /** * 节点变更时间 */ changedTime?: number; /** * 类型名称 */ name: string; /** * 展示名称 */ displayName?: string; } /** * 输出参数 */ export interface Return { concept: 'Return'; /** * 节点变更时间 */ changedTime?: number; /** * 输出参数名称 */ name: string; /** * 输出参数描述 */ description?: string; /** * 类型 */ typeAnnotation?: TypeAnnotation; /** * 默认值 */ defaultValue?: DefaultValue; } /** * 主题变量 */ export interface ThemeVariable { concept: 'ThemeVariable'; /** * 节点变更时间 */ changedTime?: number; /** * 主题变量名称 */ name: string; } /** * 空字面量 */ export interface NullLiteral { concept: 'NullLiteral'; /** * 节点变更时间 */ changedTime?: number; /** * 逻辑项标题 */ label?: string; /** * 逻辑项描述 */ description?: string; /** * 是否折叠 */ folded?: boolean; /** * offsetX */ offsetX?: number; /** * offsetY */ offsetY?: number; /** * 类型标注 */ typeAnnotation?: TypeAnnotation; } /** * 布尔型字面量 */ export interface BooleanLiteral { concept: 'BooleanLiteral'; /** * 节点变更时间 */ changedTime?: number; /** * 逻辑项标题 */ label?: string; /** * 逻辑项描述 */ description?: string; /** * 是否折叠 */ folded?: boolean; /** * offsetX */ offsetX?: number; /** * offsetY */ offsetY?: number; /** * 类型标注 */ typeAnnotation?: TypeAnnotation; /** * 字面量的值 */ value: string; } /** * 字符串字面量 */ export interface StringLiteral { concept: 'StringLiteral'; /** * 节点变更时间 */ changedTime?: number; /** * 逻辑项标题 */ label?: string; /** * 逻辑项描述 */ description?: string; /** * 是否折叠 */ folded?: boolean; /** * offsetX */ offsetX?: number; /** * offsetY */ offsetY?: number; /** * 类型标注 */ typeAnnotation?: TypeAnnotation; /** * 字面量的值 */ value: string; /** * 国际化键 */ i18nKey?: string; } /** * 数字字面量 */ export interface NumericLiteral { concept: 'NumericLiteral'; /** * 节点变更时间 */ changedTime?: number; /** * 逻辑项标题 */ label?: string; /** * 逻辑项描述 */ description?: string; /** * 是否折叠 */ folded?: boolean; /** * offsetX */ offsetX?: number; /** * offsetY */ offsetY?: number; /** * 类型标注 */ typeAnnotation?: TypeAnnotation; /** * 字面量的值 */ value: string; } /** * 列表构造器 */ export interface NewList { concept: 'NewList'; /** * 节点变更时间 */ changedTime?: number; /** * 逻辑项标题 */ label?: string; /** * 逻辑项描述 */ description?: string; /** * 是否折叠 */ folded?: boolean; /** * offsetX */ offsetX?: number; /** * offsetY */ offsetY?: number; /** * 类型标注 */ typeAnnotation?: TypeAnnotation; /** * 成员表达式 */ items: Array<LogicItem>; } export type UILib = Array<ViewComponentDeclaration>; export default UILib;