@vtj/renderer 0.17.8 → 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/renderer",
3
3
  "private": false,
4
- "version": "0.17.8",
4
+ "version": "0.18.0",
5
5
  "type": "module",
6
6
  "keywords": [
7
7
  "低代码引擎",
@@ -22,15 +22,15 @@
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
24
  "eval5": "^1.4.8",
25
- "@vtj/utils": "~0.17.8",
26
- "@vtj/core": "~0.17.8"
25
+ "@vtj/utils": "~0.18.0",
26
+ "@vtj/core": "~0.18.0"
27
27
  },
28
28
  "devDependencies": {
29
- "vue": "3.5.35",
29
+ "vue": "~3.5.37",
30
30
  "vue-router": "~4.6.0",
31
- "@vtj/cli": "~0.12.20",
32
- "@vtj/ui": "~0.17.8",
33
- "@vtj/icons": "~0.17.8"
31
+ "@vtj/ui": "~0.18.0",
32
+ "@vtj/icons": "~0.18.0",
33
+ "@vtj/cli": "~0.13.0"
34
34
  },
35
35
  "exports": {
36
36
  ".": {
@@ -22,6 +22,7 @@ export declare enum ContextMode {
22
22
  */
23
23
  export declare const CONTEXT_HOST: string[];
24
24
  export declare const LIFE_CYCLES_LIST: string[];
25
+ export declare const COMPOSITION_HOOKS_LIST: string[];
25
26
  /**
26
27
  * 内置指令
27
28
  */
@@ -74,7 +74,7 @@ export interface AccessOptions {
74
74
  }
75
75
  export interface AccessData {
76
76
  token: string;
77
- permissions: Record<string, boolean>;
77
+ permissions: Record<string, boolean> | string[];
78
78
  [index: string]: any;
79
79
  }
80
80
  export interface AccessConnectParams {
@@ -107,7 +107,7 @@ export declare class Access {
107
107
  logout(): void;
108
108
  getData(): AccessData | null;
109
109
  getToken(): string | undefined;
110
- can(code: string | string[] | ((p: Record<string, boolean>) => boolean)): boolean;
110
+ can(code: string | string[] | ((p: Record<string, boolean> | string[]) => boolean)): boolean;
111
111
  some(code: string | string[]): boolean;
112
112
  install(app: App): void;
113
113
  private isAuthPath;
@@ -4,7 +4,7 @@ import { ProvideAdapter } from './defaults';
4
4
  import { ContextMode } from '../constants';
5
5
  export interface InitGlobalsOptions {
6
6
  app: App;
7
- window: Window;
7
+ window: any;
8
8
  adapter: ProvideAdapter;
9
9
  library: Record<string, any>;
10
10
  mode: ContextMode;
@@ -94,6 +94,7 @@ export declare class Provider extends Base {
94
94
  * @param app Vue 应用实例
95
95
  */
96
96
  install(app: App): void;
97
+ setGlobals(globals?: Record<string, any>): void;
97
98
  getFile(id: string): PageFile | BlockFile | null;
98
99
  getPage(id: string): PageFile | null;
99
100
  getFirstPage(): PageFile | null;
@@ -174,3 +175,9 @@ export interface UseProviderOptions {
174
175
  * @throws 如果找不到Provider会抛出错误
175
176
  */
176
177
  export declare function useProvider(options?: UseProviderOptions): Provider;
178
+ export declare function useGlobals(): Record<string, any>;
179
+ export declare function useStore(): any;
180
+ export declare function usePinia(): any;
181
+ export declare function useRequest(): any;
182
+ export declare function useLibs(): any;
183
+ export declare function useApis(): any;
@@ -5,13 +5,14 @@ import { BlockLoader } from './loader';
5
5
  export type DataSourceHandler = (...args: any[]) => Promise<any>;
6
6
  export interface CreateRendererOptions {
7
7
  Vue?: any;
8
+ UniApp?: any;
8
9
  mode?: ContextMode;
9
10
  dsl?: BlockSchema;
10
11
  components?: Record<string, any>;
11
12
  libs?: Record<string, any>;
12
13
  apis?: Record<string, any>;
13
14
  loader?: BlockLoader;
14
- window?: Window;
15
+ window?: any;
15
16
  }
16
17
  export declare function createRenderer(options: CreateRendererOptions): {
17
18
  renderer: any;
@@ -13,6 +13,12 @@ declare class NodeCache {
13
13
  getNode(id: string): any;
14
14
  loadNode(key: string, value: any): any;
15
15
  isEqual(value: any, other: any): boolean;
16
+ /**
17
+ * 比较两个节点缓存是否相等,函数引用变化不触发重渲染,但函数属性的增删会触发
18
+ * 函数引用每次都会重新创建,不应该作为缓存比较的依据
19
+ * 但函数属性的增删表示节点结构变化,需要触发重渲染
20
+ */
21
+ isNodeEqual(value: any, other: any): boolean;
16
22
  clear(): void;
17
23
  }
18
24
  declare const nodeCache: NodeCache;
@@ -20,9 +20,16 @@ export declare class Context {
20
20
  __refs: Record<string, any>;
21
21
  __refCaches: Record<string, any>;
22
22
  context: Record<string, any>;
23
+ /**
24
+ * @deprecated
25
+ */
23
26
  state: Record<string, any>;
27
+ /**
28
+ * @deprecated
29
+ */
24
30
  props: Record<string, any>;
25
31
  $props: Record<string, any>;
32
+ $state: Record<string, any>;
26
33
  $refs: Record<string, any>;
27
34
  $el: any;
28
35
  $emit: any;
@@ -38,6 +45,8 @@ export declare class Context {
38
45
  $libs: Record<string, any>;
39
46
  $apis: Record<string, any>;
40
47
  $provider: Provider | null;
48
+ $uni: any;
49
+ $getApp: any;
41
50
  private __transform;
42
51
  constructor(options: ContextOptions);
43
52
  setup(attrs: Record<string, any>, Vue?: any): void;
@@ -1,4 +1,5 @@
1
1
  import { JSExpression, JSFunction } from '@vtj/core';
2
+ export declare function triggerError(err: any): void;
2
3
  export declare function parseExpression(str: JSExpression | JSFunction, self: any, thisRequired?: boolean, throwError?: boolean, noWith?: boolean): any;
3
4
  export declare function parseFunction(str: JSFunction, self: any, thisRequired?: boolean, throwError?: boolean, noWith?: boolean): Function;
4
5
  export declare function isJSExpression(data: any): data is JSExpression;
@@ -2,7 +2,7 @@ import { Plugin, App } from 'vue';
2
2
  import { PageFile, BlockFile } from '@vtj/core';
3
3
  import { RouteLocationNormalizedGeneric } from 'vue-router';
4
4
  export declare function toString(value: any): string;
5
- export declare function adoptedStyleSheets(global: Window, id: string, css: string, scoped?: boolean): void;
5
+ export declare function adoptedStyleSheets(global: any, id: string, css: string, scoped?: boolean): void;
6
6
  export declare function adoptStylesToInline(document: Document): void;
7
7
  export declare function loadCss(id: string, url: string): Promise<void>;
8
8
  export declare function loadCssUrl(urls: string[], global?: any): void;
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2026, VTJ.PRO All rights reserved.
3
3
  * @name @vtj/renderer
4
4
  * @author CHC chenhuachun1549@dingtalk.com
5
- * @version 0.17.7
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.7";
8
+ export declare const version = "0.17.8";