@vyr/engine 0.0.22 → 0.0.24
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 +2 -2
- package/src/asset/Asset.ts +4 -4
- package/src/preset/execute/dataset/update.ts +1 -1
- package/src/preset/execute/graphics/invoke.ts +1 -1
- package/src/preset/execute/net/http.ts +1 -1
- package/src/preset/execute/scheduler/switch.ts +1 -1
- package/src/preset/interaction/graphics/invoke.ts +1 -1
- package/src/preset/interaction/scheduler/switch.ts +1 -1
- package/src/utils/AssetProvider.ts +1 -17
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vyr/engine",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
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.24",
|
|
10
10
|
"tinycolor2": "1.6.0"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
package/src/asset/Asset.ts
CHANGED
|
@@ -65,7 +65,7 @@ class Asset {
|
|
|
65
65
|
return `/${this.virtual}:/${fileName}`
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
static
|
|
68
|
+
static setProvider(url: string, provider: DescriptorProvider | ScriptableProvider) {
|
|
69
69
|
privateState.providerCollection.set(url, provider)
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -221,9 +221,9 @@ class Asset {
|
|
|
221
221
|
export { Asset, JsonAsset, RawAsset, DescriptorProvider, ScriptableProvider, AssetProperty, AssetPropertyCollection, privateState }
|
|
222
222
|
|
|
223
223
|
const getAssetByProvider = async (url: string) => {
|
|
224
|
-
const
|
|
225
|
-
if (
|
|
226
|
-
return await
|
|
224
|
+
const provider = privateState.providerCollection.get(url)
|
|
225
|
+
if (provider === undefined) return null
|
|
226
|
+
return await provider() as unknown as any
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
const factoryDescriptor = async (url: string) => {
|
|
@@ -20,7 +20,7 @@ class ExecuteScriptable extends Scriptable {
|
|
|
20
20
|
return {}
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
Asset.
|
|
23
|
+
Asset.setProvider(scriptable, async () => ({ default: ExecuteScriptable }))
|
|
24
24
|
|
|
25
25
|
const createExecuteInput = (args: any = {}) => {
|
|
26
26
|
const input = {
|
|
@@ -16,7 +16,7 @@ class ExecuteScriptable extends Scriptable {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
Asset.
|
|
19
|
+
Asset.setProvider(scriptable, async () => ({ default: ExecuteScriptable }))
|
|
20
20
|
|
|
21
21
|
const createExecuteInput = (args: any = {}) => {
|
|
22
22
|
const input = {
|
|
@@ -18,7 +18,7 @@ class ExecuteScriptable extends Scriptable {
|
|
|
18
18
|
return json
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
Asset.
|
|
21
|
+
Asset.setProvider(scriptable, async () => ({ default: ExecuteScriptable }))
|
|
22
22
|
|
|
23
23
|
const createExecuteInput = (args: any = {}) => {
|
|
24
24
|
const input = {
|
|
@@ -15,7 +15,7 @@ class ExecuteScriptable extends Scriptable {
|
|
|
15
15
|
graphics.engine.switch(scheduler)
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
Asset.
|
|
18
|
+
Asset.setProvider(scriptable, async () => ({ default: ExecuteScriptable }))
|
|
19
19
|
|
|
20
20
|
const createExecuteInput = (args: any = {}) => {
|
|
21
21
|
const input = {
|
|
@@ -30,27 +30,12 @@ const DescriptorProvider = (descriptor: Descriptor, port: Port) => {
|
|
|
30
30
|
const interaction = descriptor.interactions[i]
|
|
31
31
|
if (interaction.url) {
|
|
32
32
|
interactionExecutor(interaction, `interactions[${i}]`, port)
|
|
33
|
-
|
|
34
|
-
port.edges.push({ key: `interactions[${i}].url`, category: Category.interaction, asset: interaction.url })
|
|
35
|
-
}
|
|
33
|
+
port.edges.push({ key: `interactions[${i}].url`, category: Category.interaction, asset: interaction.url })
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
}
|
|
39
37
|
if (descriptor.dataset) port.edges.push({ key: 'dataset', category: Category.dataset, asset: descriptor.dataset })
|
|
40
38
|
}
|
|
41
|
-
|
|
42
|
-
const DatasetDescriptorProvider = (descriptor: DatasetDescriptor, port: Port) => {
|
|
43
|
-
if (descriptor.dataConfigs.length > 0) {
|
|
44
|
-
for (let i = 0; i < descriptor.dataConfigs.length; i++) {
|
|
45
|
-
const dataConfig = descriptor.dataConfigs[i]
|
|
46
|
-
if (dataConfig.url && dataConfig.url.startsWith('/') && dataConfig.url.endsWith('.json')) {
|
|
47
|
-
port.edges.push({ key: `dataConfig[${i}].url`, category: Category.json, asset: dataConfig.url })
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (descriptor.dataset) port.edges.push({ key: 'dataset', category: Category.dataset, asset: descriptor.dataset })
|
|
52
|
-
}
|
|
53
|
-
|
|
54
39
|
const StyleDescriptorProvider = (descriptor: StyleDescriptor, port: Port) => {
|
|
55
40
|
if (descriptor.inherit) port.edges.push({ key: 'inherit', category: Category.style, asset: descriptor.inherit })
|
|
56
41
|
}
|
|
@@ -84,7 +69,6 @@ const PrefabInstanceDescriptorProvider = (descriptor: PrefabInstanceDescriptor,
|
|
|
84
69
|
}
|
|
85
70
|
|
|
86
71
|
AssetGraph.register(Descriptor.type, DescriptorProvider)
|
|
87
|
-
AssetGraph.register(DatasetDescriptor.type, DatasetDescriptorProvider)
|
|
88
72
|
AssetGraph.register(StyleDescriptor.type, StyleDescriptorProvider)
|
|
89
73
|
AssetGraph.register(InteractionDescriptor.type, InteractionDescriptorProvider)
|
|
90
74
|
AssetGraph.register(HTMLDescriptor.type, HTMLDescriptorProvider)
|