@visactor/vrender 1.1.0-alpha.21 → 1.1.0-alpha.23

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.
@@ -2,3 +2,4 @@ export * from './bootstrap';
2
2
  export * from './browser';
3
3
  export * from './miniapp';
4
4
  export * from './node';
5
+ export * from './shared';
@@ -5,4 +5,6 @@ export * from "./browser";
5
5
  export * from "./miniapp";
6
6
 
7
7
  export * from "./node";
8
+
9
+ export * from "./shared";
8
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/entries/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["export * from './bootstrap';\nexport * from './browser';\nexport * from './miniapp';\nexport * from './node';\n"]}
1
+ {"version":3,"sources":["../src/entries/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC","file":"index.js","sourcesContent":["export * from './bootstrap';\nexport * from './browser';\nexport * from './miniapp';\nexport * from './node';\nexport * from './shared';\n"]}
@@ -0,0 +1,30 @@
1
+ import type { IApp } from '@visactor/vrender-core';
2
+ import { type TVRenderBrowserAppEntryOptions } from './browser';
3
+ import { type TVRenderMiniAppEntryOptions } from './miniapp';
4
+ import { type TVRenderNodeAppEntryOptions } from './node';
5
+ export type TVRenderSharedAppEnv = 'browser' | 'node' | 'taro' | 'feishu' | 'tt' | 'wx' | 'lynx' | 'harmony';
6
+ export type TVRenderSharedAppKey = string | symbol;
7
+ type TVRenderSharedAppEntryOptionsMap = {
8
+ browser: TVRenderBrowserAppEntryOptions;
9
+ node: TVRenderNodeAppEntryOptions;
10
+ taro: TVRenderMiniAppEntryOptions<'taro'>;
11
+ feishu: TVRenderMiniAppEntryOptions<'feishu'>;
12
+ tt: TVRenderMiniAppEntryOptions<'tt'>;
13
+ wx: TVRenderMiniAppEntryOptions<'wx'>;
14
+ lynx: TVRenderMiniAppEntryOptions<'lynx'>;
15
+ harmony: TVRenderMiniAppEntryOptions<'harmony'>;
16
+ };
17
+ export type TVRenderSharedAppOptions<TEnv extends TVRenderSharedAppEnv = TVRenderSharedAppEnv> = TVRenderSharedAppEntryOptionsMap[TEnv] & {
18
+ env: TEnv;
19
+ key?: TVRenderSharedAppKey;
20
+ };
21
+ export type TVRenderSharedAppHandle<TEnv extends TVRenderSharedAppEnv = TVRenderSharedAppEnv> = {
22
+ readonly app: IApp;
23
+ readonly env: TEnv;
24
+ readonly key: TVRenderSharedAppKey;
25
+ release: () => void;
26
+ };
27
+ export declare function acquireSharedVRenderApp<TEnv extends TVRenderSharedAppEnv>(options: TVRenderSharedAppOptions<TEnv>): TVRenderSharedAppHandle<TEnv>;
28
+ export declare function getSharedVRenderApp<TEnv extends TVRenderSharedAppEnv>(env: TEnv, key?: TVRenderSharedAppKey): IApp | null;
29
+ export declare function releaseSharedVRenderApp<TEnv extends TVRenderSharedAppEnv>(env: TEnv, key?: TVRenderSharedAppKey): void;
30
+ export {};
@@ -0,0 +1,88 @@
1
+ import { createBrowserVRenderApp } from "./browser";
2
+
3
+ import { createFeishuVRenderApp, createHarmonyVRenderApp, createLynxVRenderApp, createTaroVRenderApp, createTTVRenderApp, createWxVRenderApp } from "./miniapp";
4
+
5
+ import { createNodeVRenderApp } from "./node";
6
+
7
+ const SHARED_APP_REGISTRY_KEY = Symbol.for("visactor.vrender.sharedAppRegistry"), DEFAULT_SHARED_APP_KEY = "default";
8
+
9
+ function getSharedAppRegistry() {
10
+ var _a;
11
+ const target = globalThis, registry = null !== (_a = target[SHARED_APP_REGISTRY_KEY]) && void 0 !== _a ? _a : new Map;
12
+ return target[SHARED_APP_REGISTRY_KEY] = registry, registry;
13
+ }
14
+
15
+ function getSharedAppEnvRegistry(env, create) {
16
+ const registry = getSharedAppRegistry(), envRegistry = registry.get(env);
17
+ if (envRegistry || !create) return envRegistry;
18
+ const nextEnvRegistry = new Map;
19
+ return registry.set(env, nextEnvRegistry), nextEnvRegistry;
20
+ }
21
+
22
+ function getOrCreateSharedAppEnvRegistry(env) {
23
+ return getSharedAppEnvRegistry(env, !0);
24
+ }
25
+
26
+ function removeSharedAppRecord(env, key, record) {
27
+ const registry = getSharedAppRegistry(), envRegistry = registry.get(env);
28
+ (null == envRegistry ? void 0 : envRegistry.get(key)) === record && (envRegistry.delete(key),
29
+ envRegistry.size || registry.delete(env));
30
+ }
31
+
32
+ function releaseSharedAppRecord(env, key, record) {
33
+ record.released || (record.released = !0, record.refCount = 0, removeSharedAppRecord(env, key, record),
34
+ record.releaseApp());
35
+ }
36
+
37
+ function createAppForSharedEnv(options) {
38
+ const {env: env} = options, entryOptions = Object.assign({}, options);
39
+ return delete entryOptions.env, delete entryOptions.key, "browser" === env ? createBrowserVRenderApp(entryOptions) : "node" === env ? createNodeVRenderApp(entryOptions) : "taro" === env ? createTaroVRenderApp(entryOptions) : "feishu" === env ? createFeishuVRenderApp(entryOptions) : "tt" === env ? createTTVRenderApp(entryOptions) : "wx" === env ? createWxVRenderApp(entryOptions) : "lynx" === env ? createLynxVRenderApp(entryOptions) : createHarmonyVRenderApp(entryOptions);
40
+ }
41
+
42
+ function createSharedAppRecord(env, key, options) {
43
+ const app = createAppForSharedEnv(options), originalRelease = app.release.bind(app), record = {
44
+ app: app,
45
+ refCount: 0,
46
+ released: !1,
47
+ releaseApp: originalRelease
48
+ };
49
+ return app.release = () => releaseSharedAppRecord(env, key, record), record;
50
+ }
51
+
52
+ function createSharedAppHandle(env, key, record) {
53
+ let released = !1;
54
+ return {
55
+ app: record.app,
56
+ env: env,
57
+ key: key,
58
+ release() {
59
+ if (released) return;
60
+ released = !0;
61
+ const envRegistry = getSharedAppEnvRegistry(env, !1);
62
+ (null == envRegistry ? void 0 : envRegistry.get(key)) !== record || record.released || (record.refCount -= 1,
63
+ record.refCount <= 0 && releaseSharedAppRecord(env, key, record));
64
+ }
65
+ };
66
+ }
67
+
68
+ export function acquireSharedVRenderApp(options) {
69
+ var _a;
70
+ const key = null !== (_a = options.key) && void 0 !== _a ? _a : "default", envRegistry = getOrCreateSharedAppEnvRegistry(options.env);
71
+ let record = envRegistry.get(key);
72
+ return (null == record ? void 0 : record.app.released) && (releaseSharedAppRecord(options.env, key, record),
73
+ record = void 0), record || (record = createSharedAppRecord(options.env, key, options),
74
+ envRegistry.set(key, record)), record.refCount += 1, createSharedAppHandle(options.env, key, record);
75
+ }
76
+
77
+ export function getSharedVRenderApp(env, key = "default") {
78
+ var _a;
79
+ const record = null === (_a = getSharedAppEnvRegistry(env, !1)) || void 0 === _a ? void 0 : _a.get(key);
80
+ return !record || record.released || record.app.released ? null : record.app;
81
+ }
82
+
83
+ export function releaseSharedVRenderApp(env, key = "default") {
84
+ var _a;
85
+ const record = null === (_a = getSharedAppEnvRegistry(env, !1)) || void 0 === _a ? void 0 : _a.get(key);
86
+ record && releaseSharedAppRecord(env, key, record);
87
+ }
88
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/entries/shared.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAuC,MAAM,WAAW,CAAC;AACzF,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAEnB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,oBAAoB,EAAoC,MAAM,QAAQ,CAAC;AA2ChF,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAC;AACjF,MAAM,sBAAsB,GAAG,SAAS,CAAC;AAEzC,SAAS,oBAAoB;;IAC3B,MAAM,MAAM,GAAG,UAAsC,CAAC;IACtD,MAAM,QAAQ,GAAG,MAAA,MAAM,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CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;QACjD,MAAM,GAAG,SAAS,CAAC;KACpB;IAED,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,GAAG,qBAAqB,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;QAC1D,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;KAC9B;IAED,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC;IACrB,OAAO,qBAAqB,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,GAAS,EACT,MAA4B,sBAAsB;;IAElD,MAAM,MAAM,GAAG,MAAA,uBAAuB,CAAC,GAAG,EAAE,KAAK,CAAC,0CAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7D,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE;QACrD,OAAO,IAAI,CAAC;KACb;IACD,OAAO,MAAM,CAAC,GAAG,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,GAAS,EACT,MAA4B,sBAAsB;;IAElD,MAAM,MAAM,GAAG,MAAA,uBAAuB,CAAC,GAAG,EAAE,KAAK,CAAC,0CAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7D,IAAI,MAAM,EAAE;QACV,sBAAsB,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;KAC1C;AACH,CAAC","file":"shared.js","sourcesContent":["import type { IApp } from '@visactor/vrender-core';\nimport { createBrowserVRenderApp, type TVRenderBrowserAppEntryOptions } from './browser';\nimport {\n createFeishuVRenderApp,\n createHarmonyVRenderApp,\n createLynxVRenderApp,\n createTaroVRenderApp,\n createTTVRenderApp,\n createWxVRenderApp,\n type TVRenderMiniAppEntryOptions\n} from './miniapp';\nimport { createNodeVRenderApp, type TVRenderNodeAppEntryOptions } from './node';\n\nexport type TVRenderSharedAppEnv = 'browser' | 'node' | 'taro' | 'feishu' | 'tt' | 'wx' | 'lynx' | 'harmony';\nexport type TVRenderSharedAppKey = string | symbol;\n\ntype TVRenderSharedAppEntryOptionsMap = {\n browser: TVRenderBrowserAppEntryOptions;\n node: TVRenderNodeAppEntryOptions;\n taro: TVRenderMiniAppEntryOptions<'taro'>;\n feishu: TVRenderMiniAppEntryOptions<'feishu'>;\n tt: TVRenderMiniAppEntryOptions<'tt'>;\n wx: TVRenderMiniAppEntryOptions<'wx'>;\n lynx: TVRenderMiniAppEntryOptions<'lynx'>;\n harmony: TVRenderMiniAppEntryOptions<'harmony'>;\n};\n\nexport type TVRenderSharedAppOptions<TEnv extends TVRenderSharedAppEnv = TVRenderSharedAppEnv> =\n TVRenderSharedAppEntryOptionsMap[TEnv] & {\n env: TEnv;\n /**\n * Shared identity inside the current JS runtime. Use a stable app/page/container key\n * when multiple products, such as VChart and VTable, should share one VRender app.\n */\n key?: TVRenderSharedAppKey;\n };\n\nexport type TVRenderSharedAppHandle<TEnv extends TVRenderSharedAppEnv = TVRenderSharedAppEnv> = {\n readonly app: IApp;\n readonly env: TEnv;\n readonly key: TVRenderSharedAppKey;\n release: () => void;\n};\n\ntype TSharedAppRecord = {\n app: IApp;\n refCount: number;\n released: boolean;\n releaseApp: () => void;\n};\n\ntype TSharedAppRegistry = Map<TVRenderSharedAppEnv, Map<TVRenderSharedAppKey, TSharedAppRecord>>;\ntype TGlobalSharedAppRegistry = typeof globalThis & Record<symbol, TSharedAppRegistry | undefined>;\n\nconst SHARED_APP_REGISTRY_KEY = Symbol.for('visactor.vrender.sharedAppRegistry');\nconst DEFAULT_SHARED_APP_KEY = 'default';\n\nfunction getSharedAppRegistry(): TSharedAppRegistry {\n const target = globalThis as TGlobalSharedAppRegistry;\n const registry = target[SHARED_APP_REGISTRY_KEY] ?? new Map();\n target[SHARED_APP_REGISTRY_KEY] = registry;\n return registry;\n}\n\nfunction getSharedAppEnvRegistry<TEnv extends TVRenderSharedAppEnv>(\n env: TEnv,\n create: boolean\n): Map<TVRenderSharedAppKey, TSharedAppRecord> | undefined {\n const registry = getSharedAppRegistry();\n const envRegistry = registry.get(env);\n\n if (envRegistry || !create) {\n return envRegistry;\n }\n\n const nextEnvRegistry = new Map<TVRenderSharedAppKey, TSharedAppRecord>();\n registry.set(env, nextEnvRegistry);\n return nextEnvRegistry;\n}\n\nfunction getOrCreateSharedAppEnvRegistry<TEnv extends TVRenderSharedAppEnv>(\n env: TEnv\n): Map<TVRenderSharedAppKey, TSharedAppRecord> {\n return getSharedAppEnvRegistry(env, true) as Map<TVRenderSharedAppKey, TSharedAppRecord>;\n}\n\nfunction removeSharedAppRecord<TEnv extends TVRenderSharedAppEnv>(\n env: TEnv,\n key: TVRenderSharedAppKey,\n record: TSharedAppRecord\n) {\n const registry = getSharedAppRegistry();\n const envRegistry = registry.get(env);\n\n if (envRegistry?.get(key) === record) {\n envRegistry.delete(key);\n if (!envRegistry.size) {\n registry.delete(env);\n }\n }\n}\n\nfunction releaseSharedAppRecord<TEnv extends TVRenderSharedAppEnv>(\n env: TEnv,\n key: TVRenderSharedAppKey,\n record: TSharedAppRecord\n) {\n if (record.released) {\n return;\n }\n\n record.released = true;\n record.refCount = 0;\n removeSharedAppRecord(env, key, record);\n record.releaseApp();\n}\n\nfunction createAppForSharedEnv<TEnv extends TVRenderSharedAppEnv>(options: TVRenderSharedAppOptions<TEnv>): IApp {\n const { env } = options;\n const entryOptions = { ...options } as Record<string, unknown>;\n delete entryOptions.env;\n delete entryOptions.key;\n\n if (env === 'browser') {\n return createBrowserVRenderApp(entryOptions as TVRenderBrowserAppEntryOptions);\n }\n if (env === 'node') {\n return createNodeVRenderApp(entryOptions as TVRenderNodeAppEntryOptions);\n }\n if (env === 'taro') {\n return createTaroVRenderApp(entryOptions as TVRenderMiniAppEntryOptions<'taro'>);\n }\n if (env === 'feishu') {\n return createFeishuVRenderApp(entryOptions as TVRenderMiniAppEntryOptions<'feishu'>);\n }\n if (env === 'tt') {\n return createTTVRenderApp(entryOptions as TVRenderMiniAppEntryOptions<'tt'>);\n }\n if (env === 'wx') {\n return createWxVRenderApp(entryOptions as TVRenderMiniAppEntryOptions<'wx'>);\n }\n if (env === 'lynx') {\n return createLynxVRenderApp(entryOptions as TVRenderMiniAppEntryOptions<'lynx'>);\n }\n return createHarmonyVRenderApp(entryOptions as TVRenderMiniAppEntryOptions<'harmony'>);\n}\n\nfunction createSharedAppRecord<TEnv extends TVRenderSharedAppEnv>(\n env: TEnv,\n key: TVRenderSharedAppKey,\n options: TVRenderSharedAppOptions<TEnv>\n): TSharedAppRecord {\n const app = createAppForSharedEnv(options);\n const originalRelease = app.release.bind(app);\n const record: TSharedAppRecord = {\n app,\n refCount: 0,\n released: false,\n releaseApp: originalRelease\n };\n\n app.release = () => releaseSharedAppRecord(env, key, record);\n return record;\n}\n\nfunction createSharedAppHandle<TEnv extends TVRenderSharedAppEnv>(\n env: TEnv,\n key: TVRenderSharedAppKey,\n record: TSharedAppRecord\n): TVRenderSharedAppHandle<TEnv> {\n let released = false;\n\n return {\n app: record.app,\n env,\n key,\n release() {\n if (released) {\n return;\n }\n released = true;\n\n const envRegistry = getSharedAppEnvRegistry(env, false);\n if (envRegistry?.get(key) !== record || record.released) {\n return;\n }\n\n record.refCount -= 1;\n if (record.refCount <= 0) {\n releaseSharedAppRecord(env, key, record);\n }\n }\n };\n}\n\nexport function acquireSharedVRenderApp<TEnv extends TVRenderSharedAppEnv>(\n options: TVRenderSharedAppOptions<TEnv>\n): TVRenderSharedAppHandle<TEnv> {\n const key = options.key ?? DEFAULT_SHARED_APP_KEY;\n const envRegistry = getOrCreateSharedAppEnvRegistry(options.env);\n let record = envRegistry.get(key);\n\n if (record?.app.released) {\n releaseSharedAppRecord(options.env, key, record);\n record = undefined;\n }\n\n if (!record) {\n record = createSharedAppRecord(options.env, key, options);\n envRegistry.set(key, record);\n }\n\n record.refCount += 1;\n return createSharedAppHandle(options.env, key, record);\n}\n\nexport function getSharedVRenderApp<TEnv extends TVRenderSharedAppEnv>(\n env: TEnv,\n key: TVRenderSharedAppKey = DEFAULT_SHARED_APP_KEY\n): IApp | null {\n const record = getSharedAppEnvRegistry(env, false)?.get(key);\n if (!record || record.released || record.app.released) {\n return null;\n }\n return record.app;\n}\n\nexport function releaseSharedVRenderApp<TEnv extends TVRenderSharedAppEnv>(\n env: TEnv,\n key: TVRenderSharedAppKey = DEFAULT_SHARED_APP_KEY\n): void {\n const record = getSharedAppEnvRegistry(env, false)?.get(key);\n if (record) {\n releaseSharedAppRecord(env, key, record);\n }\n}\n"]}
package/es/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Direction } from '@visactor/vrender-core';
2
- export declare const version = "1.1.0-alpha.21";
2
+ export declare const version = "1.1.0-alpha.23";
3
3
  export * from '@visactor/vrender-core';
