@vived/app 2.19.0 → 2.20.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 (128) hide show
  1. package/lib/Entities/FocusCamera.js +1 -1
  2. package/lib/Entities/KeyboardInput.js +0 -2
  3. package/lib/Entities/MouseInput.js +0 -5
  4. package/lib/PresentationManagers/FocusCameraPosRotPM.d.ts +13 -0
  5. package/lib/PresentationManagers/FocusCameraPosRotPM.js +28 -0
  6. package/lib/PresentationManagers/index.d.ts +1 -0
  7. package/lib/PresentationManagers/index.js +1 -0
  8. package/package.json +1 -1
  9. package/lib/Core/BaseApp/Boundary.d.ts +0 -49
  10. package/lib/Core/BaseApp/Boundary.js +0 -2
  11. package/lib/Core/BaseApp/Entity.d.ts +0 -11
  12. package/lib/Core/BaseApp/Entity.js +0 -2
  13. package/lib/Core/BaseApp/Errors/ErrorDuplicateSystemName.d.ts +0 -3
  14. package/lib/Core/BaseApp/Errors/ErrorDuplicateSystemName.js +0 -12
  15. package/lib/Core/BaseApp/Errors/ErrorNoHostHandler.d.ts +0 -3
  16. package/lib/Core/BaseApp/Errors/ErrorNoHostHandler.js +0 -10
  17. package/lib/Core/BaseApp/Errors/ErrorUnsupportedVersionNumber.d.ts +0 -3
  18. package/lib/Core/BaseApp/Errors/ErrorUnsupportedVersionNumber.js +0 -10
  19. package/lib/Core/BaseApp/Errors/index.d.ts +0 -3
  20. package/lib/Core/BaseApp/Errors/index.js +0 -15
  21. package/lib/Core/BaseApp/UseCase.d.ts +0 -43
  22. package/lib/Core/BaseApp/UseCase.js +0 -250
  23. package/lib/Core/BaseAppState/Boundary.d.ts +0 -14
  24. package/lib/Core/BaseAppState/Boundary.js +0 -2
  25. package/lib/Core/BaseAppState/Entity.d.ts +0 -5
  26. package/lib/Core/BaseAppState/Entity.js +0 -2
  27. package/lib/Core/BaseAppState/UseCase.d.ts +0 -16
  28. package/lib/Core/BaseAppState/UseCase.js +0 -54
  29. package/lib/Core/BaseAppState/UseCase_Imp.d.ts +0 -16
  30. package/lib/Core/BaseAppState/UseCase_Imp.js +0 -54
  31. package/lib/Core/DevicePreview/DevicePreviewUC_Imp.d.ts +0 -16
  32. package/lib/Core/DevicePreview/DevicePreviewUC_Imp.js +0 -56
  33. package/lib/Core/DevicePreview/boundary.d.ts +0 -14
  34. package/lib/Core/DevicePreview/boundary.js +0 -2
  35. package/lib/Core/DevicePreview/entity.d.ts +0 -5
  36. package/lib/Core/DevicePreview/entity.js +0 -2
  37. package/lib/Core/DispatchToHost/Entity.d.ts +0 -4
  38. package/lib/Core/DispatchToHost/Entity.js +0 -2
  39. package/lib/Core/DispatchToHost/UseCase.d.ts +0 -12
  40. package/lib/Core/DispatchToHost/UseCase.js +0 -70
  41. package/lib/Core/DispatchToHost/boundary.d.ts +0 -9
  42. package/lib/Core/DispatchToHost/boundary.js +0 -2
  43. package/lib/Core/Serilization/Boundary.d.ts +0 -20
  44. package/lib/Core/Serilization/Boundary.js +0 -2
  45. package/lib/Core/Serilization/Entity.d.ts +0 -3
  46. package/lib/Core/Serilization/Entity.js +0 -2
  47. package/lib/Core/Serilization/ErrorDuplicateSystemName.d.ts +0 -3
  48. package/lib/Core/Serilization/ErrorDuplicateSystemName.js +0 -12
  49. package/lib/Core/Serilization/ErrorUnsupportedVersionNumber.d.ts +0 -3
  50. package/lib/Core/Serilization/ErrorUnsupportedVersionNumber.js +0 -10
  51. package/lib/Core/Serilization/Errors.d.ts +0 -6
  52. package/lib/Core/Serilization/Errors.js +0 -19
  53. package/lib/Core/Serilization/UseCase.d.ts +0 -10
  54. package/lib/Core/Serilization/UseCase.js +0 -52
  55. package/lib/Core/Serilization/UseCase_Imp.d.ts +0 -10
  56. package/lib/Core/Serilization/UseCase_Imp.js +0 -51
  57. package/lib/Core/index.d.ts +0 -3
  58. package/lib/Core/index.js +0 -19
  59. package/lib/Entities/Color.d.ts +0 -20
  60. package/lib/Entities/Color.js +0 -59
  61. package/lib/Entities/LineSegment2D.d.ts +0 -11
  62. package/lib/Entities/LineSegment2D.js +0 -70
  63. package/lib/Entities/MouseSceneInput.d.ts +0 -15
  64. package/lib/Entities/MouseSceneInput.js +0 -109
  65. package/lib/Entities/OrbitCamera.d.ts +0 -76
  66. package/lib/Entities/OrbitCamera.js +0 -243
  67. package/lib/Entities/ParametricLine.d.ts +0 -29
  68. package/lib/Entities/ParametricLine.js +0 -79
  69. package/lib/Entities/ParametricPlane.d.ts +0 -20
  70. package/lib/Entities/ParametricPlane.js +0 -63
  71. package/lib/Entities/Vector2.d.ts +0 -21
  72. package/lib/Entities/Vector2.js +0 -83
  73. package/lib/Entities/Vector3.d.ts +0 -19
  74. package/lib/Entities/Vector3.js +0 -75
  75. package/lib/Interface/Controllers/appHandler.d.ts +0 -12
  76. package/lib/Interface/Controllers/appHandler.js +0 -94
  77. package/lib/Interface/Controllers/defaultAppHanlderFunctions.d.ts +0 -3
  78. package/lib/Interface/Controllers/defaultAppHanlderFunctions.js +0 -31
  79. package/lib/Interface/Controllers/dispatchStateChange.d.ts +0 -2
  80. package/lib/Interface/Controllers/dispatchStateChange.js +0 -10
  81. package/lib/Interface/Controllers/index.d.ts +0 -9
  82. package/lib/Interface/Controllers/index.js +0 -21
  83. package/lib/Interface/Controllers/makeAppHandler.d.ts +0 -12
  84. package/lib/Interface/Controllers/makeAppHandler.js +0 -96
  85. package/lib/Interface/Controllers/setDevicePreview.d.ts +0 -2
  86. package/lib/Interface/Controllers/setDevicePreview.js +0 -14
  87. package/lib/Interface/Controllers/setIsAuthoring.d.ts +0 -2
  88. package/lib/Interface/Controllers/setIsAuthoring.js +0 -14
  89. package/lib/Interface/Controllers/setState.d.ts +0 -2
  90. package/lib/Interface/Controllers/setState.js +0 -21
  91. package/lib/Interface/Controllers/showBabylonInspector.d.ts +0 -2
  92. package/lib/Interface/Controllers/showBabylonInspector.js +0 -9
  93. package/lib/Interface/Controllers/startApp.d.ts +0 -1
  94. package/lib/Interface/Controllers/startApp.js +0 -9
  95. package/lib/Interface/Controllers/stopApp.d.ts +0 -2
  96. package/lib/Interface/Controllers/stopApp.js +0 -10
  97. package/lib/Interface/PresentationManagers/DevicePreviewPM.d.ts +0 -13
  98. package/lib/Interface/PresentationManagers/DevicePreviewPM.js +0 -25
  99. package/lib/Interface/PresentationManagers/IsAuthoringPM.d.ts +0 -10
  100. package/lib/Interface/PresentationManagers/IsAuthoringPM.js +0 -23
  101. package/lib/Interface/PresentationManagers/ShowBabylonInspectorPM.d.ts +0 -10
  102. package/lib/Interface/PresentationManagers/ShowBabylonInspectorPM.js +0 -23
  103. package/lib/Interface/PresentationManagers/index.d.ts +0 -3
  104. package/lib/Interface/PresentationManagers/index.js +0 -15
  105. package/lib/Interface/appHandler.d.ts +0 -12
  106. package/lib/Interface/appHandler.js +0 -94
  107. package/lib/Interface/index.d.ts +0 -2
  108. package/lib/Interface/index.js +0 -14
  109. package/lib/PresentationManagers/OrbitCameraPM.d.ts +0 -14
  110. package/lib/PresentationManagers/OrbitCameraPM.js +0 -31
  111. package/lib/UseCases/LerpOrbitCamera.d.ts +0 -36
  112. package/lib/UseCases/LerpOrbitCamera.js +0 -71
  113. package/lib/UseCases/OrbitCamera/LerpOrbitCamera.d.ts +0 -36
  114. package/lib/UseCases/OrbitCamera/LerpOrbitCamera.js +0 -71
  115. package/lib/UseCases/OrbitCamera/PixelDolly_OrbitCamera.d.ts +0 -9
  116. package/lib/UseCases/OrbitCamera/PixelDolly_OrbitCamera.js +0 -31
  117. package/lib/UseCases/OrbitCamera/PixelPlanePan_OrbitCamera.d.ts +0 -10
  118. package/lib/UseCases/OrbitCamera/PixelPlanePan_OrbitCamera.js +0 -31
  119. package/lib/UseCases/OrbitCamera/SerializeOrbitCamera.d.ts +0 -22
  120. package/lib/UseCases/OrbitCamera/SerializeOrbitCamera.js +0 -81
  121. package/lib/UseCases/OrbitCamera/index.d.ts +0 -4
  122. package/lib/UseCases/OrbitCamera/index.js +0 -16
  123. package/lib/UseCases/SerializeCamera.d.ts +0 -21
  124. package/lib/UseCases/SerializeCamera.js +0 -59
  125. package/lib/UseCases/SerializeOrbitCamera.d.ts +0 -21
  126. package/lib/UseCases/SerializeOrbitCamera.js +0 -59
  127. package/lib/UseCases/SerializedCamDemo.d.ts +0 -0
  128. package/lib/UseCases/SerializedCamDemo.js +0 -1
