@vyr/remote 0.0.1

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 (42) hide show
  1. package/package.json +18 -0
  2. package/src/Bridge.ts +133 -0
  3. package/src/ChangeScriptable.ts +22 -0
  4. package/src/Collection.ts +36 -0
  5. package/src/RemoteExecutor.ts +514 -0
  6. package/src/RemoteInvoker.ts +72 -0
  7. package/src/RemoteProcess.ts +87 -0
  8. package/src/index.ts +7 -0
  9. package/src/job/IJob.ts +6 -0
  10. package/src/job/Job.ts +16 -0
  11. package/src/job/asset/add.ts +23 -0
  12. package/src/job/asset/dragdrap.ts +24 -0
  13. package/src/job/asset/index.ts +6 -0
  14. package/src/job/asset/load.ts +20 -0
  15. package/src/job/asset/remove.ts +20 -0
  16. package/src/job/asset/unload.ts +18 -0
  17. package/src/job/asset/update.ts +22 -0
  18. package/src/job/bridge/connection.ts +18 -0
  19. package/src/job/bridge/disconnect.ts +29 -0
  20. package/src/job/bridge/index.ts +2 -0
  21. package/src/job/index.ts +1 -0
  22. package/src/job/invoke/alert.ts +20 -0
  23. package/src/job/invoke/animation.ts +45 -0
  24. package/src/job/invoke/event.ts +40 -0
  25. package/src/job/invoke/index.ts +8 -0
  26. package/src/job/invoke/orbit.ts +20 -0
  27. package/src/job/invoke/pick.ts +15 -0
  28. package/src/job/invoke/properties.ts +43 -0
  29. package/src/job/invoke/screenshot.ts +35 -0
  30. package/src/job/invoke/transform.ts +36 -0
  31. package/src/job/scene/add.ts +22 -0
  32. package/src/job/scene/dragdrap.ts +23 -0
  33. package/src/job/scene/index.ts +6 -0
  34. package/src/job/scene/load.ts +19 -0
  35. package/src/job/scene/remove.ts +19 -0
  36. package/src/job/scene/unload.ts +17 -0
  37. package/src/job/scene/update.ts +20 -0
  38. package/src/locale/Language.ts +10 -0
  39. package/src/locale/LanguageProvider.ts +15 -0
  40. package/src/locale/index.ts +2 -0
  41. package/src/utils/index.ts +85 -0
  42. package/src/utils/screenshot.ts +20 -0
