@vyr/engine 0.0.1 → 0.0.2

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.
Files changed (56) hide show
  1. package/package.json +1 -19
  2. package/src/Category.ts +7 -7
  3. package/src/Engine.ts +12 -12
  4. package/src/actor/AnimationUnitActor.ts +3 -3
  5. package/src/actor/DivActor.ts +6 -6
  6. package/src/actor/FragmentActor.ts +3 -3
  7. package/src/actor/HTMActor.ts +19 -16
  8. package/src/actor/HTMServiceActor.ts +4 -4
  9. package/src/actor/HTMTransformControllerActor.ts +15 -10
  10. package/src/asset/Asset.ts +9 -26
  11. package/src/asset/AssetGraph.ts +4 -4
  12. package/src/descriptor/DatasetDescriptor.ts +20 -22
  13. package/src/descriptor/Descriptor.ts +1 -28
  14. package/src/descriptor/HTMLTransformControllerDescriptor.ts +2 -2
  15. package/src/descriptor/index.ts +0 -1
  16. package/src/graphics/Compilation.ts +19 -30
  17. package/src/graphics/Graphics.ts +79 -66
  18. package/src/graphics/VariableProxy.ts +8 -8
  19. package/src/index.ts +2 -1
  20. package/src/interaction/InteractionDescriptor.ts +96 -0
  21. package/src/interaction/InteractionExecutor.ts +84 -0
  22. package/src/interaction/Scriptable.ts +40 -0
  23. package/src/interaction/index.ts +3 -0
  24. package/src/interpreter/AnimationUnitInterpreter.ts +5 -5
  25. package/src/interpreter/DivInterpreter.ts +15 -15
  26. package/src/interpreter/DynamicInterpreter.ts +9 -9
  27. package/src/interpreter/FragmentInterpreter.ts +10 -10
  28. package/src/interpreter/HTMLServiceInterpreter.ts +15 -15
  29. package/src/interpreter/HTMLTransformControllerInterpreter.ts +15 -15
  30. package/src/interpreter/Interpreter.ts +9 -9
  31. package/src/interpreter/ServiceInterpreter.ts +6 -6
  32. package/src/interpreter/ServiceSchedulerInterpreter.ts +6 -6
  33. package/src/interpreter/StyleInterpreter.ts +7 -7
  34. package/src/interpreter/index.ts +0 -1
  35. package/src/locale/LanguageProvider.ts +4 -2
  36. package/src/preset/execute/dataset/compile.ts +43 -0
  37. package/src/preset/execute/dataset/index.ts +2 -1
  38. package/src/preset/execute/dataset/update.ts +7 -8
  39. package/src/preset/execute/graphics/invoke.ts +5 -6
  40. package/src/preset/execute/net/{request.ts → http.ts} +7 -16
  41. package/src/preset/execute/net/index.ts +1 -1
  42. package/src/preset/execute/scheduler/switch.ts +7 -8
  43. package/src/preset/index.ts +2 -2
  44. package/src/preset/interaction/graphics/invoke.ts +27 -0
  45. package/src/preset/interaction/scheduler/switch.ts +27 -0
  46. package/src/utils/AssetProvider.ts +7 -6
  47. package/src/utils/constants.ts +10 -0
  48. package/src/utils/index.ts +1 -0
  49. package/src/Scriptable.ts +0 -27
  50. package/src/descriptor/RoutineDescriptor.ts +0 -54
  51. package/src/interpreter/RoutineInterpreter.ts +0 -88
  52. package/src/preset/routine/graphics/invoke.ts +0 -27
  53. package/src/preset/routine/scheduler/switch.ts +0 -27
  54. /package/src/preset/{routine → interaction}/graphics/index.ts +0 -0
  55. /package/src/preset/{routine → interaction}/index.ts +0 -0
  56. /package/src/preset/{routine → interaction}/scheduler/index.ts +0 -0
@@ -1 +1,2 @@
1
- export * as update from './update'
1
+ export * as update from './update'
2
+ export * as compile from './compile'
@@ -1,16 +1,15 @@
1
1
  import { language } from "../../../locale";