@@ -1,63 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ParametricPlane = void 0;
4
- const Vector3_1 = require("../ValueObjects/Vector3");
5
- class ParametricPlane {
6
- constructor(point, normal) {
7
- this.point = point;
8
- this.normal = normal;
9
- }
10
- static FromPointNormal(point, normal) {
11
- return new ParametricPlane(point, normal);
12
- }
13
- static FromThreePoints(A, B, C) {
14
- const point = A;
15
- const AB = Vector3_1.Vector3.subtract(B, A);
16
- const AC = Vector3_1.Vector3.subtract(C, A);
17
- const normal = Vector3_1.Vector3.cross(AB, AC);
18
- return new ParametricPlane(point, normal);
19
- }
20
- static XY() {
21
- const p = Vector3_1.Vector3.zero();
22
- const n = new Vector3_1.Vector3(0, 0, 1);
23
- return new ParametricPlane(p, n);
24
- }
25
- static ZX() {
26
- const p = Vector3_1.Vector3.zero();
27
- const n = new Vector3_1.Vector3(0, 1, 0);
28
- return new ParametricPlane(p, n);
29
- }
30
- static YZ() {
31
- const p = Vector3_1.Vector3.zero();
32
- const n = new Vector3_1.Vector3(1, 0, 0);
33
- return new ParametricPlane(p, n);
34
- }
35
- getParameters() {
36
- const a = this.normal.x;
37
- const b = this.normal.y;
38
- const c = this.normal.z;
39
- let d = Vector3_1.Vector3.dot(this.point, this.normal);
40
- if (d !== 0) {
41
- d *= -1;
42
- }
43
- return {
44
- a,
45
- b,
46
- c,
47
- d,
48
- };
49
- }
50
- intersectLine(line) {
51
- const { x0, y0, z0, a, b, c } = line.getParameters();
52
- const { a: A, b: B, c: C, d: D } = this.getParameters();
53
- const tNumerator = -(A * x0 + B * y0 + C * z0 + D);
54
- const tDenominator = A * a + B * b + C * c;
55
- if (tDenominator === 0) {
56
- return undefined;
57
- }
58
- const t = tNumerator / tDenominator;
59
- const intersect = line.getPointAtDistance(t);
60
- return intersect;
61
- }
62
- }
63
- exports.ParametricPlane = ParametricPlane;
@@ -1,21 +0,0 @@
1
- export declare class Vector2 {
2
- static Zero(): Vector2;
3
- static One(): Vector2;
4
- x: number;
5
- y: number;
6
- get magnitued(): number;
7
- get unit(): Vector2;
8
- get theta(): number;
9
- setLength: (length: number) => void;
10
- add: (vector2: Vector2) => Vector2;
11
- subtract: (vector2: Vector2) => Vector2;
12
- equal: (a: Vector2) => boolean;
13
- close: (vec: Vector2) => boolean;
14
- copy: () => Vector2;
15
- asArray: () => [number, number];
16
- rotate: (theta: number) => Vector2;
17
- dot: (vec: Vector2) => number;
18
- angleTo: (vec: Vector2) => number;
19
- cross: (vec: Vector2) => number;
20
- constructor(x: number, y: number);
21
- }
@@ -1,83 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Vector2 = void 0;
4
- class Vector2 {
5
- constructor(x, y) {
6
- this.setLength = (length) => {
7
- const unit = this.unit;
8
- this.x = length * unit.x;
9
- this.y = length * unit.y;
10
- };
11
- this.add = (vector2) => {
12
- return new Vector2(this.x + vector2.x, this.y + vector2.y);
13
- };
14
- this.subtract = (vector2) => {
15
- return new Vector2(this.x - vector2.x, this.y - vector2.y);
16
- };
17
- this.equal = (a) => {
18
- if (a.x === this.x && a.y === this.y)
19
- return true;
20
- else
21
- return false;
22
- };
23
- this.close = (vec) => {
24
- const diff = this.subtract(vec);
25
- const diffMag = diff.magnitued;
26
- if (diffMag < 0.01)
27
- return true;
28
- else
29
- return false;
30
- };
31
- this.copy = () => {
32
- return new Vector2(this.x, this.y);
33
- };
34
- this.asArray = () => {
35
- return [this.x, this.y];
36
- };
37
- this.rotate = (theta) => {
38
- const thetaRadians = theta * Math.PI / 180;
39
- const x = this.x * Math.cos(thetaRadians) - this.y * Math.sin(thetaRadians);
40
- const y = this.x * Math.sin(thetaRadians) + this.y * Math.cos(thetaRadians);
41
- return new Vector2(x, y);
42
- };
43
- this.dot = (vec) => {
44
- return this.x * vec.x + this.y * vec.y;
45
- };
46
- this.angleTo = (vec) => {
47
- const dot = this.dot(vec);
48
- const magnitues = vec.magnitued * this.magnitued;
49
- const angRadians = Math.acos(dot / magnitues);
50
- return angRadians * 180 / Math.PI;
51
- };
52
- this.cross = (vec) => {
53
- return (this.x * vec.y) - (this.y * vec.x);
54
- };
55
- this.x = x;
56
- this.y = y;
57
- }
58
- static Zero() {
59
- return new Vector2(0, 0);
60
- }
61
- static One() {
62
- return new Vector2(1, 1);
63
- }
64
- get magnitued() {
65
- const xSqr = this.x * this.x;
66
- const ySqr = this.y * this.y;
67
- const magnitude = Math.sqrt(xSqr + ySqr);
68
- return magnitude;
69
- }
70
- get unit() {
71
- const mag = this.magnitued;
72
- if (mag === 0) {
73
- return Vector2.Zero();
74
- }
75
- const unitX = this.x / mag;
76
- const unitY = this.y / mag;
77
- return new Vector2(unitX, unitY);
78
- }
79
- get theta() {
80
- return (Math.atan2(this.y, this.x) * 180) / Math.PI;
81
- }
82
- }
83
- exports.Vector2 = Vector2;
@@ -1,19 +0,0 @@
1
- export declare class Vector3 {
2
- static Zero(): Vector3;
3
- static One(): Vector3;
4
- x: number;
5
- y: number;
6
- z: number;
7
- get magnitued(): number;
8
- get unit(): Vector3;
9
- setLength: (length: number) => void;
10
- add: (a: Vector3) => Vector3;
11
- subtract: (vector2: Vector3) => Vector3;
12
- copy: () => Vector3;
13
- equals: (vec: Vector3) => boolean;
14
- close: (vec: Vector3) => boolean;
15
- cross: (vec: Vector3) => Vector3;
16
- dot: (vec: Vector3) => number;
17
- asArray: () => [number, number, number];
18
- constructor(x: number, y: number, z: number);
19
- }
@@ -1,75 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Vector3 = void 0;
4
- class Vector3 {
5
- constructor(x, y, z) {
6
- this.setLength = (length) => {
7
- const unit = this.unit;
8
- this.x = length * unit.x;
9
- this.y = length * unit.y;
10
- this.z = length * unit.z;
11
- };
12
- this.add = (a) => {
13
- return new Vector3(this.x + a.x, this.y + a.y, this.z + a.z);
14
- };
15
- this.subtract = (vector2) => {
16
- return new Vector3(this.x - vector2.x, this.y - vector2.y, this.z - vector2.z);
17
- };
18
- this.copy = () => {
19
- return new Vector3(this.x, this.y, this.z);
20
- };
21
- this.equals = (vec) => {
22
- if (vec.x === this.x && vec.y === this.y && vec.z === this.z)
23
- return true;
24
- else
25
- return false;
26
- };
27
- this.close = (vec) => {
28
- const diff = this.subtract(vec);
29
- const diffMag = diff.magnitued;
30
- if (diffMag < 0.01)
31
- return true;
32
- else
33
- return false;
34
- };
35
- this.cross = (vec) => {
36
- const x = this.y * vec.z - this.z * vec.y;
37
- const y = this.z * vec.x - this.x * vec.z;
38
- const z = this.x * vec.y - this.y * vec.x;
39
- return new Vector3(x, y, z);
40
- };
41
- this.dot = (vec) => {
42
- return this.x * vec.x + this.y * vec.y + this.z * vec.z;
43
- };
44
- this.asArray = () => {
45
- return [this.x, this.y, this.z];
46
- };
47
- this.x = x;
48
- this.y = y;
49
- this.z = z;
50
- }
51
- static Zero() {
52
- return new Vector3(0, 0, 0);
53
- }
54
- static One() {
55
- return new Vector3(1, 1, 1);
56
- }
57
- get magnitued() {
58
- const xSqr = this.x * this.x;
59
- const ySqr = this.y * this.y;
60
- const zSqr = this.z * this.z;
61
- const magnitude = Math.sqrt(xSqr + ySqr + zSqr);
62
- return magnitude;
63
- }
64
- get unit() {
65
- const mag = this.magnitued;
66
- if (mag === 0) {
67
- return Vector3.Zero();
68
- }
69
- const unitX = this.x / mag;
70
- const unitY = this.y / mag;
71
- const unitZ = this.z / mag;
72
- return new Vector3(unitX, unitY, unitZ);
73
- }
74
- }
75
- exports.Vector3 = Vector3;
@@ -1,12 +0,0 @@
1
- import { AppPayloadVersions, Handler } from "@vived/app-host-boundary";
2
- export declare const appPayloadVersions: AppPayloadVersions;
3
- export interface AppHandlerFunctions {
4
- showBabylonInspector: (show: boolean) => void;
5
- setIsAuthoring: (isAuthoring: boolean) => void;
6
- disposeApp: () => void;
7
- stopApp: () => void;
8
- startApp: (container: HTMLElement) => void;
9
- setState: (finalState: string, duration?: number) => void;
10
- setDevicePreview: (x: number, y: number) => void;
11
- }
12
- export declare function makeAppHandler(functions: AppHandlerFunctions): Handler;
@@ -1,94 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeAppHandler = exports.appPayloadVersions = void 0;
4
- const app_host_boundary_1 = require("@vived/app-host-boundary");
5
- const verbose = false;
6
- exports.appPayloadVersions = {
7
- disposeApp: 1,
8
- setDevicePreview: 1,
9
- setIsAuthoring: 1,
10
- showBabylonInspector: 1,
11
- startApp: 2,
12
- stopApp: 1,
13
- setState: 2,
14
- };
15
- function makeAppHandler(functions) {
16
- const handler = (request) => {
17
- switch (request.type) {
18
- case app_host_boundary_1.SHOW_BABYLON_INSPECTOR:
19
- if (request.version === exports.appPayloadVersions.showBabylonInspector) {
20
- const payload = request.payload;
21
- functions.showBabylonInspector(payload.showBabylonInspector);
22
- }
23
- else {
24
- throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
25
- }
26
- break;
27
- case app_host_boundary_1.SET_IS_AUTHORING:
28
- if (request.version === exports.appPayloadVersions.setIsAuthoring) {
29
- const payload = request.payload;
30
- functions.setIsAuthoring(payload.isAuthoring);
31
- }
32
- else {
33
- throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
34
- }
35
- break;
36
- case app_host_boundary_1.DISPOSE_APP:
37
- if (request.version === exports.appPayloadVersions.disposeApp) {
38
- functions.disposeApp();
39
- }
40
- else {
41
- throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
42
- }
43
- break;
44
- case app_host_boundary_1.STOP_APP:
45
- if (request.version === exports.appPayloadVersions.stopApp) {
46
- functions.stopApp();
47
- }
48
- else {
49
- throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
50
- }
51
- break;
52
- case app_host_boundary_1.SET_DEVICE_PREVIEW:
53
- if (request.version === exports.appPayloadVersions.setDevicePreview) {
54
- const payload = request.payload;
55
- functions.setDevicePreview(payload.x, payload.y);
56
- }
57
- else {
58
- throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
59
- }
60
- break;
61
- case app_host_boundary_1.START_APP:
62
- if (request.version === exports.appPayloadVersions.startApp) {
63
- const payload = request.payload;
64
- functions.startApp(payload.container);
65
- }
66
- else {
67
- throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
68
- }
69
- break;
70
- case app_host_boundary_1.SET_APP_STATE:
71
- if (request.version === exports.appPayloadVersions.setState) {
72
- const payload = request.payload;
73
- functions.setState(payload.finalState, payload.duration);
74
- }
75
- else {
76
- throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
77
- }
78
- break;
79
- case app_host_boundary_1.GET_APP_PAYLOAD_VERSIONS:
80
- if (request.version === 1) {
81
- const payload = request.payload;
82
- payload.callback(exports.appPayloadVersions);
83
- }
84
- else {
85
- throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
86
- }
87
- break;
88
- default:
89
- throw new app_host_boundary_1.UnsupportedRequestTypeError(request.type);
90
- }
91
- };
92
- return handler;
93
- }
94
- exports.makeAppHandler = makeAppHandler;
@@ -1,3 +0,0 @@
1
- import { BaseAppUC } from "../../Core";
2
- import { AppHandlerFunctions } from "./makeAppHandler";
3
- export declare function defaultAppHandlerFunctions(baseApp: BaseAppUC, startRendering: (container: HTMLElement) => void, stopRendering: () => void): AppHandlerFunctions;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defaultAppHandlerFunctions = void 0;
4
- const setDevicePreview_1 = require("./setDevicePreview");
5
- const setIsAuthoring_1 = require("./setIsAuthoring");
6
- const setState_1 = require("./setState");
7
- const showBabylonInspector_1 = require("./showBabylonInspector");
8
- const startApp_1 = require("./startApp");
9
- const stopApp_1 = require("./stopApp");
10
- function defaultAppHandlerFunctions(baseApp, startRendering, stopRendering) {
11
- const showBabylonInspector = showBabylonInspector_1.makeShowBabylonInspector(baseApp);
12
- const disposeApp = () => {
13
- // Todo, override this in your app if you have something to dispose.
14
- };
15
- const setDevicePreview = setDevicePreview_1.makeSetDevicePreview(baseApp);
16
- const setIsAuthoring = setIsAuthoring_1.makeSetIsAuthoring(baseApp);
17
- const startApp = startApp_1.makeStartApp(startRendering);
18
- const stopApp = stopApp_1.makeStopApp(baseApp, stopRendering);
19
- const setState = setState_1.makeSetState(baseApp);
20
- const appHandlerFunctions = {
21
- showBabylonInspector,
22
- disposeApp,
23
- setDevicePreview,
24
- setIsAuthoring,
25
- startApp,
26
- stopApp,
27
- setState,
28
- };
29
- return appHandlerFunctions;
30
- }
31
- exports.defaultAppHandlerFunctions = defaultAppHandlerFunctions;
@@ -1,2 +0,0 @@
1
- import { BaseAppUC } from "../../Core";
2
- export declare function makeDispatchStateChange(baseApp: BaseAppUC): () => void;
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeDispatchStateChange = void 0;
4
- function makeDispatchStateChange(baseApp) {
5
- return function dispatchStateChange() {
6
- const state = baseApp.getSerializedState();
7
- baseApp.dispatchOnStateChange(state);
8
- };
9
- }
10
- exports.makeDispatchStateChange = makeDispatchStateChange;
@@ -1,9 +0,0 @@
1
- export * from "./dispatchStateChange";
2
- export * from "./setDevicePreview";
3
- export * from "./setIsAuthoring";
4
- export * from "./showBabylonInspector";
5
- export * from "./startApp";
6
- export * from "./stopApp";
7
- export * from "./makeAppHandler";
8
- export * from "./defaultAppHanlderFunctions";
9
- export * from "./setState";
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- __exportStar(require("./dispatchStateChange"), exports);
14
- __exportStar(require("./setDevicePreview"), exports);
15
- __exportStar(require("./setIsAuthoring"), exports);
16
- __exportStar(require("./showBabylonInspector"), exports);
17
- __exportStar(require("./startApp"), exports);
18
- __exportStar(require("./stopApp"), exports);
19
- __exportStar(require("./makeAppHandler"), exports);
20
- __exportStar(require("./defaultAppHanlderFunctions"), exports);
21
- __exportStar(require("./setState"), exports);
@@ -1,12 +0,0 @@
1
- import { AppPayloadVersions, Handler } from "@vived/app-host-boundary";
2
- export declare const appPayloadVersions: AppPayloadVersions;
3
- export interface AppHandlerFunctions {
4
- showBabylonInspector: (show: boolean) => void;
5
- setIsAuthoring: (isAuthoring: boolean) => void;
6
- disposeApp: () => void;
7
- stopApp: () => void;
8
- startApp: (container: HTMLElement) => void;
9
- setState: (finalState: string, duration?: number) => void;
10
- setDevicePreview: (x: number, y: number) => void;
11
- }
12
- export declare function makeAppHandler(functions: AppHandlerFunctions, verbose?: boolean): Handler;
@@ -1,96 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeAppHandler = exports.appPayloadVersions = void 0;
4
- const app_host_boundary_1 = require("@vived/app-host-boundary");
5
- exports.appPayloadVersions = {
6
- disposeApp: 1,
7
- setDevicePreview: 1,
8
- setIsAuthoring: 1,
9
- showBabylonInspector: 1,
10
- startApp: 2,
11
- stopApp: 1,
12
- setState: 2,
13
- };
14
- function makeAppHandler(functions, verbose = false) {
15
- const handler = (request) => {
16
- if (verbose) {
17
- console.log(request);
18
- }
19
- switch (request.type) {
20
- case 'SHOW_BABYLON_INSPECTOR':
21
- if (request.version === exports.appPayloadVersions.showBabylonInspector) {
22
- const payload = request.payload;
23
- functions.showBabylonInspector(payload.showBabylonInspector);
24
- }
25
- else {
26
- throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
27
- }
28
- break;
29
- case 'SET_IS_AUTHORING':
30
- if (request.version === exports.appPayloadVersions.setIsAuthoring) {
31
- const payload = request.payload;
32
- functions.setIsAuthoring(payload.isAuthoring);
33
- }
34
- else {
35
- throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
36
- }
37
- break;
38
- case 'DISPOSE_APP':
39
- if (request.version === exports.appPayloadVersions.disposeApp) {
40
- functions.disposeApp();
41
- }
42
- else {
43
- throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
44
- }
45
- break;
46
- case 'STOP_APP':
47
- if (request.version === exports.appPayloadVersions.stopApp) {
48
- functions.stopApp();
49
- }
50
- else {
51
- throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
52
- }
53
- break;
54
- case 'SET_DEVICE_PREVIEW':
55
- if (request.version === exports.appPayloadVersions.setDevicePreview) {
56
- const payload = request.payload;
57
- functions.setDevicePreview(payload.x, payload.y);
58
- }
59
- else {
60
- throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
61
- }
62
- break;
63
- case 'START_APP':
64
- if (request.version === exports.appPayloadVersions.startApp) {
65
- const payload = request.payload;
66
- functions.startApp(payload.container);
67
- }
68
- else {
69
- throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
70
- }
71
- break;
72
- case 'SET_APP_STATE':
73
- if (request.version === exports.appPayloadVersions.setState) {
74
- const payload = request.payload;
75
- functions.setState(payload.finalState, payload.duration);
76
- }
77
- else {
78
- throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
79
- }
80
- break;
81
- case 'GET_APP_PAYLOAD_VERSION':
82
- if (request.version === 1) {
83
- const payload = request.payload;
84
- payload.callback(exports.appPayloadVersions);
85
- }
86
- else {
87
- throw new app_host_boundary_1.UnsupportedRequestVerion(request.type, request.version);
88
- }
89
- break;
90
- default:
91
- throw new app_host_boundary_1.UnsupportedRequestTypeError(request.type);
92
- }
93
- };
94
- return handler;
95
- }
96
- exports.makeAppHandler = makeAppHandler;
@@ -1,2 +0,0 @@
1
- import { BaseAppUC } from "../../Core";
2
- export declare function makeSetDevicePreview(devicePreviewUC: BaseAppUC): (x: number, y: number) => void;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeSetDevicePreview = void 0;
4
- function makeSetDevicePreview(devicePreviewUC) {
5
- return function setDevicePreview(x, y) {
6
- if (x < 0 || y < 0) {
7
- devicePreviewUC.clearDevicePreview();
8
- }
9
- else {
10
- devicePreviewUC.setDevicePreview(x, y);
11
- }
12
- };
13
- }
14
- exports.makeSetDevicePreview = makeSetDevicePreview;
@@ -1,2 +0,0 @@
1
- import { BaseAppUC } from "../../Core";
2
- export declare function makeSetIsAuthoring(appStateUC: BaseAppUC): (isAuthoring: boolean) => void;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeSetIsAuthoring = void 0;
4
- const dispatchStateChange_1 = require("./dispatchStateChange");
5
- function makeSetIsAuthoring(appStateUC) {
6
- const dispatchStateChange = dispatchStateChange_1.makeDispatchStateChange(appStateUC);
7
- return function setIsAuthoring(isAuthoring) {
8
- appStateUC.setIsAuthoring(isAuthoring);
9
- if (isAuthoring) {
10
- dispatchStateChange();
11
- }
12
- };
13
- }
14
- exports.makeSetIsAuthoring = makeSetIsAuthoring;
@@ -1,2 +0,0 @@
1
- import { BaseAppUC } from "../../Core";
2
- export declare function makeSetState(baseApp: BaseAppUC): (state: string | null, duration?: number) => void;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeSetState = void 0;
4
- function makeSetState(baseApp) {
5
- return function setState(state, duration = 0) {
6
- if (state) {
7
- try {
8
- const stateObj = JSON.parse(state);
9
- baseApp.setSerializedState(stateObj, duration);
10
- }
11
- catch (e) {
12
- baseApp.setDefaultState(duration);
13
- console.warn("[setState] Failed to deserialize state string: " + e);
14
- }
15
- }
16
- else {
17
- baseApp.setDefaultState(duration);
18
- }
19
- };
20
- }
21
- exports.makeSetState = makeSetState;
@@ -1,2 +0,0 @@
1
- import { BaseAppUC } from "../../Core";
2
- export declare function makeShowBabylonInspector(appStateUC: BaseAppUC): (showInspector: boolean) => void;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeShowBabylonInspector = void 0;
4
- function makeShowBabylonInspector(appStateUC) {
5
- return function showBabylonInspector(showInspector) {
6
- appStateUC.setShowBabylonInspector(showInspector);
7
- };
8
- }
9
- exports.makeShowBabylonInspector = makeShowBabylonInspector;
@@ -1 +0,0 @@
1
- export declare function makeStartApp(startRendering: (container: HTMLElement) => void): (container: HTMLElement) => void;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeStartApp = void 0;
4
- function makeStartApp(startRendering) {
5
- return function startApp(container) {
6
- startRendering(container);
7
- };
8
- }
9
- exports.makeStartApp = makeStartApp;
@@ -1,2 +0,0 @@
1
- import { BaseAppUC } from "../../Core";
2
- export declare function makeStopApp(appStateUC: BaseAppUC, stopRendering: () => void): () => void;