@vyr/cli 0.0.19 → 0.0.21
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/.bin/install/index.js +6 -0
- package/.entry/app.js +362 -362
- package/build/css/{9339.e14b8c45.css → 110.6ed7cfde.css} +1 -1
- package/build/css/1111.d78bb080.css +1 -0
- package/build/css/2318.b023c74d.css +1 -0
- package/build/css/{3864.a80486d1.css → 2983.9f539d64.css} +1 -1
- package/build/css/{4296.963f15af.css → 6151.e4de2b69.css} +1 -1
- package/build/css/9170.7c0db381.css +1 -0
- package/build/css/{3964.4c4113a3.css → 9786.6bfee4ca.css} +1 -1
- package/build/css/login.ca50fefe.css +1 -0
- package/build/fonts/{iconfont.ba63119b.ttf → iconfont.10345b2b.ttf} +0 -0
- package/build/fonts/iconfont.4a13a979.woff +0 -0
- package/build/index.html +1 -1
- package/build/js/1018.44885958.js +1 -0
- package/build/js/110.a26ee1aa.js +1 -0
- package/build/js/1111.be6e2c40.js +1 -0
- package/build/js/150.00c9fbf4.js +1 -0
- package/build/js/1780.0ef31158.js +1 -0
- package/build/js/2318.808935bc.js +1 -0
- package/build/js/2983.fcd4c54c.js +3 -0
- package/build/js/3553.843b10f9.js +1 -0
- package/build/js/3785.0e5bac50.js +1 -0
- package/build/js/{4530.1c91c099.js → 4530.abbe43c1.js} +1 -1
- package/build/js/4582.b9a77472.js +277 -0
- package/build/js/5547.295cc860.js +1 -0
- package/build/js/6151.f395fab4.js +1 -0
- package/build/js/6166.a11b6605.js +1 -0
- package/build/js/7713.7dac62b2.js +1 -0
- package/build/js/7769.cd4df4d6.js +1 -0
- package/build/js/7928.76108257.js +1 -0
- package/build/js/8637.435ff2cf.js +1 -0
- package/build/js/9170.00337437.js +1 -0
- package/build/js/931.e0143d22.js +1 -0
- package/build/js/9399.3fcb9b8f.js +1 -0
- package/build/js/94.043c5ab1.js +1 -0
- package/build/js/9786.80abceae.js +1 -0
- package/build/js/chunk-vendors.3148df9e.js +300 -0
- package/build/js/index.c88ebc1c.js +1 -0
- package/build/js/login.06d7868f.js +1 -0
- package/build/js/preview.11442733.js +1 -0
- package/build/login.html +1 -1
- package/build/preview.html +1 -1
- package/output/auto-provider-plugin/package.json +1 -1
- package/output/builtin/build/component/ExampleDialog.vue.d.ts +3 -0
- package/output/builtin/build/component/index.d.ts +2 -1
- package/output/builtin/build/locale/LanguageProvider.d.ts +9 -4
- package/output/builtin/build/service/global/draggable/Draggable.d.ts +10 -0
- package/output/builtin/build/service/global/draggable/index.d.ts +1 -0
- package/output/builtin/build/service/global/index.d.ts +1 -0
- package/output/builtin/build/service/header/action/MyExampleAction.d.ts +9 -0
- package/output/builtin/build/service/header/action/index.d.ts +1 -0
- package/output/builtin/build/service/sidebar/asset/AssetNavigator.d.ts +2 -2
- package/output/builtin/build/service/sidebar/scene/SceneNavigator.d.ts +5 -5
- package/output/builtin/build/service/sidebar/scene/draggable/Draggable.d.ts +5 -5
- package/output/builtin/package.json +1 -1
- package/output/class-wrapper-plugin/package.json +1 -1
- package/output/declare/package.json +2 -2
- package/output/design/package.json +1 -1
- package/output/design/src/components/Loading.vue +1 -1
- package/output/design/src/components/utils/Confirm.ts +1 -1
- package/output/design/src/font/demo_index.html +1315 -1292
- package/output/design/src/font/iconfont.css +211 -207
- package/output/design/src/font/iconfont.js +1 -1
- package/output/design/src/font/iconfont.json +352 -345
- package/output/design/src/font/iconfont.ttf +0 -0
- package/output/design/src/font/iconfont.woff +0 -0
- package/output/design/src/font/iconfont.woff2 +0 -0
- package/output/design/src/locale/LanguageProvider.ts +2 -0
- package/output/design/src/theme/index.ts +4 -0
- package/output/engine/package.json +2 -2
- package/output/engine/src/asset/Asset.ts +2 -9
- package/output/engine/src/interaction/Scriptable.ts +4 -0
- package/output/engine/src/preset/execute/dataset/update.ts +1 -1
- package/output/engine/src/preset/execute/graphics/invoke.ts +2 -2
- package/output/engine/src/preset/execute/net/http.ts +3 -3
- package/output/engine/src/preset/execute/scheduler/switch.ts +1 -1
- package/output/engine/src/utils/AssetProvider.ts +19 -1
- package/output/locale/package.json +1 -1
- package/output/remote/package.json +1 -1
- package/output/remote/src/utils/screenshot.ts +2 -2
- package/output/rollup-config-plugin/package.json +1 -1
- package/output/runtime/build/DataService.d.ts +2 -2
- package/output/runtime/build/DraggableService.d.ts +1 -0
- package/output/runtime/build/data/global.d.ts +8 -1
- package/output/runtime/build/navigator/SidebarNavigator.d.ts +1 -2
- package/output/runtime/package.json +1 -1
- package/output/service/package.json +1 -1
- package/output/service-asset/package.json +1 -1
- package/output/service-asset/src/AssetMethodProvider.ts +7 -4
- package/output/service-asset/src/AssetService.ts +3 -4
- package/output/service-example/package.json +12 -0
- package/output/service-example/src/ExampleMethodProvider.ts +35 -0
- package/output/service-example/src/ExampleService.ts +42 -0
- package/output/service-example/src/index.ts +2 -0
- package/output/service-example/src/locale/Language.ts +10 -0
- package/output/service-example/src/locale/LanguageProvider.ts +15 -0
- package/output/service-example/src/locale/index.ts +2 -0
- package/output/service-example/tsconfig.json +31 -0
- package/output/service-graph/package.json +1 -1
- package/output/service-rpc/package.json +3 -2
- package/output/service-rpc/src/Message.ts +2 -0
- package/output/service-rpc/src/RpcService.ts +15 -5
- package/output/service-rpc/src/domain/Entity.ts +12 -0
- package/output/service-rpc/src/domain/Example.ts +80 -0
- package/output/service-rpc/src/domain/User.ts +84 -0
- package/output/service-rpc/src/domain/index.ts +3 -0
- package/output/service-rpc/src/example/apply.ts +35 -0
- package/output/service-rpc/src/example/create.ts +36 -0
- package/output/service-rpc/src/example/delete.ts +33 -0
- package/output/service-rpc/src/example/index.ts +5 -0
- package/output/service-rpc/src/example/initialize.ts +22 -0
- package/output/service-rpc/src/example/list.ts +35 -0
- package/output/service-rpc/src/index.ts +1 -1
- package/output/service-rpc/src/rpc/getUser.ts +2 -2
- package/output/service-scene/package.json +1 -1
- package/output/service-scene/src/SceneMethodProvider.ts +6 -6
- package/output/service-scene/src/SceneService.ts +2 -3
- package/output/var-rename-plugin/package.json +1 -1
- package/package.json +1 -1
- package/build/css/1111.86597cc5.css +0 -1
- package/build/css/1583.69c975fc.css +0 -1
- package/build/css/530.e132216c.css +0 -1
- package/build/css/login.3b035eb6.css +0 -1
- package/build/fonts/iconfont.892a2301.woff +0 -0
- package/build/js/1018.54b7c2da.js +0 -1
- package/build/js/1111.1f95eaf7.js +0 -1
- package/build/js/150.7b02c788.js +0 -1
- package/build/js/1583.fe623811.js +0 -1
- package/build/js/3785.151db669.js +0 -1
- package/build/js/3864.bec1192e.js +0 -3
- package/build/js/3964.96d036ca.js +0 -1
- package/build/js/4296.4744698e.js +0 -1
- package/build/js/4582.334df958.js +0 -1
- package/build/js/4587.ca9eeb25.js +0 -1
- package/build/js/530.a25f4a44.js +0 -1
- package/build/js/6166.c3ca51e8.js +0 -1
- package/build/js/6234.1227c7e7.js +0 -1
- package/build/js/6968.0be80297.js +0 -1
- package/build/js/7713.e38c75be.js +0 -1
- package/build/js/7769.8bdec987.js +0 -1
- package/build/js/8637.35feda19.js +0 -1
- package/build/js/931.dc93d680.js +0 -1
- package/build/js/9339.e3438ab8.js +0 -1
- package/build/js/94.59ed492b.js +0 -1
- package/build/js/chunk-vendors.f015a48a.js +0 -24
- package/build/js/index.02977f2f.js +0 -1
- package/build/js/login.333dc56f.js +0 -1
- package/build/js/preview.28d91d42.js +0 -1
- package/output/service-rpc/src/User.ts +0 -21
- /package/build/js/{1349.9b04698c.js → 1349.257d012a.js} +0 -0
- /package/build/js/{1402.959080ba.js → 1402.22eb41ee.js} +0 -0
- /package/build/js/{1877.4e5568cd.js → 1877.1d9ae361.js} +0 -0
- /package/build/js/{250.87c27d4b.js → 250.ce2e4903.js} +0 -0
- /package/build/js/{2546.9d7d58e4.js → 2546.125841be.js} +0 -0
- /package/build/js/{3085.b4adae0b.js → 3085.6aa82272.js} +0 -0
- /package/build/js/{3745.7cfe411d.js → 3745.a78df4d3.js} +0 -0
- /package/build/js/{4263.d7a13386.js → 4263.3ce42c2d.js} +0 -0
- /package/build/js/{5639.21eb71b5.js → 5639.a0114486.js} +0 -0
- /package/build/js/{6357.d2b1aeab.js → 6357.d649d989.js} +0 -0
- /package/build/js/{677.3e00dd5c.js → 677.92aa9e9d.js} +0 -0
- /package/build/js/{7195.915ff054.js → 7195.e85d3e31.js} +0 -0
- /package/build/js/{8657.c161c764.js → 8657.5d14c39f.js} +0 -0
- /package/build/js/{9044.8f4c6040.js → 9044.0c464218.js} +0 -0
- /package/build/js/{9620.d8b97c72.js → 9620.8e501812.js} +0 -0
- /package/build/js/{9751.8b76fab5.js → 9751.062a0ec7.js} +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -4,6 +4,7 @@ interface ZhCNLanguageProvider extends LanguageProvider {
|
|
|
4
4
|
'input.placeholder': string
|
|
5
5
|
'select.placeholder': string
|
|
6
6
|
'notify.send.notMessage': string
|
|
7
|
+
'confirm.title.default': string
|
|
7
8
|
'confirm.state.notFound': string
|
|
8
9
|
'confirm.button.submit': string
|
|
9
10
|
'confirm.button.cancel': string
|
|
@@ -21,6 +22,7 @@ const zhCnLanguageProvider: ZhCNLanguageProvider = {
|
|
|
21
22
|
'input.placeholder': '请输入内容',
|
|
22
23
|
'select.placeholder': '请选择',
|
|
23
24
|
'notify.send.notMessage': '消息已被忽略,缺少提示信息!',
|
|
25
|
+
'confirm.title.default': '系统提示',
|
|
24
26
|
'confirm.state.notFound': '未初始化确认框的状态',
|
|
25
27
|
'confirm.button.submit': '确 认',
|
|
26
28
|
'confirm.button.cancel': '取 消',
|
|
@@ -62,6 +62,8 @@ interface ThemeConfig {
|
|
|
62
62
|
popoverBackgroundColor: string
|
|
63
63
|
|
|
64
64
|
notifyZIndex: number
|
|
65
|
+
|
|
66
|
+
loadingZIndex: number
|
|
65
67
|
}
|
|
66
68
|
|
|
67
69
|
const transform = (source: string, split: RegExp, replace: RegExp) => {
|
|
@@ -132,6 +134,8 @@ class Theme {
|
|
|
132
134
|
popoverBackgroundColor: 'rgba(30, 30, 30, 1)',
|
|
133
135
|
|
|
134
136
|
notifyZIndex: 2000,
|
|
137
|
+
|
|
138
|
+
loadingZIndex: 10000,
|
|
135
139
|
})
|
|
136
140
|
|
|
137
141
|
static update(config: Partial<ThemeConfig>) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vyr/engine",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@vyr/locale": "0.0.
|
|
9
|
+
"@vyr/locale": "0.0.21",
|
|
10
10
|
"tinycolor2": "1.6.0"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { language } from "../locale"
|
|
2
2
|
import { Category } from "../Category"
|
|
3
3
|
import { AsyncTask } from "../AsyncTask"
|
|
4
|
-
import {
|
|
4
|
+
import { Descriptor, ServiceSchedulerDescriptor } from "../descriptor"
|
|
5
5
|
import { InteractionDescriptor, Scriptable, ScriptableArgs } from "../interaction"
|
|
6
6
|
import { AssetGraph } from "./AssetGraph"
|
|
7
7
|
import { Engine } from "../Engine"
|
|
@@ -239,14 +239,7 @@ Asset.register(Category.texture, factoryDescriptor)
|
|
|
239
239
|
Asset.register(Category.prefab, factoryDescriptor)
|
|
240
240
|
Asset.register(Category.interaction, factoryDescriptor)
|
|
241
241
|
Asset.register(Category.scene, factoryDescriptor)
|
|
242
|
-
|
|
243
|
-
const factoryDataset = async (url: string) => {
|
|
244
|
-
const asset = await factoryDescriptor(url) as DatasetDescriptor
|
|
245
|
-
// if (asset.auto) await asset.fetch()
|
|
246
|
-
|
|
247
|
-
return asset
|
|
248
|
-
}
|
|
249
|
-
Asset.register(Category.dataset, factoryDataset)
|
|
242
|
+
Asset.register(Category.dataset, factoryDescriptor)
|
|
250
243
|
|
|
251
244
|
const factoryJson = async (url: string) => {
|
|
252
245
|
const res = await Asset.fetch(Asset.joinUrl(url))
|
|
@@ -28,6 +28,10 @@ class Scriptable<T extends ScriptableArgs<any, any, any> = ScriptableArgs> {
|
|
|
28
28
|
this.uuid = url
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
getInputValue(key: string, input: ScriptableInput) {
|
|
32
|
+
return input?.user?.[key]?.value ?? input.default[key].value
|
|
33
|
+
}
|
|
34
|
+
|
|
31
35
|
/**脚本的准备事件,该方法在脚本被实例化后立即执行
|
|
32
36
|
*
|
|
33
37
|
* 一般在该事件中进行脚本的准备工作,如从服务端获取资源或数据
|
|
@@ -9,7 +9,7 @@ const scriptable = Asset.createVirtualUrl('preset/dataset/update.ts')
|
|
|
9
9
|
class ExecuteScriptable extends Scriptable {
|
|
10
10
|
async execute(graphics: Graphics, args: ScriptableArgs) {
|
|
11
11
|
const { input, result } = args
|
|
12
|
-
const dataset =
|
|
12
|
+
const dataset = this.getInputValue('dataset', input)
|
|
13
13
|
|
|
14
14
|
const previous = result.get(input.previous)
|
|
15
15
|
const datasetDescriptor = Asset.get<DatasetDescriptor>(dataset)
|
|
@@ -8,8 +8,8 @@ const scriptable = Asset.createVirtualUrl('preset/graphics/invoke.ts')
|
|
|
8
8
|
class ExecuteScriptable extends Scriptable {
|
|
9
9
|
async execute(graphics: Graphics, args: ScriptableArgs) {
|
|
10
10
|
const { input } = args
|
|
11
|
-
const interaction =
|
|
12
|
-
const target =
|
|
11
|
+
const interaction = this.getInputValue('interaction', input)
|
|
12
|
+
const target = this.getInputValue('target', input)
|
|
13
13
|
const targetDescriptor = Descriptor.get<Descriptor>(target)
|
|
14
14
|
if (interaction && targetDescriptor) {
|
|
15
15
|
graphics.invoke(interaction, targetDescriptor)
|
|
@@ -22,9 +22,9 @@ class ExecuteScriptable extends Scriptable {
|
|
|
22
22
|
|
|
23
23
|
async execute(graphics: Graphics, args: ScriptableArgs) {
|
|
24
24
|
const { input, result } = args
|
|
25
|
-
let url =
|
|
26
|
-
const type
|
|
27
|
-
const data
|
|
25
|
+
let url = this.getInputValue('url', input)
|
|
26
|
+
const type = this.getInputValue('type', input)
|
|
27
|
+
const data = this.getInputValue('data', input)
|
|
28
28
|
|
|
29
29
|
const requestData: { [k: string]: any } = {}
|
|
30
30
|
const keys: string[] = []
|
|
@@ -7,7 +7,7 @@ import { Graphics } from "../../../graphics";
|
|
|
7
7
|
const scriptable = Asset.createVirtualUrl('preset/scheduler/switch.ts')
|
|
8
8
|
class ExecuteScriptable extends Scriptable {
|
|
9
9
|
async execute(graphics: Graphics, args: ScriptableArgs) {
|
|
10
|
-
const scene = args.input
|
|
10
|
+
const scene = this.getInputValue('scene', args.input)
|
|
11
11
|
if (!scene) return
|
|
12
12
|
await Asset.loadAll(scene)
|
|
13
13
|
await Asset.compileDataset(scene, graphics.engine)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InteractionDescriptor, InteractionNode, InteractionProperty } from "../interaction"
|
|
2
|
-
import { Descriptor, DynamicDescriptor, PrefabInstanceDescriptor, HTMLDescriptor, StyleDescriptor } from "../descriptor"
|
|
2
|
+
import { Descriptor, DynamicDescriptor, PrefabInstanceDescriptor, HTMLDescriptor, StyleDescriptor, DatasetDescriptor, DivDescriptor } from "../descriptor"
|
|
3
3
|
import { AssetGraph, Port } from "../asset"
|
|
4
4
|
import { Category } from "../Category"
|
|
5
5
|
|
|
@@ -37,6 +37,18 @@ const DescriptorProvider = (descriptor: Descriptor, port: Port) => {
|
|
|
37
37
|
if (descriptor.dataset) port.edges.push({ key: 'dataset', category: Category.dataset, asset: descriptor.dataset })
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
const DatasetDescriptorProvider = (descriptor: DatasetDescriptor, port: Port) => {
|
|
41
|
+
if (descriptor.dataConfigs.length > 0) {
|
|
42
|
+
for (let i = 0; i < descriptor.dataConfigs.length; i++) {
|
|
43
|
+
const dataConfig = descriptor.dataConfigs[i]
|
|
44
|
+
if (dataConfig.url && dataConfig.url.startsWith('/') && dataConfig.url.endsWith('.json')) {
|
|
45
|
+
port.edges.push({ key: `dataConfig[${i}].url`, category: Category.json, asset: dataConfig.url })
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (descriptor.dataset) port.edges.push({ key: 'dataset', category: Category.dataset, asset: descriptor.dataset })
|
|
50
|
+
}
|
|
51
|
+
|
|
40
52
|
const StyleDescriptorProvider = (descriptor: StyleDescriptor, port: Port) => {
|
|
41
53
|
if (descriptor.inherit) port.edges.push({ key: 'inherit', category: Category.style, asset: descriptor.inherit })
|
|
42
54
|
}
|
|
@@ -57,6 +69,10 @@ const HTMLDescriptorProvider = (descriptor: HTMLDescriptor, port: Port) => {
|
|
|
57
69
|
if (descriptor.style) port.edges.push({ key: 'style', category: Category.style, asset: descriptor.style })
|
|
58
70
|
}
|
|
59
71
|
|
|
72
|
+
const DivDescriptorProvider = (descriptor: DivDescriptor, port: Port) => {
|
|
73
|
+
if (descriptor.backroundIamge) port.edges.push({ key: 'backroundIamge', category: Category.image, asset: descriptor.backroundIamge })
|
|
74
|
+
}
|
|
75
|
+
|
|
60
76
|
const DynamicDescriptorProvider = (descriptor: DynamicDescriptor, port: Port) => {
|
|
61
77
|
if (descriptor.url) port.edges.push({ key: 'url', category: Category.prefab, asset: descriptor.url })
|
|
62
78
|
}
|
|
@@ -66,8 +82,10 @@ const PrefabInstanceDescriptorProvider = (descriptor: PrefabInstanceDescriptor,
|
|
|
66
82
|
}
|
|
67
83
|
|
|
68
84
|
AssetGraph.register(Descriptor.type, DescriptorProvider)
|
|
85
|
+
AssetGraph.register(DatasetDescriptor.type, DatasetDescriptorProvider)
|
|
69
86
|
AssetGraph.register(StyleDescriptor.type, StyleDescriptorProvider)
|
|
70
87
|
AssetGraph.register(InteractionDescriptor.type, InteractionDescriptorProvider)
|
|
71
88
|
AssetGraph.register(HTMLDescriptor.type, HTMLDescriptorProvider)
|
|
89
|
+
AssetGraph.register(DivDescriptor.type, DivDescriptorProvider)
|
|
72
90
|
AssetGraph.register(DynamicDescriptor.type, DynamicDescriptorProvider)
|
|
73
91
|
AssetGraph.register(PrefabInstanceDescriptor.type, PrefabInstanceDescriptorProvider)
|
|
@@ -7,8 +7,8 @@ const screenshot = async (html: HTMLElement, backgroundColor = '#ffffff') => {
|
|
|
7
7
|
|
|
8
8
|
const url = await HTMLToImage.default.toPng(html, {
|
|
9
9
|
bgcolor: backgroundColor,
|
|
10
|
-
width:
|
|
11
|
-
height:
|
|
10
|
+
width: 1920,
|
|
11
|
+
height: 1080,
|
|
12
12
|
quality: 1.0,
|
|
13
13
|
})
|
|
14
14
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Service } from "@vyr/service";
|
|
2
|
-
import { ScriptOption } from './data/global';
|
|
2
|
+
import { Global, ScriptOption } from './data/global';
|
|
3
3
|
import { Header } from "./data/header";
|
|
4
4
|
import { Body } from './data/body';
|
|
5
5
|
import { Sidebar } from './data/sidebar';
|
|
@@ -7,7 +7,7 @@ import { Inspector } from "./data/inspector";
|
|
|
7
7
|
import { Footer } from './data/footer';
|
|
8
8
|
import { Status } from './data/status';
|
|
9
9
|
declare class DataService extends Service {
|
|
10
|
-
readonly
|
|
10
|
+
readonly global: Global;
|
|
11
11
|
readonly header: Header;
|
|
12
12
|
readonly body: Body;
|
|
13
13
|
readonly sidebar: Sidebar;
|
|
@@ -22,6 +22,7 @@ declare abstract class Draggable<D extends AdditionalData = AdditionalData, T ex
|
|
|
22
22
|
abstract finished(dragData: DraggableData<D>, targetData: DraggableData<T>, type: DraggableEndType): void;
|
|
23
23
|
}
|
|
24
24
|
declare class DraggableKey {
|
|
25
|
+
example: string;
|
|
25
26
|
scene: string;
|
|
26
27
|
asset: string;
|
|
27
28
|
inspector: string;
|
|
@@ -12,4 +12,11 @@ interface ScriptOption {
|
|
|
12
12
|
getDefaultInput(): any;
|
|
13
13
|
getPropertyOptions?: () => ScriptPropertyOptionsGetters;
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
declare class Template {
|
|
16
|
+
visible: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare class Global {
|
|
19
|
+
readonly scripts: ScriptOption[];
|
|
20
|
+
readonly template: Template;
|
|
21
|
+
}
|
|
22
|
+
export { ScriptPropertyOptions, ScriptPropertyOptionsGetters, ScriptOption, Global, };
|
|
@@ -21,8 +21,7 @@ declare class Status {
|
|
|
21
21
|
}
|
|
22
22
|
/**该类会被响应式对象使用,定义方法时不要使用箭头函数(会导致在方法里修改变量时,直接修改了原始对象) */
|
|
23
23
|
declare abstract class SidebarNavigator {
|
|
24
|
-
|
|
25
|
-
readonly key: string;
|
|
24
|
+
abstract readonly key: string;
|
|
26
25
|
readonly label: string;
|
|
27
26
|
readonly icon: string;
|
|
28
27
|
readonly root: Descriptor;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ArrayUtils, AsyncTask, Descriptor } from "@vyr/engine"
|
|
2
|
-
import { DataService, runtime } from "@vyr/runtime"
|
|
2
|
+
import { DataService, runtime, SidebarNavigator } from "@vyr/runtime"
|
|
3
3
|
import { Message, RpcService, VirtualNode } from '@vyr/service-rpc'
|
|
4
4
|
import { AssetService } from "./AssetService"
|
|
5
5
|
|
|
@@ -99,6 +99,7 @@ class AssetMethodProvider {
|
|
|
99
99
|
|
|
100
100
|
_remove = (msg: InstanceType<typeof Message['asset']['remove']['NoticeMessage']>) => {
|
|
101
101
|
const dataService = runtime.get<DataService>('data')
|
|
102
|
+
const navigator = dataService.sidebar.get<SidebarNavigator>(AssetService.key)
|
|
102
103
|
|
|
103
104
|
for (const uuid of msg.params.uuids) {
|
|
104
105
|
const target = Descriptor.get<Descriptor>(uuid)
|
|
@@ -107,8 +108,8 @@ class AssetMethodProvider {
|
|
|
107
108
|
if (ancestor.parent === null) continue
|
|
108
109
|
ancestor.parent.remove(target)
|
|
109
110
|
|
|
110
|
-
ArrayUtils.removeByKey(
|
|
111
|
-
ArrayUtils.removeByKey(
|
|
111
|
+
ArrayUtils.removeByKey(navigator.selectAll, 'uuid', target.uuid)
|
|
112
|
+
ArrayUtils.removeByKey(navigator.status.stickupItems, 'uuid', target.uuid)
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
|
|
@@ -118,7 +119,9 @@ class AssetMethodProvider {
|
|
|
118
119
|
}
|
|
119
120
|
|
|
120
121
|
_dragdrap = (msg: InstanceType<typeof Message['asset']['dragdrap']['NoticeMessage']>) => {
|
|
121
|
-
|
|
122
|
+
const dataService = runtime.get<DataService>('data')
|
|
123
|
+
const navigator = dataService.sidebar.get<SidebarNavigator>(AssetService.key)
|
|
124
|
+
if (msg.params.url !== navigator.url) return
|
|
122
125
|
|
|
123
126
|
const method = msg.params.next ? 'insertBefore' : msg.params.type
|
|
124
127
|
const target = msg.params.next || msg.params.targetData.data.uuid
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import axios from 'axios'
|
|
2
2
|
import { Service } from '@vyr/service'
|
|
3
3
|
import { DraggableData, DraggableEndType, } from '@vyr/declare'
|
|
4
|
-
import { runtime
|
|
4
|
+
import { runtime } from '@vyr/runtime'
|
|
5
5
|
import { Descriptor, DeserializationObject } from '@vyr/engine'
|
|
6
6
|
import { RpcService, Message, VirtualNode } from '@vyr/service-rpc'
|
|
7
7
|
import { AssetMethodProvider } from "./AssetMethodProvider"
|
|
8
8
|
|
|
9
9
|
class AssetService extends Service {
|
|
10
|
+
static key = 'asset'
|
|
10
11
|
private _provider = new AssetMethodProvider(this)
|
|
11
|
-
readonly navigator
|
|
12
12
|
readonly root
|
|
13
13
|
|
|
14
|
-
constructor(name: string, root: VirtualNode
|
|
14
|
+
constructor(name: string, root: VirtualNode) {
|
|
15
15
|
super(name)
|
|
16
16
|
this.name = name
|
|
17
17
|
this.root = root
|
|
18
|
-
this.navigator = navigator
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
async ready() {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AsyncTask } from "@vyr/engine"
|
|
2
|
+
import { runtime } from "@vyr/runtime"
|
|
3
|
+
import { Message, RpcService } from '@vyr/service-rpc'
|
|
4
|
+
import { ExampleService } from './ExampleService'
|
|
5
|
+
|
|
6
|
+
class ExampleMethodProvider {
|
|
7
|
+
readonly ready = new AsyncTask()
|
|
8
|
+
readonly service
|
|
9
|
+
|
|
10
|
+
constructor(service: ExampleService) {
|
|
11
|
+
this.service = service
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
listen() {
|
|
15
|
+
const rpcService = runtime.get<RpcService>('rpc')
|
|
16
|
+
rpcService.listen(Message.rpc.connection.Method, this._connection)
|
|
17
|
+
rpcService.listen(Message.rpc.disconnect.Method, this._disconnect)
|
|
18
|
+
rpcService.listen(Message.example.initialize.Method, this._initialize)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
_connection = () => {
|
|
22
|
+
const rpcService = runtime.get<RpcService>('rpc')
|
|
23
|
+
rpcService.send(new Message.example.initialize.RequestMessage())
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
_disconnect = (msg: InstanceType<typeof Message['rpc']['disconnect']['NoticeMessage']>) => { }
|
|
27
|
+
|
|
28
|
+
_initialize = (msg: InstanceType<typeof Message['example']['initialize']['NoticeMessage']>, client: string) => {
|
|
29
|
+
this.ready.run()
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
ExampleMethodProvider
|
|
35
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { runtime } from '@vyr/runtime'
|
|
2
|
+
import { Message, RpcService } from '@vyr/service-rpc'
|
|
3
|
+
import { Service } from '@vyr/service'
|
|
4
|
+
import { ExampleMethodProvider } from './ExampleMethodProvider'
|
|
5
|
+
|
|
6
|
+
class ExampleService extends Service {
|
|
7
|
+
private _provider
|
|
8
|
+
|
|
9
|
+
constructor(name: string) {
|
|
10
|
+
super(name)
|
|
11
|
+
this._provider = new ExampleMethodProvider(this)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async ready() {
|
|
15
|
+
this._provider.listen()
|
|
16
|
+
}
|
|
17
|
+
async start() {
|
|
18
|
+
await this._provider.ready.done()
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
list(name: string) {
|
|
22
|
+
const rpcService = runtime.get<RpcService>('rpc')
|
|
23
|
+
return rpcService.send(new Message.example.list.RequestMessage(name))
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
create(example: InstanceType<typeof Message['example']['create']['RequestMessage']>['params']) {
|
|
27
|
+
const rpcService = runtime.get<RpcService>('rpc')
|
|
28
|
+
return rpcService.send(new Message.example.create.RequestMessage(example))
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
delete(example: string) {
|
|
32
|
+
const rpcService = runtime.get<RpcService>('rpc')
|
|
33
|
+
return rpcService.send(new Message.example.delete.RequestMessage(example))
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
apply(example: string, node: string) {
|
|
37
|
+
const rpcService = runtime.get<RpcService>('rpc')
|
|
38
|
+
return rpcService.send(new Message.example.apply.RequestMessage(example, node))
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { ExampleService }
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Locale } from "@vyr/locale";
|
|
2
|
+
import { zhCnLanguageProvider, ZhCNLanguageProvider } from "./LanguageProvider";
|
|
3
|
+
|
|
4
|
+
Locale.register(zhCnLanguageProvider)
|
|
5
|
+
|
|
6
|
+
const language = Locale.getLanguage<ZhCNLanguageProvider>(zhCnLanguageProvider.name)
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
language
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LanguageProvider } from '@vyr/locale'
|
|
2
|
+
|
|
3
|
+
interface ZhCNLanguageProvider extends LanguageProvider {
|
|
4
|
+
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const zhCnLanguageProvider: ZhCNLanguageProvider = {
|
|
8
|
+
id: 'zh_CN',
|
|
9
|
+
name: '@vyr/service-example',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
ZhCNLanguageProvider,
|
|
14
|
+
zhCnLanguageProvider,
|
|
15
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"lib": [
|
|
7
|
+
"ESNext",
|
|
8
|
+
"DOM",
|
|
9
|
+
"DOM.Iterable"
|
|
10
|
+
],
|
|
11
|
+
"outDir": "build",
|
|
12
|
+
"strict": true,
|
|
13
|
+
"jsx": "preserve",
|
|
14
|
+
"declaration": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"esModuleInterop": true,
|
|
17
|
+
"allowSyntheticDefaultImports": true,
|
|
18
|
+
"forceConsistentCasingInFileNames": true,
|
|
19
|
+
"useDefineForClassFields": true,
|
|
20
|
+
"sourceMap": false,
|
|
21
|
+
"baseUrl": "",
|
|
22
|
+
"types": [
|
|
23
|
+
"node"
|
|
24
|
+
],
|
|
25
|
+
"paths": {}
|
|
26
|
+
},
|
|
27
|
+
"include": [
|
|
28
|
+
"src/**/*.ts",
|
|
29
|
+
],
|
|
30
|
+
"exclude": []
|
|
31
|
+
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vyr/service-rpc-universal",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"
|
|
9
|
+
"moment": "^2.30.1",
|
|
10
|
+
"@vyr/engine": "0.0.21"
|
|
10
11
|
},
|
|
11
12
|
"files": [
|
|
12
13
|
"package.json",
|
|
@@ -3,6 +3,7 @@ import * as rpc from './rpc'
|
|
|
3
3
|
import * as sidebar from './sidebar'
|
|
4
4
|
import * as asset from './asset'
|
|
5
5
|
import * as scene from './scene'
|
|
6
|
+
import * as example from './example'
|
|
6
7
|
import * as dep from './dep'
|
|
7
8
|
|
|
8
9
|
/** 通信消息 */
|
|
@@ -11,6 +12,7 @@ class Message extends IMessage {
|
|
|
11
12
|
static sidebar = sidebar
|
|
12
13
|
static asset = asset
|
|
13
14
|
static scene = scene
|
|
15
|
+
static example = example
|
|
14
16
|
static dep = dep
|
|
15
17
|
}
|
|
16
18
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import axios from 'axios'
|
|
2
|
-
import {
|
|
2
|
+
import { Serialization, Listener } from '@vyr/engine'
|
|
3
3
|
import { Service } from '@vyr/service'
|
|
4
4
|
import { path, tokenKey, topic, Confirm, Message } from '@vyr/service-rpc-universal'
|
|
5
5
|
|
|
@@ -55,7 +55,7 @@ class RpcService extends Service {
|
|
|
55
55
|
this.socket = new window.io(location.href, params)
|
|
56
56
|
|
|
57
57
|
this.socket.on(topic, (content: string) => {
|
|
58
|
-
const msg =
|
|
58
|
+
const msg = Serialization.parse(content) as Message
|
|
59
59
|
if (msg.message !== undefined) return config.notify(msg.message)
|
|
60
60
|
this._delayTrigger(msg)
|
|
61
61
|
})
|
|
@@ -106,7 +106,7 @@ class RpcService extends Service {
|
|
|
106
106
|
trigger<T extends Message = Message>(method: string, msg: T) {
|
|
107
107
|
this._listener.trigger(method, msg)
|
|
108
108
|
}
|
|
109
|
-
listen<T extends Message = Message>(method: string, cb: (msg: T) => void) {
|
|
109
|
+
listen<T extends Message = Message>(method: string, cb: (msg: T, ...others: any[]) => void) {
|
|
110
110
|
this._listener.listen(method, cb)
|
|
111
111
|
}
|
|
112
112
|
unlisten<T extends Message = Message>(method: string, cb: (msg: T) => void) {
|
|
@@ -114,8 +114,18 @@ class RpcService extends Service {
|
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
/**向服务端发送数据 */
|
|
117
|
-
send(msg: Message) {
|
|
118
|
-
|
|
117
|
+
send<T extends Message | void = Message>(msg: Message) {
|
|
118
|
+
return new Promise<T>(resolve => {
|
|
119
|
+
this.socket.emit(topic, Serialization.stringify(msg), (content: string) => {
|
|
120
|
+
if (content) {
|
|
121
|
+
const msg = Serialization.parse(content)
|
|
122
|
+
resolve(msg as T)
|
|
123
|
+
} else {
|
|
124
|
+
//@ts-ignore
|
|
125
|
+
resolve()
|
|
126
|
+
}
|
|
127
|
+
})
|
|
128
|
+
})
|
|
119
129
|
}
|
|
120
130
|
}
|
|
121
131
|
|