@vtj/core 0.17.7 → 0.18.0

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vtj/core",
3
3
  "private": false,
4
- "version": "0.17.7",
4
+ "version": "0.18.0",
5
5
  "type": "module",
6
6
  "keywords": [
7
7
  "低代码引擎",
@@ -12,7 +12,7 @@
12
12
  "代码生成器",
13
13
  "代码可视化"
14
14
  ],
15
- "description": "VTJ 是一款基于 Vue3 + Typescript 的低代码页面可视化设计器。内置低代码引擎、渲染器和代码生成器,面向前端开发者,开箱即用。 无缝嵌入本地开发工程,不改变前端开发流程和编码习惯。",
15
+ "description": "VTJ.PRO 是一个开源的、AI 驱动的 Vue3 企业级应用开发平台,通过 AI 智能体与可视化编排实现高效开发,并支持导出标准 Vue 代码以避免平台锁定。",
16
16
  "repository": {
17
17
  "type": "git",
18
18
  "url": "https://gitee.com/newgateway/vtj.git"
@@ -21,10 +21,10 @@
21
21
  "author": "chenhuachun",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@vtj/base": "~0.12.4"
24
+ "@vtj/base": "~0.13.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@vtj/cli": "~0.12.20"
27
+ "@vtj/cli": "~0.13.0"
28
28
  },