4
4
  export * from '@visactor/vrender-kits';
5
5
  export * from '@visactor/vrender-animate';
package/es/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Direction } from "@visactor/vrender-core";
2
2
 
3
- export const version = "1.1.0-alpha.21";
3
+ export const version = "1.1.0-alpha.23";
4
4
 
5
5
  export * from "@visactor/vrender-core";
6
6
 
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,CAAC","file":"index.js","sourcesContent":["import { Direction } from '@visactor/vrender-core';\n// 导出版本号\nexport const version = \"1.1.0-alpha.21\";\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\nexport * from '@visactor/vrender-animate';\nexport * from '@visactor/vrender-components';\nexport * from './entries';\nexport { createStage } from './legacy';\n\n// avoid naming conflicts with 'State' & 'Direction' in '@visactor/vrender-components'\nexport { State } from '@visactor/vrender-animate';\nexport { Direction };\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,CAAC","file":"index.js","sourcesContent":["import { Direction } from '@visactor/vrender-core';\n// 导出版本号\nexport const version = \"1.1.0-alpha.23\";\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\nexport * from '@visactor/vrender-animate';\nexport * from '@visactor/vrender-components';\nexport * from './entries';\nexport { createStage } from './legacy';\n\n// avoid naming conflicts with 'State' & 'Direction' in '@visactor/vrender-components'\nexport { State } from '@visactor/vrender-animate';\nexport { Direction };\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/vrender",
3
- "version": "1.1.0-alpha.21",
3
+ "version": "1.1.0-alpha.23",
4
4
  "description": "",