package/src/job/Job.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { IJob } from './IJob'
2
+ import * as bridge from './bridge'
3
+ import * as invoke from './invoke'
4
+ import * as asset from './asset'
5
+ import * as scene from './scene'
6
+
7
+ class Job extends IJob {
8
+ static readonly bridge = bridge
9
+ static readonly invoke = invoke
10
+ static readonly asset = asset
11
+ static readonly scene = scene
12
+ readonly method: string = 'remote.default'
13
+ readonly params = {}
14
+ }
15
+
16
+ export { Job }
@@ -0,0 +1,23 @@
1
+ import { Descriptor, DeserializationObject } from "@vyr/engine";
2
+ import { IJob } from "../IJob";
3
+
4
+ interface Params {
5
+ url: string
6
+ parent: string
7
+ node: DeserializationObject<Descriptor>[]
8
+ next?: string
9
+ }
10
+
11
+ const Method = 'remote.asset.add'
12
+
13
+ class Task extends IJob {
14
+ readonly method = Method
15
+ readonly params
16
+
17
+ constructor(params: Params) {
18
+ super()
19
+ this.params = params
20
+ }
21
+ }
22
+
23
+ export { Method, Task }
@@ -0,0 +1,24 @@
1
+ import { DraggableData, DraggableEndType } from "@vyr/declare";
2
+ import { IJob } from "../IJob";
3
+
4
+ interface Params {
5
+ url: string
6
+ type: DraggableEndType,
7
+ dragData: DraggableData<{ uuids: string[] }>,
8
+ targetData: DraggableData<{ uuid: string }>,
9
+ next?: string
10
+ }
11
+
12
+ const Method = 'remote.asset.dragdrap'
13
+
14
+ class Task extends IJob {
15
+ readonly method = Method
16
+ readonly params
17
+
18
+ constructor(params: Params) {
19
+ super()
20
+ this.params = params
21
+ }
22
+ }
23
+
24
+ export { Method, Task }
@@ -0,0 +1,6 @@
1
+ export * as load from './load'
2
+ export * as unload from './unload'
3
+ export * as add from './add'
4
+ export * as remove from './remove'
5
+ export * as update from './update'
6
+ export * as dragdrap from './dragdrap'
@@ -0,0 +1,20 @@
1
+ import { IJob } from "../IJob";
2
+
3
+ interface Params {
4
+ url: string
5
+ }
6
+
7
+ const Method = 'remote.asset.load'
8
+
9
+ class Task extends IJob {
10
+ readonly method = Method
11
+ readonly params
12
+
13
+ constructor(params: Params) {
14
+ super()
15
+ this.params = params
16
+ }
17
+ }
18
+
19
+
20
+ export { Method, Task }
@@ -0,0 +1,20 @@
1
+ import { IJob } from "../IJob";
2
+
3
+ interface Params {
4
+ url: string
5
+ uuids: string[]
6
+ }
7
+
8
+ const Method = 'remote.asset.remove'
9
+
10
+ class Task extends IJob {
11
+ readonly method = Method
12
+ readonly params
13
+
14
+ constructor(params: Params) {
15
+ super()
16
+ this.params = params
17
+ }
18
+ }
19
+
20
+ export { Method, Task }
@@ -0,0 +1,18 @@
1
+ import { IJob } from "../IJob";
2
+
3
+ interface Params { }
4
+
5
+ const Method = 'remote.asset.unload'
6
+
7
+ class Task extends IJob {
8
+ readonly method = Method
9
+ readonly params
10
+
11
+ constructor(params: Params) {
12
+ super()
13
+ this.params = params
14
+ }
15
+ }
16
+
17
+
18
+ export { Method, Task }
@@ -0,0 +1,22 @@
1
+ import { Descriptor, DeserializationObject } from "@vyr/engine"
2
+ import { IJob } from "../IJob"
3
+
4
+ interface Params {
5
+ url: string
6
+ scheme: string
7
+ content: DeserializationObject<Descriptor>
8
+ }
9
+
10
+ const Method = 'remote.asset.update'
11
+
12
+ class Task extends IJob {
13
+ readonly method = Method
14
+ readonly params
15
+
16
+ constructor(params: Params) {
17
+ super()
18
+ this.params = params
19
+ }
20
+ }
21
+
22
+ export { Method, Task }
@@ -0,0 +1,18 @@
1
+ import { IJob } from "../IJob";
2
+
3
+ const Method = 'remote.bridge.connection'
4
+
5
+ interface ResponseParams {
6
+ stop?: true
7
+ }
8
+ class Response extends IJob {
9
+ readonly method = Method
10
+ readonly params
11
+
12
+ constructor(params: ResponseParams) {
13
+ super()
14
+ this.params = params
15
+ }
16
+ }
17
+
18
+ export { Method, Response }
@@ -0,0 +1,29 @@
1
+ import { IJob } from "../IJob";
2
+
3
+ const Method = 'remote.bridge.disconnect'
4
+
5
+ interface TranformParams {
6
+ }
7
+ class Task extends IJob {
8
+ readonly method = Method
9
+ readonly params
10
+
11
+ constructor(params: TranformParams) {
12
+ super()
13
+ this.params = params
14
+ }
15
+ }
16
+
17
+ interface ResponseParams {
18
+ }
19
+ class Response extends IJob {
20
+ readonly method = Method
21
+ readonly params
22
+
23
+ constructor(params: ResponseParams) {
24
+ super()
25
+ this.params = params
26
+ }
27
+ }
28
+
29
+ export { Method, Task, Response}
@@ -0,0 +1,2 @@
1
+ export * as connection from './connection'
2
+ export * as disconnect from './disconnect'
@@ -0,0 +1 @@
1
+ export * from './Job'
@@ -0,0 +1,20 @@
1
+ import { IJob } from "../IJob";
2
+
3
+ const Method = 'remote.invoke.alert'
4
+
5
+ type ResponseParams = {
6
+ type: string
7
+ data: any
8
+ }
9
+
10
+ class Response extends IJob {
11
+ readonly method = Method
12
+ readonly params
13
+
14
+ constructor(params: ResponseParams) {
15
+ super()
16
+ this.params = params
17
+ }
18
+ }
19
+
20
+ export { Method, Response }
@@ -0,0 +1,45 @@
1
+ import { IJob } from "../IJob";
2
+
3
+ interface Params {
4
+ enabled: boolean
5
+ currentTime: number
6
+ }
7
+
8
+ const Method = 'remote.invoke.animation'
9
+
10
+ class Task extends IJob {
11
+ readonly method = Method
12
+ readonly params
13
+ reset = false
14
+
15
+ constructor(params: Params) {
16
+ super()
17
+ this.params = params
18
+ }
19
+ }
20
+
21
+ interface UnitParams {
22
+ type: 'unit'
23
+ delta: number
24
+ max?: number
25
+ }
26
+
27
+ interface ActionParams {
28
+ type: 'action'
29
+ uuid: string
30
+ animations: string[]
31
+ }
32
+
33
+ type ResponseParams = UnitParams | ActionParams
34
+
35
+ class Response extends IJob {
36
+ readonly method = Method
37
+ readonly params: ResponseParams
38
+
39
+ constructor(params: ResponseParams) {
40
+ super()
41
+ this.params = params
42
+ }
43
+ }
44
+
45
+ export { Method, Task, Response }
@@ -0,0 +1,40 @@
1
+ import { IJob } from "../IJob";
2
+
3
+ const Method = 'remote.invoke.event'
4
+
5
+ interface MouseParams {
6
+ type: 'mouse',
7
+ properties: {
8
+ type: string
9
+ bubbles: boolean
10
+ cancelable: boolean
11
+ altKey: boolean
12
+ ctrlKey: boolean
13
+ shiftKey: boolean
14
+ clientX: number
15
+ clientY: number
16
+ }
17
+ }
18
+
19
+ interface KeyboardParams {
20
+ type: 'keyboard',
21
+ properties: {
22
+ type: string
23
+ altKey: boolean
24
+ ctrlKey: boolean
25
+ shiftKey: boolean
26
+ code: string
27
+ }
28
+ }
29
+
30
+ class Response extends IJob {
31
+ readonly method = Method
32
+ readonly params
33
+
34
+ constructor(params: MouseParams | KeyboardParams) {
35
+ super()
36
+ this.params = params
37
+ }
38
+ }
39
+
40
+ export { Method, Response }
@@ -0,0 +1,8 @@
1
+ export * as properties from './properties'
2
+ export * as animation from './animation'
3
+ export * as transform from './transform'
4
+ export * as orbit from './orbit'
5
+ export * as pick from './pick'
6
+ export * as screenshot from './screenshot'
7
+ export * as event from './event'
8
+ export * as alert from './alert'
@@ -0,0 +1,20 @@
1
+ import { IJob } from "../IJob";
2
+
3
+ interface OrbitParams {
4
+ enablePan: boolean
5
+ screenSpacePanning: boolean
6
+ }
7
+
8
+ const Method = 'remote.invoke.orbit'
9
+
10
+ class Task extends IJob {
11
+ readonly method = Method
12
+ readonly params
13
+
14
+ constructor(params: OrbitParams) {
15
+ super()
16
+ this.params = params
17
+ }
18
+ }
19
+
20
+ export { Method, Task }
@@ -0,0 +1,15 @@
1
+ import { IJob } from "../IJob";
2
+
3
+ const Method = 'remote.invoke.pick'
4
+
5
+ class Response extends IJob {
6
+ readonly method = Method
7
+ readonly params
8
+
9
+ constructor(params: { descriptor: string }) {
10
+ super()
11
+ this.params = params
12
+ }
13
+ }
14
+
15
+ export { Method, Response }
@@ -0,0 +1,43 @@
1
+ import { DeserializationObject } from "@vyr/engine";
2
+ import { IJob } from "../IJob";
3
+
4
+ type PropertiesType = 'get' | 'getCurrentCamera' | 'setCurrentCamera'
5
+
6
+ interface Properties {
7
+ [k: string]: any
8
+ }
9
+
10
+ interface Params {
11
+ type: PropertiesType
12
+ uuid: string
13
+ }
14
+
15
+ const Method = 'remote.invoke.properties'
16
+
17
+ class Task extends IJob {
18
+ readonly method = Method
19
+ readonly params
20
+ reset = false
21
+
22
+ constructor(params: Params) {
23
+ super()
24
+ this.params = params
25
+ }
26
+ }
27
+
28
+ interface ResponseParams<T extends Properties = Properties> {
29
+ type: PropertiesType
30
+ properties: DeserializationObject<T>
31
+ }
32
+
33
+ class Response<T extends Properties = Properties> extends IJob {
34
+ readonly method = Method
35
+ readonly params: ResponseParams<T>
36
+
37
+ constructor(params: ResponseParams<T>) {
38
+ super()
39
+ this.params = params
40
+ }
41
+ }
42
+
43
+ export { Method, Task, Response }
@@ -0,0 +1,35 @@
1
+ import { IJob } from "../IJob";
2
+
3
+ interface Params {
4
+ target: string
5
+ }
6
+
7
+ const Method = 'remote.invoke.screenshot'
8
+
9
+ class Task extends IJob {
10
+ readonly method = Method
11
+ readonly params
12
+ reset = false
13
+
14
+ constructor(params: Params) {
15
+ super()
16
+ this.params = params
17
+ }
18
+ }
19
+
20
+ interface ResponseParams {
21
+ target: string
22
+ base64: string
23
+ }
24
+
25
+ class Response extends IJob {
26
+ readonly method = Method
27
+ readonly params: ResponseParams
28
+
29
+ constructor(params: ResponseParams) {
30
+ super()
31
+ this.params = params
32
+ }
33
+ }
34
+
35
+ export { Method, Task, Response }
@@ -0,0 +1,36 @@
1
+ import { Descriptor } from "@vyr/engine";
2
+ import { IJob } from "../IJob";
3
+
4
+ const Method = 'remote.invoke.transform'
5
+
6
+ interface TranformParams {
7
+ mode: 'translate' | 'rotate' | 'scale' | string
8
+ target: string
9
+ }
10
+
11
+ class Task extends IJob {
12
+ readonly method = Method
13
+ readonly params
14
+
15
+ constructor(params: TranformParams) {
16
+ super()
17
+ this.params = params
18
+ }
19
+ }
20
+
21
+ interface ResponseParams {
22
+ target: string
23
+ eventType: string
24
+ descriptor: Descriptor
25
+ }
26
+ class Response extends IJob {
27
+ readonly method = Method
28
+ readonly params
29
+
30
+ constructor(params: ResponseParams) {
31
+ super()
32
+ this.params = params
33
+ }
34
+ }
35
+
36
+ export { Method, Task, Response }
@@ -0,0 +1,22 @@
1
+ import { Descriptor, DeserializationObject } from "@vyr/engine";
2
+ import { IJob } from "../IJob";
3
+
4
+ interface Params {
5
+ parent: string
6
+ node: DeserializationObject<Descriptor>[]
7
+ next: string
8
+ }
9
+
10
+ const Method = 'remote.scene.add'
11
+
12
+ class Task extends IJob {
13
+ readonly method = Method
14
+ readonly params
15
+
16
+ constructor(params: Params) {
17
+ super()
18
+ this.params = params
19
+ }
20
+ }
21
+
22
+ export { Method, Task }
@@ -0,0 +1,23 @@
1
+ import { DraggableData, DraggableEndType } from "@vyr/declare";
2
+ import { IJob } from "../IJob";
3
+
4
+ interface Params {
5
+ type: DraggableEndType,
6
+ dragData: DraggableData<{ uuids: string[] }>,
7
+ targetData: DraggableData<{ uuid: string }>,
8
+ next?: string
9
+ }
10
+
11
+ const Method = 'remote.scene.dragdrap'
12
+
13
+ class Task extends IJob {
14
+ readonly method = Method
15
+ readonly params
16
+
17
+ constructor(params: Params) {
18
+ super()
19
+ this.params = params
20
+ }
21
+ }
22
+
23
+ export { Method, Task }
@@ -0,0 +1,6 @@
1
+ export * as load from './load'
2
+ export * as unload from './unload'
3
+ export * as add from './add'
4
+ export * as remove from './remove'
5
+ export * as update from './update'
6
+ export * as dragdrap from './dragdrap'
@@ -0,0 +1,19 @@
1
+ import { IJob } from "../IJob";
2
+
3
+ interface Params {
4
+ url: string
5
+ }
6
+
7
+ const Method = 'remote.scene.load'
8
+
9
+ class Task extends IJob {
10
+ readonly method = Method
11
+ readonly params
12
+
13
+ constructor(params: Params) {
14
+ super()
15
+ this.params = params
16
+ }
17
+ }
18
+
19
+ export { Method, Task}
@@ -0,0 +1,19 @@
1
+ import { IJob } from "../IJob";
2
+
3
+ interface Params {
4
+ uuids: string[]
5
+ }
6
+
7
+ const Method = 'remote.scene.remove'
8
+
9
+ class Task extends IJob {
10
+ readonly method = Method
11
+ readonly params
12
+
13
+ constructor(params: Params) {
14
+ super()
15
+ this.params = params
16
+ }
17
+ }
18
+
19
+ export { Method, Task }
@@ -0,0 +1,17 @@
1
+ import { IJob } from "../IJob";
2
+
3
+ interface Params { }
4
+
5
+ const Method = 'remote.scene.unload'
6
+
7
+ class Task extends IJob {
8
+ readonly method = Method
9
+ readonly params
10
+
11
+ constructor(params: Params) {
12
+ super()
13
+ this.params = params
14
+ }
15
+ }
16
+
17
+ export { Method, Task }
@@ -0,0 +1,20 @@
1
+ import { Descriptor, DeserializationObject } from "@vyr/engine";
2
+ import { IJob } from "../IJob";
3
+
4
+ interface Params {
5
+ content: DeserializationObject<Descriptor>
6
+ }
7
+
8
+ const Method = 'remote.scene.update'
9
+
10
+ class Task extends IJob {
11
+ readonly method = Method
12
+ readonly params
13
+
14
+ constructor(params: Params) {
15
+ super()
16
+ this.params = params
17
+ }
18
+ }
19
+
20
+ export { Method, Task }
@@ -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/remote',
10
+ }
11
+
12
+ export {
13
+ ZhCNLanguageProvider,
14
+ zhCnLanguageProvider,
15
+ }
@@ -0,0 +1,2 @@
1
+ export * from './LanguageProvider'
2
+ export * from './Language'