@casual-simulation/aux-vm 3.0.19-alpha.2835232321 → 3.0.20-alpha.2929508836
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 +5 -5
- package/portals/AppBackend.d.ts +5 -0
- package/portals/CustomAppHelper.d.ts +1 -0
- package/portals/CustomAppHelper.js +28 -2
- package/portals/CustomAppHelper.js.map +1 -1
- package/portals/HtmlAppBackend.d.ts +3 -0
- package/portals/HtmlAppBackend.js +33 -18
- package/portals/HtmlAppBackend.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@casual-simulation/aux-vm",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.20-alpha.2929508836",
|
|
4
4
|
"description": "A set of abstractions required to securely run an AUX.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aux"
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"url": "https://github.com/casual-simulation/casualos/issues"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@casual-simulation/aux-common": "^3.0.
|
|
43
|
-
"@casual-simulation/aux-records": "^3.0.
|
|
42
|
+
"@casual-simulation/aux-common": "^3.0.20-alpha.2929508836",
|
|
43
|
+
"@casual-simulation/aux-records": "^3.0.18",
|
|
44
44
|
"@casual-simulation/causal-trees": "^3.0.14",
|
|
45
45
|
"@casual-simulation/crypto": "^3.0.14",
|
|
46
46
|
"@casual-simulation/fast-json-stable-stringify": "^3.0.0",
|
|
47
47
|
"@casual-simulation/timesync": "^3.0.14",
|
|
48
|
-
"@casual-simulation/undom": "^3.0.
|
|
48
|
+
"@casual-simulation/undom": "^3.0.20-alpha.2929508836",
|
|
49
49
|
"esbuild": "^0.13.8",
|
|
50
50
|
"esbuild-wasm": "^0.8.43",
|
|
51
51
|
"lodash": "4.17.21",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"rxjs": "^6.5.2",
|
|
54
54
|
"uuid": "^8.3.2"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "94f03478aba4a50130483c58f4697a7617a686ba"
|
|
57
57
|
}
|
package/portals/AppBackend.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BotAction } from '@casual-simulation/aux-common';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
2
3
|
/**
|
|
3
4
|
* Defines an interface that manages the interaction between a app's runtime and how it is displayed on screen.
|
|
4
5
|
*/
|
|
@@ -11,6 +12,10 @@ export interface AppBackend {
|
|
|
11
12
|
* The ID of the bot that manages this app.
|
|
12
13
|
*/
|
|
13
14
|
botId: string;
|
|
15
|
+
/**
|
|
16
|
+
* The observable that resolves once the backend is setup.
|
|
17
|
+
*/
|
|
18
|
+
onSetup: Observable<void>;
|
|
14
19
|
/**
|
|
15
20
|
* Handles the given events.
|
|
16
21
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { asyncError, asyncResult, hasValue, } from '@casual-simulation/aux-common';
|
|
1
|
+
import { asyncError, asyncResult, hasValue, ON_DOCUMENT_AVAILABLE_ACTION_NAME, action, } from '@casual-simulation/aux-common';
|
|
2
2
|
import { HtmlAppBackend } from './HtmlAppBackend';
|
|
3
|
+
const ROOT_APP_ID = '_root';
|
|
3
4
|
/**
|
|
4
5
|
* Defines a class that manages the backend of custom portals.
|
|
5
6
|
*/
|
|
@@ -10,7 +11,6 @@ export class CustomAppHelper {
|
|
|
10
11
|
this.helper = helper;
|
|
11
12
|
}
|
|
12
13
|
handleEvents(events) {
|
|
13
|
-
// TODO: process register_custom_app events and create the corresponding backend objects.
|
|
14
14
|
for (let event of events) {
|
|
15
15
|
if (event.type === 'register_custom_app') {
|
|
16
16
|
let appId = event.appId;
|
|
@@ -42,10 +42,36 @@ export class CustomAppHelper {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
+
else if (event.type === 'custom_app_container_available') {
|
|
46
|
+
if (!this.portals.has(ROOT_APP_ID)) {
|
|
47
|
+
const appId = ROOT_APP_ID;
|
|
48
|
+
const botId = this.helper.userId;
|
|
49
|
+
const backend = new HtmlAppBackend(appId, botId, this.helper);
|
|
50
|
+
this.portals.set(appId, backend);
|
|
51
|
+
backend.onSetup.subscribe(() => {
|
|
52
|
+
globalThis.document = backend.document;
|
|
53
|
+
this.helper.transaction(action(ON_DOCUMENT_AVAILABLE_ACTION_NAME, null, this.helper.userId));
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
45
57
|
}
|
|
46
58
|
for (let portal of this.portals.values()) {
|
|
47
59
|
portal.handleEvents(events);
|
|
48
60
|
}
|
|
49
61
|
}
|
|
62
|
+
dispose() {
|
|
63
|
+
if (this.portals) {
|
|
64
|
+
const rootBackend = this.portals.get(ROOT_APP_ID);
|
|
65
|
+
if (rootBackend &&
|
|
66
|
+
rootBackend instanceof HtmlAppBackend &&
|
|
67
|
+
globalThis.document === rootBackend.document) {
|
|
68
|
+
delete globalThis.document;
|
|
69
|
+
}
|
|
70
|
+
for (let [id, backend] of this.portals) {
|
|
71
|
+
backend.dispose();
|
|
72
|
+
}
|
|
73
|
+
this.portals = null;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
50
76
|
}
|
|
51
77
|
//# sourceMappingURL=CustomAppHelper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomAppHelper.js","sourceRoot":"","sources":["CustomAppHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,EACV,WAAW,EAGX,QAAQ,
|
|
1
|
+
{"version":3,"file":"CustomAppHelper.js","sourceRoot":"","sources":["CustomAppHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,UAAU,EACV,WAAW,EAGX,QAAQ,EAER,iCAAiC,EACjC,MAAM,GACT,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAA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AC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YAClD,IACI,WAAW;gBACX,WAAW,YAAY,cAAc;gBACrC,UAAU,CAAC,QAAQ,KAAK,WAAW,CAAC,QAAQ,EAC9C;gBACE,OAAQ,UAAkB,CAAC,QAAQ,CAAC;aACvC;YACD,KAAK,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE;gBACpC,OAAO,CAAC,OAAO,EAAE,CAAC;aACrB;YACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;SACvB;IACL,CAAC;CACJ"}
|
|
@@ -26,6 +26,7 @@ export declare class HtmlAppBackend implements AppBackend {
|
|
|
26
26
|
private _mutationObserver;
|
|
27
27
|
private _nodes;
|
|
28
28
|
private _initialContent;
|
|
29
|
+
private _setupObservable;
|
|
29
30
|
/**
|
|
30
31
|
* the list of properties that should be disallowed.
|
|
31
32
|
* Taken from https://github.com/developit/preact-worker-demo/blob/master/src/renderer/worker.js
|
|
@@ -38,6 +39,8 @@ export declare class HtmlAppBackend implements AppBackend {
|
|
|
38
39
|
*/
|
|
39
40
|
private _propReferenceList;
|
|
40
41
|
private _idCounter;
|
|
42
|
+
get onSetup(): import("rxjs").Observable<void>;
|
|
43
|
+
get document(): Document;
|
|
41
44
|
constructor(appId: string, botId: string, helper: AuxHelper, registerTaskId?: string | number, instanceId?: string);
|
|
42
45
|
handleEvents(events: BotAction[]): void;
|
|
43
46
|
dispose(): void;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { action, asyncResult, hasValue, ON_APP_SETUP_ACTION_NAME, registerHtmlApp, updateHtmlApp, unregisterHtmlApp, } from '@casual-simulation/aux-common';
|
|
2
2
|
import { v4 as uuid } from 'uuid';
|
|
3
|
-
import undom, { supressMutations } from '@casual-simulation/undom';
|
|
3
|
+
import undom, { RootNode, supressMutations } from '@casual-simulation/undom';
|
|
4
4
|
import { render } from 'preact';
|
|
5
|
+
import { BehaviorSubject } from 'rxjs';
|
|
6
|
+
import { first, map } from 'rxjs/operators';
|
|
5
7
|
export const TARGET_INPUT_PROPERTIES = ['value', 'checked'];
|
|
6
8
|
/**
|
|
7
9
|
* Properties that should automatically be copied for specific tag types.
|
|
@@ -10,6 +12,7 @@ export const TARGET_INPUT_PROPERTIES = ['value', 'checked'];
|
|
|
10
12
|
export const ELEMENT_SPECIFIC_PROPERTIES = {
|
|
11
13
|
IMG: ['width', 'height', 'naturalWidth', 'naturalHeight', 'currentSrc'],
|
|
12
14
|
VIDEO: ['videoWidth', 'videoHeight', 'duration', 'currentSrc'],
|
|
15
|
+
SECTION: ['scrollTop', 'offsetHeight'],
|
|
13
16
|
};
|
|
14
17
|
/**
|
|
15
18
|
* Defines a class that is used to communicate HTML changes for a custom html portal.
|
|
@@ -46,10 +49,17 @@ export class HtmlAppBackend {
|
|
|
46
49
|
this.botId = botId;
|
|
47
50
|
this._registerTaskId = registerTaskId;
|
|
48
51
|
this._helper = helper;
|
|
52
|
+
this._setupObservable = new BehaviorSubject(false);
|
|
49
53
|
this._initTaskId = uuid();
|
|
50
54
|
this._instanceId = instanceId !== null && instanceId !== void 0 ? instanceId : uuid();
|
|
51
55
|
this._helper.transaction(registerHtmlApp(this.appId, this._instanceId, this._initTaskId));
|
|
52
56
|
}
|
|
57
|
+
get onSetup() {
|
|
58
|
+
return this._setupObservable.pipe(first((setup) => !!setup), map(() => { }));
|
|
59
|
+
}
|
|
60
|
+
get document() {
|
|
61
|
+
return this._document;
|
|
62
|
+
}
|
|
53
63
|
handleEvents(events) {
|
|
54
64
|
for (let event of events) {
|
|
55
65
|
if (event.type === 'async_result') {
|
|
@@ -135,26 +145,31 @@ export class HtmlAppBackend {
|
|
|
135
145
|
return null;
|
|
136
146
|
}
|
|
137
147
|
if (node.nodeName === 'BODY') {
|
|
138
|
-
return
|
|
148
|
+
return this._document.body;
|
|
139
149
|
}
|
|
140
150
|
return this._nodes.get(id);
|
|
141
151
|
}
|
|
142
152
|
_setupApp(result) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
153
|
+
try {
|
|
154
|
+
let doc = (this._document = undom({
|
|
155
|
+
builtinEvents: result === null || result === void 0 ? void 0 : result.builtinEvents,
|
|
156
|
+
}));
|
|
157
|
+
this._mutationObserver = new doc.defaultView.MutationObserver(this._processMutations.bind(this));
|
|
158
|
+
this._mutationObserver.observe(doc, {
|
|
159
|
+
subtree: true,
|
|
160
|
+
});
|
|
161
|
+
this._helper.transaction(action(ON_APP_SETUP_ACTION_NAME, [this.botId], undefined, {
|
|
162
|
+
document: this._document,
|
|
163
|
+
}));
|
|
164
|
+
if (this._initialContent) {
|
|
165
|
+
this._renderContent(this._initialContent);
|
|
166
|
+
}
|
|
167
|
+
if (hasValue(this._registerTaskId)) {
|
|
168
|
+
this._helper.transaction(asyncResult(this._registerTaskId, null));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
finally {
|
|
172
|
+
this._setupObservable.next(true);
|
|
158
173
|
}
|
|
159
174
|
}
|
|
160
175
|
_processMutations(mutations) {
|
|
@@ -173,7 +188,7 @@ export class HtmlAppBackend {
|
|
|
173
188
|
if (Array.isArray(obj)) {
|
|
174
189
|
return obj.map(this._makeReference, this);
|
|
175
190
|
}
|
|
176
|
-
if (obj instanceof
|
|
191
|
+
if (obj instanceof RootNode) {
|
|
177
192
|
let id = obj.__id;
|
|
178
193
|
if (!id) {
|
|
179
194
|
id = obj.__id = (this._idCounter++).toString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HtmlAppBackend.js","sourceRoot":"","sources":["HtmlAppBackend.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,MAAM,EACN,WAAW,EAIX,QAAQ,EACR,wBAAwB,EACxB,eAAe,EA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