5
5
  "sideEffects": true,
6
6
  "main": "cjs/index.js",
@@ -12,10 +12,10 @@
12
12
  "dist"
13
13
  ],
14
14
  "dependencies": {
15
- "@visactor/vrender-core": "1.1.0-alpha.21",
16
- "@visactor/vrender-kits": "1.1.0-alpha.21",
17
- "@visactor/vrender-animate": "1.1.0-alpha.21",
18
- "@visactor/vrender-components": "1.1.0-alpha.21"
15
+ "@visactor/vrender-core": "1.1.0-alpha.23",
16
+ "@visactor/vrender-kits": "1.1.0-alpha.23",
17
+ "@visactor/vrender-animate": "1.1.0-alpha.23",
18
+ "@visactor/vrender-components": "1.1.0-alpha.23"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@rushstack/eslint-patch": "~1.1.4",
@@ -37,8 +37,8 @@
37
37
  "zrender": "5.4.0",
38
38
  "cross-env": "^7.0.3",
39
39
  "@internal/bundler": "0.0.1",
40
- "@internal/ts-config": "0.0.1",
41
- "@internal/eslint-config": "0.0.1"
40
+ "@internal/eslint-config": "0.0.1",
41
+ "@internal/ts-config": "0.0.1"
42
42
  },
43
43
  "keywords": [
44
44
  "VisActor",