2
2
  import { Asset } from "../../../asset";
3
- import { DatasetDescriptor, Descriptor, RoutineNode, UpdateArgs } from "../../../descriptor";
3
+ import { DatasetDescriptor } from "../../../descriptor";
4
+ import { InteractionNode, Scriptable, ScriptableArgs } from "../../../interaction";
4
5
  import { Graphics } from "../../../graphics";
5
- import { Scriptable } from "../../../Scriptable";
6
6
  import { Category } from "../../../Category";
7
7
 
8
8
  const scriptable = Asset.createVirtualUrl('preset/dataset/update.ts')
9
9
  class ExecuteScriptable extends Scriptable {
10
- async execute(descriptor: Descriptor, graphics: Graphics, args: UpdateArgs) {
11
- //@ts-ignore
10
+ async execute(graphics: Graphics, args: ScriptableArgs) {
12
11
  const { input, result } = args
13
- const dataset = input?.user?.url.value ?? input.default.url.value
12
+ const dataset = input?.user?.dataset.value ?? input.default.dataset.value
14
13
 
15
14
  const previous = result.get(input.previous)
16
15
  const datasetDescriptor = Asset.get<DatasetDescriptor>(dataset)
@@ -25,18 +24,18 @@ Asset.provider(scriptable, async () => ({ default: ExecuteScriptable }))
25
24
 
26
25
  const createExecuteInput = (args: any = {}) => {
27
26
  const input = {
28
- url: { value: args.url ?? '', type: Category.dataset }
27
+ dataset: { value: args.dataset ?? '', type: Category.dataset }
29
28
  }
30
29
 
31
30
  return input
32
31
  }
33
32
 
34
33
  const createExecuteNode = (options: { id: string; position?: any; input?: any }) => {
35
- const executeNode: RoutineNode = {
34
+ const executeNode: InteractionNode = {
36
35
  id: options.id,
37
36
  label: language.get(scriptable as any),
38
37
  position: { x: options?.position?.x ?? 20, y: options?.position?.y ?? 20 },
39
- routine: 'Execute',
38
+ interaction: 'Execute',
40
39
  url: scriptable,
41
40
  input: createExecuteInput(options.input)
42
41
  }
@@ -1,13 +1,12 @@
1
1
  import { language } from "../../../locale";
2
2
  import { Asset } from "../../../asset";
3
- import { Descriptor, RoutineNode, UpdateArgs } from "../../../descriptor";
3
+ import { Descriptor } from "../../../descriptor";
4
+ import { InteractionNode, Scriptable, ScriptableArgs } from "../../../interaction";
4
5
  import { Graphics } from "../../../graphics";
5
- import { Scriptable } from "../../../Scriptable";
6
6
 
7
7
  const scriptable = Asset.createVirtualUrl('preset/graphics/invoke.ts')
8
8
  class ExecuteScriptable extends Scriptable {
9
- async execute(descriptor: Descriptor, graphics: Graphics, args: UpdateArgs) {
10
- //@ts-ignore
9
+ async execute(graphics: Graphics, args: ScriptableArgs) {
11
10
  const { input } = args
12
11
  const interaction = input?.user?.interaction.value ?? input.default.interaction.value
13
12
  const target = input?.user?.target.value ?? input.default.target.value
@@ -29,11 +28,11 @@ const createExecuteInput = (args: any = {}) => {
29
28
  }
30
29
 
31
30
  const createExecuteNode = (options: { id: string; position?: any; input?: any }) => {
32
- const executeNode: RoutineNode = {
31
+ const executeNode: InteractionNode = {
33
32
  id: options.id,
34
33
  label: language.get(scriptable as any),
35
34
  position: { x: options?.position?.x ?? 20, y: options?.position?.y ?? 20 },
36
- routine: 'Execute',
35
+ interaction: 'Execute',
37
36
  url: scriptable,
38
37
  input: createExecuteInput(options.input)
39
38
  }
@@ -1,17 +1,10 @@
1
1
  import { language } from "../../../locale";
2
2
  import { Asset } from "../../../asset";
3
- import { Descriptor, RoutineNode, UpdateArgs } from "../../../descriptor";
3
+ import { HttpType } from "../../../utils";
4
4
  import { Graphics } from "../../../graphics";
5
- import { Scriptable } from "../../../Scriptable";
5
+ import { Scriptable, InteractionNode, ScriptableArgs } from "../../../interaction";
6
6
 
7
- enum RequestType {
8
- GET = 'GET',
9
- POST = 'POST',
10
- PUT = 'PUT',
11
- DELETE = 'DELETE',
12
- }
13
-
14
- const scriptable = Asset.createVirtualUrl('preset/net/request.ts')
7
+ const scriptable = Asset.createVirtualUrl('preset/net/http.ts')
15
8
  class ExecuteScriptable extends Scriptable {
16
9
 
17
10
  joinUrl(url: string, requestData: any) {
@@ -27,8 +20,7 @@ class ExecuteScriptable extends Scriptable {
27
20
  return urlObj.toString()
28
21
  }
29
22
 
30
- async execute(descriptor: Descriptor, graphics: Graphics, args: UpdateArgs) {
31
- //@ts-ignore
23
+ async execute(graphics: Graphics, args: ScriptableArgs) {
32
24
  const { input, result } = args
33
25
  let url = input?.user?.url.value ?? input.default.url.value
34
26
  const type: string = input?.user?.type.value ?? input.default.type.value
@@ -58,7 +50,7 @@ class ExecuteScriptable extends Scriptable {
58
50
  },
59
51
  }
60
52
  let res
61
- if (type === RequestType.GET) {
53
+ if (type === HttpType.GET) {
62
54
  res = await fetch(this.joinUrl(url, requestData), config)
63
55
  } else {
64
56
  res = await fetch(url, { ...config, body: JSON.stringify(requestData) })
@@ -82,11 +74,11 @@ const createExecuteInput = (args: any = {}) => {
82
74
  }
83
75
 
84
76
  const createExecuteNode = (options: { id: string; position?: any; input?: any }) => {
85
- const executeNode: RoutineNode = {
77
+ const executeNode: InteractionNode = {
86
78
  id: options.id,
87
79
  label: language.get(scriptable as any),
88
80
  position: { x: options?.position?.x ?? 20, y: options?.position?.y ?? 20 },
89
- routine: 'Execute',
81
+ interaction: 'Execute',
90
82
  url: scriptable,
91
83
  input: createExecuteInput(options.input)
92
84
  }
@@ -95,7 +87,6 @@ const createExecuteNode = (options: { id: string; position?: any; input?: any })
95
87
 
96
88
  export {
97
89
  scriptable,
98
- RequestType,
99
90
  createExecuteInput,
100
91
  createExecuteNode,
101
92
  }
@@ -1 +1 @@
1
- export * as request from './request'
1
+ export * as http from './http'
@@ -1,14 +1,13 @@
1
1
  import { language } from "../../../locale";
2
2
  import { Asset } from "../../../asset";
3
- import { Descriptor, RoutineNode, ServiceSchedulerDescriptor, UpdateArgs } from "../../../descriptor";
3
+ import { ServiceSchedulerDescriptor } from "../../../descriptor";
4
+ import { InteractionNode, Scriptable, ScriptableArgs } from "../../../interaction";
4
5
  import { Graphics } from "../../../graphics";
5
- import { Scriptable } from "../../../Scriptable";
6
6
 
7
7
  const scriptable = Asset.createVirtualUrl('preset/scheduler/switch.ts')
8
8
  class ExecuteScriptable extends Scriptable {
9
- async execute(descriptor: Descriptor, graphics: Graphics, args: UpdateArgs) {
10
- //@ts-ignore
11
- const scene = args.input?.user?.url.value
9
+ async execute(graphics: Graphics, args: ScriptableArgs) {
10
+ const scene = args.input?.user?.scene.value
12
11
  if (!scene) return
13
12
  await Asset.loadAll(scene)
14
13
  const scheduler = Asset.get<ServiceSchedulerDescriptor>(scene)
@@ -19,18 +18,18 @@ Asset.provider(scriptable, async () => ({ default: ExecuteScriptable }))
19
18
 
20
19
  const createExecuteInput = (args: any = {}) => {
21
20
  const input = {
22
- url: { value: args.url ?? '' },
21
+ scene: { value: args.scene ?? '' },
23
22
  }
24
23
 
25
24
  return input
26
25
  }
27
26
 
28
27
  const createExecuteNode = (options: { id: string; position?: any; input?: any }) => {
29
- const executeNode: RoutineNode = {
28
+ const executeNode: InteractionNode = {
30
29
  id: options.id,
31
30
  label: language.get(scriptable as any),
32
31
  position: { x: options?.position?.x ?? 20, y: options?.position?.y ?? 20 },
33
- routine: 'Execute',
32
+ interaction: 'Execute',
34
33
  url: scriptable,
35
34
  input: createExecuteInput(options.input)
36
35
  }
@@ -1,7 +1,7 @@
1
1
  import * as executePreset from './execute'
2
- import * as routinePreset from './routine'
2
+ import * as interactionPreset from './interaction'
3
3
 
4
4
  export {
5
5
  executePreset,
6
- routinePreset
6
+ interactionPreset
7
7
  }
@@ -0,0 +1,27 @@
1
+ import { Asset } from "../../../asset";
2
+ import { InteractionDescriptor } from "../../../interaction";
3
+ import { graphics } from "../../execute"
4
+
5
+ const url = Asset.createVirtualUrl('preset/graphics/invoke.interaction.json')
6
+ const nodes = {
7
+ invoke: 'invoke'
8
+ }
9
+ let _currentInteraction: InteractionDescriptor | null = null
10
+ const interactionProvider = async () => {
11
+ if (_currentInteraction === null) {
12
+ _currentInteraction = new InteractionDescriptor()
13
+ const invokeNode = graphics.invoke.createExecuteNode({ id: nodes.invoke })
14
+ _currentInteraction.nodes.push(invokeNode)
15
+ _currentInteraction.roots.push(invokeNode.id)
16
+ }
17
+ return _currentInteraction
18
+ }
19
+
20
+ Asset.provider(url, interactionProvider)
21
+
22
+ export {
23
+ url,
24
+ nodes,
25
+ }
26
+
27
+
@@ -0,0 +1,27 @@
1
+ import { Asset } from "../../../asset";
2
+ import { InteractionDescriptor } from "../../../interaction";
3
+ import { scheduler } from "../../execute"
4
+
5
+ const url = Asset.createVirtualUrl('preset/scheduler/switch.interaction.json')
6
+ const nodes = {
7
+ switch: 'switch',
8
+ }
9
+ let _currentInteraction: InteractionDescriptor | null = null
10
+ const interactionProvider = async () => {
11
+ if (_currentInteraction === null) {
12
+ _currentInteraction = new InteractionDescriptor()
13
+ const switchNode = scheduler.switch.createExecuteNode({ id: nodes.switch })
14
+ _currentInteraction.nodes.push(switchNode)
15
+ _currentInteraction.roots.push(switchNode.id)
16
+ }
17
+ return _currentInteraction
18
+ }
19
+
20
+ Asset.provider(url, interactionProvider)
21
+
22
+ export {
23
+ url,
24
+ nodes,
25
+ }
26
+
27
+
@@ -1,4 +1,5 @@
1
- import { Descriptor, DynamicDescriptor, PrefabInstanceDescriptor, RoutineDescriptor, HTMLDescriptor, StyleDescriptor, InteractionProperty, RoutineNode } from "../descriptor"
1
+ import { InteractionDescriptor, InteractionNode, InteractionProperty } from "../interaction"
2
+ import { Descriptor, DynamicDescriptor, PrefabInstanceDescriptor, HTMLDescriptor, StyleDescriptor } from "../descriptor"
2
3
  import { AssetGraph, Port } from "../asset"
3
4
  import { Category } from "../Category"
4
5
 
@@ -14,7 +15,7 @@ const interactionExecutor = (interaction: InteractionProperty, path: string, por
14
15
  }
15
16
  }
16
17
  }
17
- const routineNodeExecutor = (node: RoutineNode, path: string, port: Port) => {
18
+ const interactionNodeExecutor = (node: InteractionNode, path: string, port: Port) => {
18
19
  const params = Object.keys(node.input)
19
20
  for (const param of params) {
20
21
  const value = node.input[param]
@@ -29,7 +30,7 @@ const DescriptorProvider = (descriptor: Descriptor, port: Port) => {
29
30
  const interaction = descriptor.interactions[i]
30
31
  if (interaction.url) {
31
32
  interactionExecutor(interaction, `interactions[${i}]`, port)
32
- port.edges.push({ key: `interactions[${i}].url`, category: Category.routine, asset: interaction.url })
33
+ port.edges.push({ key: `interactions[${i}].url`, category: Category.interaction, asset: interaction.url })
33
34
  }
34
35
  }
35
36
  }
@@ -40,12 +41,12 @@ const StyleDescriptorProvider = (descriptor: StyleDescriptor, port: Port) => {
40
41
  if (descriptor.inherit) port.edges.push({ key: 'inherit', category: Category.style, asset: descriptor.inherit })
41
42
  }
42
43
 
43
- const RoutineDescriptorProvider = (descriptor: RoutineDescriptor, port: Port) => {
44
+ const InteractionDescriptorProvider = (descriptor: InteractionDescriptor, port: Port) => {
44
45
  if (descriptor.nodes.length > 0) {
45
46
  for (let i = 0; i < descriptor.nodes.length; i++) {
46
47
  const node = descriptor.nodes[i]
47
48
  if (node.url) {
48
- routineNodeExecutor(node, `nodes[${i}]`, port)
49
+ interactionNodeExecutor(node, `nodes[${i}]`, port)
49
50
  port.edges.push({ key: `nodes[${i}].url`, category: Category.ts, asset: node.url })
50
51
  }
51
52
  }
@@ -66,7 +67,7 @@ const PrefabInstanceDescriptorProvider = (descriptor: PrefabInstanceDescriptor,
66
67
 
67
68
  AssetGraph.register(Descriptor.type, DescriptorProvider)
68
69
  AssetGraph.register(StyleDescriptor.type, StyleDescriptorProvider)
69
- AssetGraph.register(RoutineDescriptor.type, RoutineDescriptorProvider)
70
+ AssetGraph.register(InteractionDescriptor.type, InteractionDescriptorProvider)
70
71
  AssetGraph.register(HTMLDescriptor.type, HTMLDescriptorProvider)
71
72
  AssetGraph.register(DynamicDescriptor.type, DynamicDescriptorProvider)
72
73
  AssetGraph.register(PrefabInstanceDescriptor.type, PrefabInstanceDescriptorProvider)
@@ -0,0 +1,10 @@
1
+ enum HttpType {
2
+ GET = 'GET',
3
+ POST = 'POST',
4
+ PUT = 'PUT',
5
+ DELETE = 'DELETE',
6
+ }
7
+
8
+ export {
9
+ HttpType
10
+ }
@@ -1 +1,2 @@
1
+ export * from './constants'
1
2
  export * from './AssetProvider'
package/src/Scriptable.ts DELETED
@@ -1,27 +0,0 @@
1
- import { Descriptor, UpdateArgs } from "./descriptor"
2
- import { Graphics } from "./graphics/Graphics"
3
-
4
- /**
5
- * 可编程脚本(脚本不会在服务端实例化)
6
- */
7
- class Scriptable {
8
- readonly uuid
9
- /**脚本文件的url路径 */
10
- get url() {
11
- return this.uuid
12
- }
13
-
14
- constructor(url: string) {
15
- this.uuid = url
16
- }
17
-
18
- /**脚本的准备事件,该方法在脚本被实例化后立即执行
19
- *
20
- * 一般在该事件中进行脚本的准备工作,如从服务端获取资源或数据
21
- */
22
- async ready() { }
23
-
24
- execute(descriptor: Descriptor, graphics: Graphics, args: UpdateArgs): any { }
25
- }
26
-
27
- export { Scriptable }
@@ -1,54 +0,0 @@
1
- import { DeserializationObject } from "../Serialization";
2
- import { Descriptor, InteractionInput, UpdateArgs } from ".";
3
-
4
- interface RoutineNode {
5
- id: string
6
- label: string
7
- position: { x: number; y: number }
8
- routine: string
9
- url: string
10
- input: InteractionInput
11
- }
12
-
13
- interface RoutineMapper {
14
- source: string
15
- target: string
16
- }
17
-
18
- interface RoutineUpdateArgs<T = InteractionInput> extends UpdateArgs {
19
- input: {
20
- previous: string
21
- default: T
22
- user: T
23
- }
24
- }
25
-
26
- class RoutineDescriptor extends Descriptor {
27
- static type = 'Routine'
28
- roots: string[]
29
- nodes: RoutineNode[]
30
- mappers: RoutineMapper[]
31
-
32
- constructor(descriptor: Partial<DeserializationObject<RoutineDescriptor>> = {}) {
33
- super(descriptor)
34
- this.roots = descriptor.roots ? Descriptor.deepClone(descriptor.roots) : []
35
- this.nodes = descriptor.nodes ? Descriptor.deepClone(descriptor.nodes) : []
36
- this.mappers = descriptor.mappers ? Descriptor.deepClone(descriptor.mappers) : []
37
- }
38
-
39
- addNode(nodes: RoutineNode[]) {
40
- const count = nodes.length
41
- const max = count - 1
42
- for (let i = 0; i < count; i++) {
43
- const node = nodes[i]
44
- this.nodes.push(node)
45
- if (i < max) {
46
- this.mappers.push({ source: node.id, target: nodes[i + 1].id })
47
- }
48
- }
49
- }
50
- }
51
- Descriptor.register(RoutineDescriptor)
52
-
53
-
54
- export { RoutineNode, RoutineMapper, RoutineUpdateArgs, RoutineDescriptor }
@@ -1,88 +0,0 @@
1
- import { Asset } from "../asset";
2
- import { Scriptable } from "../Scriptable";
3
- import { RoutineDescriptor, RoutineNode, UpdateArgs, InteractionInputCollection } from "../descriptor";
4
- import { Interpreter } from "./Interpreter";
5
-
6
- type ExecuteResult = { [k: string]: any } | null
7
-
8
- class RoutineInterpreter extends Interpreter {
9
- static type = RoutineDescriptor.type
10
- readonly collection = new Map<string, RoutineNode>()
11
- readonly linkCollection = new Map<string, string[]>()
12
-
13
- update(descriptor: RoutineDescriptor, args: UpdateArgs) {
14
- super.update(descriptor, args)
15
-
16
- this.collection.clear()
17
- this.linkCollection.clear()
18
-
19
- for (const node of descriptor.nodes) {
20
- this.collection.set(node.id, node)
21
- }
22
-
23
- for (const mapper of descriptor.mappers) {
24
- let link = this.linkCollection.get(mapper.source)
25
- if (link === undefined) {
26
- link = []
27
- this.linkCollection.set(mapper.source, link)
28
- }
29
- link.push(mapper.target)
30
- }
31
- }
32
-
33
- async doBranch(branch: string, previous: string, customInputs: InteractionInputCollection, descriptor: RoutineDescriptor, args: UpdateArgs, result: Map<string, ExecuteResult>) {
34
- this.doExecute(branch, previous, customInputs, descriptor, args, result)
35
- }
36
-
37
- async doCondition(condition: string, previous: string, customInputs: InteractionInputCollection, descriptor: RoutineDescriptor, args: UpdateArgs, result: Map<string, ExecuteResult>) {
38
- const preResult = result.get(previous)
39
- const conditionResult = result.get(condition)
40
- if (preResult !== conditionResult?.condition.value) return
41
-
42
- this.doExecute(condition, previous, customInputs, descriptor, args, result)
43
- }
44
-
45
- async doExecute(execute: string, previous: string, customInputs: InteractionInputCollection, descriptor: RoutineDescriptor, args: UpdateArgs, result: Map<string, ExecuteResult>) {
46
- const nexts = this.linkCollection.get(execute)
47
- if (nexts === undefined) return
48
-
49
- for (const next of nexts) {
50
- await this.doNext(next, execute, customInputs, descriptor, args, result)
51
- }
52
- }
53
-
54
- async doNext(current: string, previous: string, customInputs: InteractionInputCollection, descriptor: RoutineDescriptor, args: UpdateArgs, result: Map<string, ExecuteResult>) {
55
- const active = this.collection.get(current)
56
- if (active === undefined) return
57
-
58
- const currentInput = customInputs[current] ?? {}
59
- const script = Asset.get<Scriptable>(active.url)
60
- if (script) {
61
- const event = { ...args, input: { previous, default: active.input, user: currentInput }, result }
62
- const executeResult = await script.execute(descriptor, this.graphics, event)
63
- result.set(current, executeResult)
64
- }
65
-
66
- if (active.routine === 'Branch') {
67
- this.doBranch(current, previous, customInputs, descriptor, args, result)
68
- } else if (active.routine === 'Condition') {
69
- if (result.has(current) === false) result.set(current, active.input)
70
- this.doCondition(current, previous, customInputs, descriptor, args, result)
71
- } else {
72
- this.doExecute(current, previous, customInputs, descriptor, args, result)
73
- }
74
- }
75
-
76
- do(customInputs: InteractionInputCollection, descriptor: RoutineDescriptor, args: UpdateArgs) {
77
- for (const root of descriptor.roots) {
78
- const resultCollection = new Map()
79
- this.doNext(root, '', customInputs, descriptor, args, resultCollection)
80
- }
81
- }
82
-
83
- }
84
- Interpreter.register(RoutineInterpreter)
85
-
86
- export {
87
- RoutineInterpreter
88
- }
@@ -1,27 +0,0 @@
1
- import { Asset } from "../../../asset";
2
- import { RoutineDescriptor } from "../../../descriptor";
3
- import { graphics } from "../../execute"
4
-
5
- const url = Asset.createVirtualUrl('preset/graphics/invoke.routine.json')
6
- const nodes = {
7
- invoke: 'invoke'
8
- }
9
- let _currentRoutine: RoutineDescriptor | null = null
10
- const routineProvider = async () => {
11
- if (_currentRoutine === null) {
12
- _currentRoutine = new RoutineDescriptor()
13
- const invokeNode = graphics.invoke.createExecuteNode({ id: nodes.invoke })
14
- _currentRoutine.nodes.push(invokeNode)
15
- _currentRoutine.roots.push(invokeNode.id)
16
- }
17
- return _currentRoutine
18
- }
19
-
20
- Asset.provider(url, routineProvider)
21
-
22
- export {
23
- url,
24
- nodes,
25
- }
26
-
27
-
@@ -1,27 +0,0 @@
1
- import { Asset } from "../../../asset";
2
- import { RoutineDescriptor } from "../../../descriptor";
3
- import { scheduler } from "../../execute"
4
-
5
- const url = Asset.createVirtualUrl('preset/scheduler/switch.routine.json')
6
- const nodes = {
7
- switch: 'switch',
8
- }
9
- let _currentRoutine: RoutineDescriptor | null = null
10
- const routineProvider = async () => {
11
- if (_currentRoutine === null) {
12
- _currentRoutine = new RoutineDescriptor()
13
- const switchNode = scheduler.switch.createExecuteNode({ id: nodes.switch })
14
- _currentRoutine.nodes.push(switchNode)
15
- _currentRoutine.roots.push(switchNode.id)
16
- }
17
- return _currentRoutine
18
- }
19
-
20
- Asset.provider(url, routineProvider)
21
-
22
- export {
23
- url,
24
- nodes,
25
- }
26
-
27
-
File without changes