29
29
  "exports": {
30
30
  ".": {
@@ -1,4 +1,4 @@
1
- import { BlockSchema, BlockInject, BlockState, JSFunction, JSONValue, JSExpression, BlockWatch, BlockProp, DataSourceSchema, BlockEmit, BlockSlot } from '../protocols';
1
+ import { BlockSchema, BlockApiMode, BlockInject, BlockState, JSFunction, JSONValue, JSExpression, BlockWatch, BlockProp, BlockComposable, DataSourceSchema, BlockEmit, BlockSlot } from '../protocols';
2
2
  import { NodeModel } from './node';
3
3
  /**
4
4
  * 节点放置位置
@@ -12,12 +12,18 @@ export declare class BlockModel {
12
12
  readonly __VTJ_BLOCK__: boolean;
13
13
  readonly id: string;
14
14
  name: string;
15
+ apiMode: BlockApiMode;
15
16
  inject: BlockInject[];
16
17
  state: BlockState;
18
+ refs: Record<string, JSONValue | JSExpression>;
19
+ reactives: Record<string, JSONValue | JSExpression>;
17
20
  lifeCycles: Record<string, JSFunction>;
18
21
  methods: Record<string, JSFunction>;
19
- computed: Record<string, JSFunction>;
22
+ computed: Record<string, JSFunction | JSExpression>;
20
23
  watch: BlockWatch[];
24
+ composables: BlockComposable[];
25
+ setup: JSFunction | undefined;
26
+ provide: Record<string, JSONValue | JSExpression | JSFunction>;
21
27
  css: string;
22
28
  props: Array<string | BlockProp>;
23
29
  emits: Array<string | BlockEmit>;
@@ -39,6 +45,7 @@ export declare class BlockModel {
39
45
  * 销毁
40
46
  */
41
47
  dispose(): void;
48
+ isExistName(name: string): boolean;
42
49
  /**
43
50
  * 设置通用函数属性
44
51
  * @param type
@@ -54,6 +61,7 @@ export declare class BlockModel {
54
61
  * @param silent
55
62
  */
56
63
  removeFunction(type: 'methods' | 'computed' | 'lifeCycles', name: string, silent?: boolean): void;
64
+ setComputed(name: string, value?: JSFunction | JSExpression, silent?: boolean): void;
57
65
  /**
58
66
  * 设置状态
59
67
  * @param name
@@ -146,6 +154,69 @@ export declare class BlockModel {
146
154
  * @param silent
147
155
  */
148
156
  removeDataSource(name: string, silent?: boolean): void;
157
+ /**
158
+ * 设置 API 风格
159
+ * @param mode
160
+ * @param silent
161
+ */
162
+ setApiMode(mode: BlockApiMode, silent?: boolean): void;
163
+ /**
164
+ * 设置 ref 声明
165
+ * @param name
166
+ * @param value
167
+ * @param silent
168
+ */
169
+ setRef(name: string, value: JSONValue | JSExpression, silent?: boolean): void;
170
+ /**
171
+ * 删除 ref 声明
172
+ * @param name
173
+ * @param silent
174
+ */
175
+ removeRef(name: string, silent?: boolean): void;
176
+ /**
177
+ * 设置 reactive 声明
178
+ * @param name
179
+ * @param value
180
+ * @param silent
181
+ */
182
+ setReactive(name: string, value: JSONValue | JSExpression, silent?: boolean): void;
183
+ /**
184
+ * 删除 reactive 声明
185
+ * @param name
186
+ * @param silent
187
+ */
188
+ removeReactive(name: string, silent?: boolean): void;
189
+ /**
190
+ * 设置组合函数调用
191
+ * @param composable
192
+ * @param silent
193
+ */
194
+ setComposable(composable: BlockComposable, silent?: boolean): void;
195
+ /**
196
+ * 删除组合函数调用
197
+ * @param name
198
+ * @param silent
199
+ */
200
+ removeComposable(name: string, silent?: boolean): void;
201
+ /**
202
+ * 设置 provide
203
+ * @param key
204
+ * @param value
205
+ * @param silent
206
+ */
207
+ setProvide(key: string, value: JSONValue | JSExpression | JSFunction, silent?: boolean): void;
208
+ /**
209
+ * 删除 provide
210
+ * @param key
211
+ * @param silent
212
+ */
213
+ removeProvide(key: string, silent?: boolean): void;
214
+ /**
215
+ * 设置 setup 初始化代码
216
+ * @param code
217
+ * @param silent
218
+ */
219
+ setSetup(code: JSFunction | undefined, silent?: boolean): void;
149
220
  private insertAfter;
150
221
  private insertBefore;
151
222
  private appendNode;
@@ -47,4 +47,12 @@ export interface Dependencie {
47
47
  * 资产配置导出名称
48
48
  */
49
49
  assetsLibrary?: string;
50
+ /**
51
+ * UniApp easycom
52
+ */
53
+ easycom?: Easycom;
54
+ }
55
+ export interface Easycom {
56
+ key: string;
57
+ value: string;
50
58
  }
@@ -1,6 +1,10 @@
1
1
  import { JSExpression, JSFunction, JSONValue } from '../shared';
2
2
  import { NodeSchema } from './node';
3
3
  import { DataSourceSchema } from './dataSource';
4
+ /**
5
+ * API 风格
6
+ */
7
+ export type BlockApiMode = 'options' | 'composition';
4
8
  export interface BlockSchema {
5
9
  /**
6
10
  * 唯一标识
@@ -14,14 +18,26 @@ export interface BlockSchema {
14
18
  * 锁定
15
19
  */
16
20
  locked?: boolean;
21
+ /**
22
+ * API 风格,默认 options
23
+ */
24
+ apiMode?: BlockApiMode;
17
25
  /**
18
26
  * 注入
19
27
  */
20
28
  inject?: BlockInject[];
21
29
  /**
22
- * 状态数据
30
+ * 状态数据 (Options 模式)
23
31
  */
24
32
  state?: BlockState;
33
+ /**
34
+ * ref 响应式声明 (Composition 模式)
35
+ */
36
+ refs?: Record<string, JSONValue | JSExpression>;
37
+ /**
38
+ * reactive 响应式声明 (Composition 模式)
39
+ */
40
+ reactives?: Record<string, JSONValue | JSExpression>;
25
41
  /**
26
42
  * 生命周期集
27
43
  */
@@ -33,11 +49,24 @@ export interface BlockSchema {
33
49
  /**
34
50
  * 计算属性
35
51
  */
36
- computed?: Record<string, JSFunction>;
52
+ computed?: Record<string, JSFunction | JSExpression>;
37
53
  /**
38
54
  * 侦听器
39
55
  */
40
56
  watch?: BlockWatch[];
57
+ /**
58
+ * 组合函数调用 (Composition 模式)
59
+ */
60
+ composables?: BlockComposable[];
61
+ /**
62
+ * setup 初始化代码 (Composition 模式)
63
+ * 在 refs/reactives/composables 创建之后、组件挂载之前执行
64
+ */
65
+ setup?: JSFunction;
66
+ /**
67
+ * provide 声明
68
+ */
69
+ provide?: Record<string, JSONValue | JSExpression | JSFunction>;
41
70
  /**
42
71
  * 样式
43
72
  */
@@ -103,8 +132,30 @@ export interface BlockWatch {
103
132
  source: JSFunction | JSExpression;
104
133
  deep?: boolean;
105
134
  immediate?: boolean;
135
+ flush?: 'pre' | 'post' | 'sync';
106
136
  handler: JSFunction;
107
137
  }
138
+ /**
139
+ * 组合函数调用描述 (Composition 模式)
140
+ */
141
+ export interface BlockComposable {
142
+ /**
143
+ * 赋值变量名
144
+ */
145
+ name: string;
146
+ /**
147
+ * composable 来源函数
148
+ */
149
+ composable: JSExpression;
150
+ /**
151
+ * 调用参数
152
+ */
153
+ args?: (JSONValue | JSExpression)[];
154
+ /**
155
+ * 解构字段,如 const { x, y } = useXxx()
156
+ */
157
+ destructure?: string[];
158
+ }
108
159
  export interface BlockProp {
109
160
  name: string;
110
161
  type?: BlockPropDataType | BlockPropDataType[];
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2026, VTJ.PRO All rights reserved.
3
3
  * @name @vtj/core
4
4
  * @author CHC chenhuachun1549@dingtalk.com
5
- * @version 0.17.6
5
+ * @version 0.17.8
6
6
  * @license <a href="https://vtj.pro/license.html">MIT License</a>
7
7
  */
8
- export declare const version = "0.17.6";
8
+ export declare const version = "0.17.8";