@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,58 @@
1
+ /** 变量类型枚举,限定变量的基础类型:字符串、数字、布尔、数组、对象和函数。 */
2
+ export type VariableType = 'string' | 'number' | 'boolean' | 'array' | 'object' | 'function';
3
+ /** 字符串变量,包含当前值与默认值,可选描述。 */
4
+ export interface StringVariable {
5
+ type: 'string';
6
+ value: string;
7
+ default: string;
8
+ description?: string;
9
+ }
10
+ /** 数字变量,包含当前值与默认值,可选描述。 */
11
+ export interface NumberVariable {
12
+ type: 'number';
13
+ value: number;
14
+ default: number;
15
+ description?: string;
16
+ }
17
+ /** 布尔变量,包含当前值与默认值,可选描述。 */
18
+ export interface BooleanVariable {
19
+ type: 'boolean';
20
+ value: boolean;
21
+ default: boolean;
22
+ description?: string;
23
+ }
24
+ /** 数组变量,元素类型不做限制,包含当前值与默认值,可选描述。 */
25
+ export interface ArrayVariable {
26
+ type: 'array';
27
+ value: unknown[];
28
+ default: unknown[];
29
+ description?: string;
30
+ }
31
+ /** 函数变量,以字符串保存函数实现;支持 `args` 指定入参名列表。 */
32
+ export interface FunctionVariable {
33
+ type: 'function';
34
+ value: string;
35
+ default: string;
36
+ description?: string;
37
+ args?: string[];
38
+ }
39
+ /** 对象变量,键到变量的映射;支持递归嵌套。 */
40
+ export interface ObjectVariable {
41
+ type: 'object';
42
+ value: Record<string, Variable>;
43
+ default: Record<string, Variable>;
44
+ description?: string;
45
+ }
46
+ /** 变量联合类型,涵盖五类变量定义。 */
47
+ export type Variable = StringVariable | NumberVariable | BooleanVariable | ArrayVariable | FunctionVariable | ObjectVariable;
48
+ /** 变量映射,键为变量名,值为变量定义。 */
49
+ export type VariablesMap = Record<string, Variable>;
50
+ /** 变量集合,按作用域组织:global/page/component。 */
51
+ export interface Variables {
52
+ /** 全局变量,对所有页面和组件均生效。 */
53
+ global: VariablesMap;
54
+ /** 页面级变量,键为页面 ID,值为该页面的变量映射。 */
55
+ page: Record<string, VariablesMap>;
56
+ /** 组件级变量,键为组件 ID,值为该组件的变量映射。 */
57
+ component: Record<string, VariablesMap>;
58
+ }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@anov/cic-standard-sdk",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "CIC Standard SDK with TypeScript support",
5
5
  "main": "dist/cic-sdk.cjs.js",
6
6
  "module": "dist/cic-sdk.es.js",
7
- "types": "dist/index.d.ts",
7
+ "types": "dist/sdk/CICSDK.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
10
  "import": "./dist/cic-sdk.es.js",
@@ -20,7 +20,8 @@
20
20
  "sideEffects": false,
21
21
  "scripts": {
22
22
  "dev": "vite",
23
- "build": "vite build",
23
+ "build": "vite build && npm run build:types",
24
+ "build:types": "tsc -p tsconfig.json",
24
25
  "test": "vitest",
25
26
  "test:coverage": "vitest run --coverage",
26
27
  "gen:schema": "tsx scripts/generate-schema.ts",