@anov/cic-standard-sdk 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,70 @@
1
+ import type { CICConfig, ComponentInstance, DataSourceItem, CICPage, Meta, Layout, Registry, Variables, Dependency } from '../types';
2
+ import type { ICICSDK } from './ICICSDK';
3
+ export type { CICConfig, ComponentInstance, DataSourceItem, CICPage, Meta, Layout, Registry, Variables, Dependency, ICICSDK };
4
+ /**
5
+ * CIC SDK 类
6
+ * 提供对 CIC 配置的封装访问与操作
7
+ */
8
+ export declare class CICSDK implements ICICSDK {
9
+ private config;
10
+ private static validator;
11
+ private static validate;
12
+ private static schemaHash;
13
+ constructor(config: CICConfig);
14
+ getConfig(): CICConfig;
15
+ findComponent(id: string): ComponentInstance | undefined;
16
+ findPageByComponent(componentId: string): CICPage | undefined;
17
+ getVariable(scopeContext: {
18
+ pageId?: string;
19
+ componentId?: string;
20
+ }, key: string): any;
21
+ getVariableByRef(ref: string): any;
22
+ walkComponents(callback: (component: ComponentInstance, page: CICPage, parent?: ComponentInstance) => void | boolean): void;
23
+ /**
24
+ * 全面配置校验 (基于 JSON Schema)
25
+ */
26
+ static validateConfig(config: CICConfig): {
27
+ valid: boolean;
28
+ error?: string;
29
+ };
30
+ /**
31
+ * 按路径获取对象值(支持 a.b[0].c 语法)
32
+ */
33
+ static getValueByPath(obj: any, path: string, fallback?: any): any;
34
+ /**
35
+ * 深度遍历组件树(纯函数递归版本)
36
+ * 用于单独处理某个组件树片段
37
+ */
38
+ static traverseTree(root: ComponentInstance | ComponentInstance[], callback: (component: ComponentInstance, parent?: ComponentInstance) => void | boolean, parent?: ComponentInstance): void;
39
+ /** 创建 DataSource */
40
+ static createDataSource: (input: unknown, options?: import("./generators/common").CreateOptions) => import("./generators/common").Result<DataSourceItem>;
41
+ static validateDataSource: (input: unknown) => import("./generators/common").Result<null>;
42
+ static normalizeDataSource: (input: unknown, options?: import("./generators/common").CreateOptions) => DataSourceItem;
43
+ /** 创建 Component */
44
+ static createComponent: (input: unknown, options?: import("./generators/common").CreateOptions) => import("./generators/common").Result<ComponentInstance>;
45
+ static validateComponent: (input: unknown) => import("./generators/common").Result<null>;
46
+ static normalizeComponent: (input: unknown, options?: import("./generators/common").CreateOptions) => ComponentInstance;
47
+ /** 创建 Page */
48
+ static createPage: (input: unknown, options?: import("./generators/common").CreateOptions) => import("./generators/common").Result<CICPage>;
49
+ static validatePage: (input: unknown) => import("./generators/common").Result<null>;
50
+ static normalizePage: (input: unknown, options?: import("./generators/common").CreateOptions) => CICPage;
51
+ /** 创建 Meta/Layout */
52
+ static createMeta: (input: unknown) => import("./generators/common").Result<Meta>;
53
+ static createLayout: (input: unknown) => import("./generators/common").Result<Layout>;
54
+ static validateMeta: (input: unknown) => import("./generators/common").Result<null>;
55
+ static validateLayout: (input: unknown) => import("./generators/common").Result<null>;
56
+ static normalizeMeta: (input: unknown) => Meta;
57
+ static normalizeLayout: (input: unknown) => Layout;
58
+ /** 创建 Variables */
59
+ static createVariables: (input: unknown) => import("./generators/common").Result<Variables>;
60
+ static validateVariables: (input: unknown) => import("./generators/common").Result<null>;
61
+ static normalizeVariables: (input: unknown) => Variables;
62
+ /** 创建 Dependency */
63
+ static createDependency: (input: unknown) => import("./generators/common").Result<Dependency>;
64
+ static validateDependency: (input: unknown) => import("./generators/common").Result<null>;
65
+ static normalizeDependency: (input: unknown) => Dependency;
66
+ /** 创建 Registry 组件项 */
67
+ static createRegistryComponent: (input: unknown) => import("./generators/common").Result<import("../types/registry").RegistryComponents>;
68
+ static validateRegistryComponent: (input: unknown) => import("./generators/common").Result<null>;
69
+ static normalizeRegistryComponent: (input: unknown) => import("../types/registry").RegistryComponents;
70
+ }
@@ -0,0 +1,43 @@
1
+ import { CICConfig } from '../types';
2
+ import { CICPage } from '../types/page';
3
+ import { ComponentInstance } from '../types/componets';
4
+ /**
5
+ * CIC SDK 接口定义
6
+ * 定义了 SDK 必须提供的核心能力,实现与定义解耦。
7
+ */
8
+ export interface ICICSDK {
9
+ /**
10
+ * 获取当前完整的配置对象
11
+ */
12
+ getConfig(): CICConfig;
13
+ /**
14
+ * 按 ID 查找组件实例
15
+ * @param id 组件 ID
16
+ */
17
+ findComponent(id: string): ComponentInstance | undefined;
18
+ /**
19
+ * 查找组件所属的页面
20
+ * @param componentId 组件 ID
21
+ */
22
+ findPageByComponent(componentId: string): CICPage | undefined;
23
+ /**
24
+ * 获取变量值
25
+ * 遵循作用域链:Component -> Page -> Global
26
+ * @param scopeContext 作用域上下文 { pageId?, componentId? }
27
+ * @param key 变量名
28
+ */
29
+ getVariable(scopeContext: {
30
+ pageId?: string;
31
+ componentId?: string;
32
+ }, key: string): any;
33
+ /**
34
+ * 通过引用字符串获取变量
35
+ * @param ref 引用字符串 (e.g. "global.theme", "page:p1.title")
36
+ */
37
+ getVariableByRef(ref: string): any;
38
+ /**
39
+ * 遍历所有组件
40
+ * @param callback 回调函数,返回 false 可终止遍历
41
+ */
42
+ walkComponents(callback: (component: ComponentInstance, page: CICPage, parent?: ComponentInstance) => void | boolean): void;
43
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Ajv 单例与子 Schema 校验器
3
+ * 说明:复用项目主 Schema(Draft-07),按需编译子定义(#/definitions/...)。
4
+ * 注意:strict 关闭以兼容联合与 const/enum 的复杂组合。
5
+ */
6
+ import Ajv from 'ajv';
7
+ export declare const getAjv: () => Ajv;
8
+ export declare const getValidator: (ref: string) => any;
9
+ export declare const getValidatorByType: (typeName: string) => any;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * 生成器通用工具与类型
3
+ * 说明:统一 Result/Options 定义与常用规范化工具(uuid/url/数组/数值)。
4
+ * 原则:严格模式默认不做隐式容错;仅在 defaults 显式提供时才补齐默认值。
5
+ */
6
+ export type Result<T> = {
7
+ ok: boolean;
8
+ value?: T;
9
+ errors?: any[];
10
+ };
11
+ export type CreateOptions = {
12
+ defaults?: Record<string, any>;
13
+ generateId?: boolean;
14
+ strict?: boolean;
15
+ throw?: boolean;
16
+ };
17
+ /** 将值规范为数组 */
18
+ export declare const ensureArray: <T>(v: any) => T[];
19
+ /** 判断为有限正数 */
20
+ export declare const isPositive: (n: any) => boolean;
21
+ /** 生成 uuid(浏览器环境降级) */
22
+ export declare const uuid: () => any;
23
+ /** 规范 http(s) 链接 */
24
+ export declare const httpUrl: (s: any, fallback?: string) => string;
25
+ /** 规范 ws(s) 链接 */
26
+ export declare const wsUrl: (s: any, fallback?: string) => string;
@@ -0,0 +1,5 @@
1
+ import { Result, CreateOptions } from './common';
2
+ import { ComponentInstance } from '../../types/componets';
3
+ export declare const validateComponent: (input: unknown) => Result<null>;
4
+ export declare const createComponent: (input: unknown, options?: CreateOptions) => Result<ComponentInstance>;
5
+ export declare const normalizeComponent: (input: unknown, options?: CreateOptions) => ComponentInstance;
@@ -0,0 +1,5 @@
1
+ import { Result, CreateOptions } from './common';
2
+ import { DataSourceItem } from '../../types/dataSources';
3
+ export declare const validateDataSource: (input: unknown) => Result<null>;
4
+ export declare const createDataSource: (input: unknown, options?: CreateOptions) => Result<DataSourceItem>;
5
+ export declare const normalizeDataSource: (input: unknown, options?: CreateOptions) => DataSourceItem;
@@ -0,0 +1,5 @@
1
+ import { Result } from './common';
2
+ import { Dependency } from '../../types/deps';
3
+ export declare const validateDependency: (input: unknown) => Result<null>;
4
+ export declare const createDependency: (input: unknown) => Result<Dependency>;
5
+ export declare const normalizeDependency: (input: unknown) => Dependency;
@@ -0,0 +1,8 @@
1
+ import { Result } from './common';
2
+ import { Meta, Layout } from '../../types/meta';
3
+ export declare const validateMeta: (input: unknown) => Result<null>;
4
+ export declare const validateLayout: (input: unknown) => Result<null>;
5
+ export declare const createMeta: (input: unknown) => Result<Meta>;
6
+ export declare const createLayout: (input: unknown) => Result<Layout>;
7
+ export declare const normalizeMeta: (input: unknown) => Meta;
8
+ export declare const normalizeLayout: (input: unknown) => Layout;
@@ -0,0 +1,5 @@
1
+ import { Result, CreateOptions } from './common';
2
+ import { CICPage } from '../../types/page';
3
+ export declare const validatePage: (input: unknown) => Result<null>;
4
+ export declare const createPage: (input: unknown, options?: CreateOptions) => Result<CICPage>;
5
+ export declare const normalizePage: (input: unknown, options?: CreateOptions) => CICPage;
@@ -0,0 +1,5 @@
1
+ import { Result } from './common';
2
+ import { RegistryComponents } from '../../types/registry';
3
+ export declare const validateRegistryComponent: (input: unknown) => Result<null>;
4
+ export declare const createRegistryComponent: (input: unknown) => Result<RegistryComponents>;
5
+ export declare const normalizeRegistryComponent: (input: unknown) => RegistryComponents;
@@ -0,0 +1,5 @@
1
+ import { Result } from './common';
2
+ import { Variables } from '../../types/variables';
3
+ export declare const validateVariables: (input: unknown) => Result<null>;
4
+ export declare const createVariables: (input: unknown) => Result<Variables>;
5
+ export declare const normalizeVariables: (input: unknown) => Variables;
@@ -0,0 +1,49 @@
1
+ import { CICEventMap } from './events';
2
+ import { Data } from './data';
3
+ /** 通用表达式(用于条件、模板等) */
4
+ export type Expr = string;
5
+ /** 样式值可以是静态或表达式 */
6
+ export type StyleValue = string | number | Expr;
7
+ /** component 引用:字符串或 object 描述 */
8
+ export type ComponentRef = string | {
9
+ type: "id";
10
+ value: string;
11
+ };
12
+ export type LogicRef = string | {
13
+ type: "url" | "code";
14
+ value: string;
15
+ };
16
+ /**
17
+ * 组件的语义分类(view/container/logic)
18
+ * - view: 可视化渲染组件
19
+ * - container: 容器,包含 children
20
+ * - logic: 逻辑/脚本组件
21
+ */
22
+ export type ComponentType = 'view' | 'container' | 'logic';
23
+ /** 组件实例 */
24
+ export interface ComponentBase {
25
+ id: string;
26
+ props?: Record<string, any>;
27
+ style?: Record<string, StyleValue>;
28
+ events?: CICEventMap;
29
+ data?: Data;
30
+ deps?: string[];
31
+ extensions?: Record<string, any>;
32
+ }
33
+ export interface ViewComponentInstance extends ComponentBase {
34
+ role: 'view';
35
+ component: ComponentRef;
36
+ children?: never;
37
+ }
38
+ export interface ContainerComponentInstance extends ComponentBase {
39
+ role: 'container';
40
+ children: ComponentInstance[];
41
+ component?: never;
42
+ }
43
+ export interface LogicComponentInstanceRef extends ComponentBase {
44
+ role: 'logic';
45
+ component: LogicRef;
46
+ children?: never;
47
+ }
48
+ /** 组件实例(view/container/logic 类型) */
49
+ export type ComponentInstance = ViewComponentInstance | ContainerComponentInstance | LogicComponentInstanceRef;
@@ -0,0 +1,35 @@
1
+ /** 字段映射配置 */
2
+ export interface IMapping {
3
+ use: boolean;
4
+ mapFields: Array<{
5
+ /** 源字段名 */
6
+ field: string;
7
+ /** 目标字段名 */
8
+ mapField: string;
9
+ /** 映射值或公式 */
10
+ value?: any;
11
+ /** 映射类型:默认(普通映射)、copy(复制) const(常量)、formula(公式) */
12
+ type?: 'copy' | 'const' | 'formula';
13
+ /** 描述 */
14
+ description?: string;
15
+ }>;
16
+ }
17
+ /** 转换规则配置 */
18
+ export interface IConverse {
19
+ use: boolean;
20
+ data: Array<{
21
+ /** 转换代码 */
22
+ code: string;
23
+ /** 依赖变量列表(用于响应式重执行) */
24
+ depeedVars?: Array<string>;
25
+ }>;
26
+ }
27
+ /** 数据配置 */
28
+ export interface Data {
29
+ /** 数据ID */
30
+ id: string;
31
+ /** 字段映射配置 */
32
+ mapping?: IMapping;
33
+ /** 转换规则配置 */
34
+ converse?: IConverse;
35
+ }
@@ -0,0 +1,38 @@
1
+ export type Milliseconds = number;
2
+ export interface DataSourceBase {
3
+ id: string;
4
+ type: string;
5
+ order?: number;
6
+ pollInterval?: Milliseconds;
7
+ transform?: string | ((res: any) => any);
8
+ }
9
+ export interface DataSourceRest extends DataSourceBase {
10
+ type: "rest";
11
+ url: string;
12
+ method: "GET" | "POST" | "PUT" | "DELETE";
13
+ headers?: Record<string, string>;
14
+ params?: Record<string, any>;
15
+ body?: any;
16
+ timeout?: Milliseconds;
17
+ }
18
+ export interface DataSourceWebSocket extends DataSourceBase {
19
+ type: "websocket";
20
+ url: string;
21
+ protocols?: string | string[];
22
+ subscribeMessage?: any;
23
+ heartbeat?: {
24
+ interval: Milliseconds;
25
+ message: any;
26
+ };
27
+ }
28
+ export interface DataSourceStatic extends DataSourceBase {
29
+ type: "static";
30
+ value: any;
31
+ }
32
+ export interface DataSourceFunction extends DataSourceBase {
33
+ type: "function";
34
+ code: string;
35
+ timeout?: Milliseconds;
36
+ }
37
+ /** 数据源项(rest/websocket/static/function 类型) */
38
+ export type DataSourceItem = DataSourceRest | DataSourceWebSocket | DataSourceStatic | DataSourceFunction;
@@ -0,0 +1,71 @@
1
+ /** 资源类型 */
2
+ export type ResourceType = 'js' | 'css' | 'font' | 'image' | 'json' | 'wasm' | 'other';
3
+ /** JS 格式 */
4
+ export type JSFormat = 'esm' | 'umd' | 'iife' | 'cjs';
5
+ /**
6
+ * 公共字段
7
+ */
8
+ export interface BaseDependency {
9
+ /** 全局唯一 ID,用于运行时索引 */
10
+ id: string;
11
+ /** 可选:人类可读名称(展示用) */
12
+ name?: string;
13
+ /** 版本号(语义化版本 / 字体权重皆可) */
14
+ version?: string;
15
+ /** 资源 URL,可以是绝对地址或相对地址 */
16
+ url?: string;
17
+ /** 本地路径(构建后使用) */
18
+ localPath?: string;
19
+ /** 分组:方便批量加载 */
20
+ group?: string;
21
+ /** 加载策略 */
22
+ strategy?: {
23
+ /** 预加载/预取 */
24
+ preload?: boolean | 'module' | 'style';
25
+ prefetch?: boolean;
26
+ /** 是否异步加载 */
27
+ async?: boolean;
28
+ /** 仅在某些条件下加载(如主题) */
29
+ when?: string;
30
+ };
31
+ }
32
+ /** JS 资源 */
33
+ export interface JSDependency extends BaseDependency {
34
+ type: 'js';
35
+ format: JSFormat;
36
+ crossOrigin?: 'anonymous' | 'use-credentials';
37
+ module?: boolean;
38
+ }
39
+ /** CSS */
40
+ export interface CSSDependency extends BaseDependency {
41
+ type: 'css';
42
+ media?: string;
43
+ }
44
+ /** 字体 */
45
+ export interface FontDependency extends BaseDependency {
46
+ type: 'font';
47
+ family?: string;
48
+ weight?: number | string;
49
+ style?: 'normal' | 'italic';
50
+ }
51
+ /** 图片 */
52
+ export interface ImageDependency extends BaseDependency {
53
+ type: 'image';
54
+ mime?: string;
55
+ }
56
+ /** JSON */
57
+ export interface JSONDependency extends BaseDependency {
58
+ type: 'json';
59
+ }
60
+ /** WASM */
61
+ export interface WasmDependency extends BaseDependency {
62
+ type: 'wasm';
63
+ init?: 'async' | 'sync';
64
+ }
65
+ /** 其他 */
66
+ export interface OtherDependency extends BaseDependency {
67
+ type: 'other';
68
+ kind?: string;
69
+ }
70
+ /** 依赖项 */
71
+ export type Dependency = JSDependency | CSSDependency | FontDependency | ImageDependency | JSONDependency | WasmDependency | OtherDependency;
@@ -0,0 +1,133 @@
1
+ /** 所有事件大类 */
2
+ export type EventType = 'vars' | 'navigate' | 'comp' | 'toggle' | 'camera' | 'material' | 'custom' | string;
3
+ /** 变量事件动作 */
4
+ export type VarsAction = 'add' | 'update' | 'delete';
5
+ /** 跳转事件动作 */
6
+ export type NavigateAction = 'internal' | 'external';
7
+ /** 组件事件动作 */
8
+ export type CompAction = 'add' | 'update' | 'delete';
9
+ /** 切换事件动作 */
10
+ export type ToggleAction = 'visibility';
11
+ /** 相机动作 */
12
+ export type CameraAction = 'focus';
13
+ /** 材质动作 */
14
+ export type MaterialAction = 'change';
15
+ /** 自定义动作 */
16
+ export type CustomAction = 'local' | 'remote';
17
+ export interface VarsParams {
18
+ key: string;
19
+ value: any;
20
+ exclude?: string[];
21
+ }
22
+ export interface NavigateInternalParams {
23
+ name: string;
24
+ params?: Record<string, any>;
25
+ }
26
+ export interface NavigateExternalParams {
27
+ url: string;
28
+ openNewTab?: boolean;
29
+ }
30
+ export interface CompParams {
31
+ comps: string[];
32
+ props?: Record<string, any>;
33
+ }
34
+ export interface ToggleParams {
35
+ show?: string[];
36
+ hide?: string[];
37
+ }
38
+ export interface CameraFocusParams {
39
+ target: string | number;
40
+ duration?: number;
41
+ }
42
+ export interface MaterialChangeParams {
43
+ target: string;
44
+ materials: string;
45
+ }
46
+ export interface CustomLocalParams {
47
+ code: string;
48
+ depends?: string[];
49
+ }
50
+ export interface CustomRemoteParams {
51
+ url: string;
52
+ depends?: string[];
53
+ }
54
+ export type ConditionOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'not-in' | 'exists' | 'not-exists';
55
+ export interface KeyCondition {
56
+ key: string;
57
+ op?: ConditionOperator;
58
+ value?: any;
59
+ }
60
+ /** 表达式条件:支持如 "ctx.id === 5 && ctx.level > 1" */
61
+ export interface ExpressionCondition {
62
+ expression: string;
63
+ }
64
+ /** 多条件(AND) + 表达式 */
65
+ export type EventCondition = KeyCondition | KeyCondition[] | ExpressionCondition;
66
+ /** 不同事件类型对应不同结构 */
67
+ /** 变量事件 */
68
+ export interface VarsEvent {
69
+ type: 'vars';
70
+ action: VarsAction;
71
+ params: VarsParams;
72
+ }
73
+ /** 内部跳转事件 */
74
+ export interface NavigateInternalEvent {
75
+ type: 'navigate';
76
+ action: 'internal';
77
+ params: NavigateInternalParams;
78
+ }
79
+ /** 外部跳转事件 */
80
+ export interface NavigateExternalEvent {
81
+ type: 'navigate';
82
+ action: 'external';
83
+ params: NavigateExternalParams;
84
+ }
85
+ /** 组件事件 */
86
+ export interface CompEvent {
87
+ type: 'comp';
88
+ action: CompAction;
89
+ params: CompParams;
90
+ }
91
+ /** 显示隐藏切换事件 */
92
+ export interface ToggleEvent {
93
+ type: 'toggle';
94
+ action: 'visibility';
95
+ params: ToggleParams;
96
+ }
97
+ /** 相机事件 */
98
+ export interface CameraEvent {
99
+ type: 'camera';
100
+ action: 'focus';
101
+ params: CameraFocusParams;
102
+ }
103
+ /** 材质事件 */
104
+ export interface MaterialEvent {
105
+ type: 'material';
106
+ action: 'change';
107
+ params: MaterialChangeParams;
108
+ }
109
+ /** 自定义本地事件 */
110
+ export interface CustomLocalEvent {
111
+ type: 'custom';
112
+ action: 'local';
113
+ params: CustomLocalParams;
114
+ }
115
+ /** 自定义远程事件 */
116
+ export interface CustomRemoteEvent {
117
+ type: 'custom';
118
+ action: 'remote';
119
+ params: CustomRemoteParams;
120
+ }
121
+ /** 最终事件联合类型 */
122
+ export type CICEvent = VarsEvent | NavigateInternalEvent | NavigateExternalEvent | CompEvent | ToggleEvent | CameraEvent | MaterialEvent | CustomLocalEvent | CustomRemoteEvent;
123
+ /** 带调度信息 */
124
+ export type CICEventWithMeta = CICEvent & {
125
+ order: number;
126
+ delay?: number;
127
+ condition?: EventCondition;
128
+ };
129
+ /** 某组件的所有事件
130
+ * 说明:定义了 CIC 项目中组件的所有事件,包含事件类型、动作、参数、调度顺序、延迟时间和条件。
131
+ * (key: 事件名, value: 处理逻辑数组)
132
+ */
133
+ export type CICEventMap = Record<string, CICEventWithMeta[]>;
@@ -0,0 +1,23 @@
1
+ import { Meta, Layout } from './meta';
2
+ import { Registry } from './registry';
3
+ import { Variables } from './variables';
4
+ import { Dependency } from './deps';
5
+ import { CICPage, ComponentInstance, DataSourceItem } from './page';
6
+ /**
7
+ * CIC 配置定义
8
+ * 说明:定义了 CIC 项目的全局配置,包含版本、元数据、页面、组件、变量、依赖等。
9
+ */
10
+ export interface CICConfig {
11
+ version: string;
12
+ meta: Meta;
13
+ pages: CICPage[];
14
+ registry?: Registry;
15
+ variables?: Variables;
16
+ deps?: Dependency[];
17
+ extensions?: Record<string, any>;
18
+ }
19
+ /**
20
+ * CIC 类型定义
21
+ * 说明:定义了 CIC 项目中使用的各种类型,包括元数据、布局、页面、组件、变量、依赖项等。
22
+ */
23
+ export type { Meta, Layout, CICPage, Registry, Variables, Dependency, ComponentInstance, DataSourceItem };
@@ -0,0 +1,54 @@
1
+ /**布局配置 */
2
+ export interface Layout {
3
+ /** 布局类型: free(自由布局) 或 grid(网格布局) */
4
+ type: "free" | "grid";
5
+ config: {
6
+ /**
7
+ * 设计稿宽度
8
+ * @minimum 1
9
+ * @default 1920
10
+ */
11
+ width: number;
12
+ /**
13
+ * 设计稿高度
14
+ * @minimum 1
15
+ * @default 1080
16
+ */
17
+ height: number;
18
+ /**
19
+ * 缩放模式
20
+ * @default "aspectFit"
21
+ */
22
+ scaleMode: "aspectFit" | "fill";
23
+ };
24
+ }
25
+ /**
26
+ * 项目元信息
27
+ * 包含项目的基本信息、布局配置、语言、创建时间、更新时间、作者和扩展信息。
28
+ */
29
+ export interface Meta {
30
+ /** 项目唯一标识符 */
31
+ projectId?: string;
32
+ /** 项目名称 */
33
+ projectName?: string;
34
+ /** 项目描述 */
35
+ description?: string;
36
+ /** 布局配置 */
37
+ layout?: Layout;
38
+ /** 语言代码 (e.g. zh-CN, en-US) */
39
+ language?: string;
40
+ /**
41
+ * 创建时间 (ISO 8601)
42
+ * @format date-time
43
+ */
44
+ createTime?: string;
45
+ /**
46
+ * 更新时间 (ISO 8601)
47
+ * @format date-time
48
+ */
49
+ updateTime?: string;
50
+ /** 作者 */
51
+ author?: string;
52
+ /** 扩展字段 */
53
+ extensions?: Record<string, any>;
54
+ }
@@ -0,0 +1,17 @@
1
+ import { ComponentInstance } from './componets';
2
+ import { DataSourceItem } from './dataSources';
3
+ import { Layout } from './meta';
4
+ /**
5
+ * CIC 页面定义
6
+ * 说明:定义了 CIC 中页面的结构,包含页面 ID、名称、路径、布局、组件等。
7
+ */
8
+ interface CICPage {
9
+ id: string;
10
+ name: string;
11
+ path: string;
12
+ layout?: Layout;
13
+ components?: ComponentInstance[];
14
+ dataSources?: DataSourceItem[];
15
+ extensions?: Record<string, any>;
16
+ }
17
+ export type { CICPage, ComponentInstance, DataSourceItem };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * 注册中心组件项
3
+ * 说明:定义了 CIC 项目中组件注册中心的组件项,包含组件 ID、类型和配置。
4
+ */
5
+ export interface RegistryComponents {
6
+ id: string;
7
+ name?: string;
8
+ description?: string;
9
+ version?: string;
10
+ author?: string;
11
+ defaultProps?: Record<string, any>;
12
+ data?: any;
13
+ deps?: string[];
14
+ }
15
+ /**
16
+ * 注册表
17
+ */
18
+ export interface Registry {
19
+ components?: RegistryComponents[];
20
+ /**插件后期可扩展 */
21
+ plugins?: Record<string, any>;
22
+ }