@dodona/papyros 3.0.2 → 4.0.0-beta-9
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/README.md +132 -72
- package/dist/Library.d.ts +10 -11
- package/dist/Library.js +9 -7
- package/dist/Library.js.map +1 -1
- package/dist/{Backend.d.ts → backend/Backend.d.ts} +3 -12
- package/dist/{Backend.js → backend/Backend.js} +4 -17
- package/dist/backend/Backend.js.map +1 -0
- package/dist/{workers → backend/workers}/javascript/JavaScriptWorker.js +1 -1
- package/dist/backend/workers/javascript/JavaScriptWorker.js.map +1 -0
- package/dist/backend/workers/javascript/worker.js.map +1 -0
- package/dist/{workers → backend/workers}/python/PythonWorker.d.ts +2 -2
- package/dist/{workers → backend/workers}/python/PythonWorker.js +2 -2
- package/dist/backend/workers/python/PythonWorker.js.map +1 -0
- package/dist/backend/workers/python/python_package.tar.gz.load_by_url +0 -0
- package/dist/backend/workers/python/worker.js.map +1 -0
- package/dist/communication/BackendEvent.js.map +1 -0
- package/dist/{BackendEventQueue.d.ts → communication/BackendEventQueue.d.ts} +1 -36
- package/dist/{BackendEventQueue.js → communication/BackendEventQueue.js} +2 -45
- package/dist/communication/BackendEventQueue.js.map +1 -0
- package/dist/{BackendManager.d.ts → communication/BackendManager.d.ts} +2 -2
- package/dist/{BackendManager.js → communication/BackendManager.js} +4 -4
- package/dist/communication/BackendManager.js.map +1 -0
- package/dist/communication/InputServiceWorker.js +37 -0
- package/dist/communication/InputServiceWorker.js.map +1 -0
- package/dist/communication/InputWorker.js.map +1 -0
- package/dist/frontend/components/CodeRunner.d.ts +9 -0
- package/dist/frontend/components/CodeRunner.js +60 -0
- package/dist/frontend/components/CodeRunner.js.map +1 -0
- package/dist/frontend/components/Debugger.d.ts +7 -0
- package/dist/frontend/components/Debugger.js +61 -0
- package/dist/frontend/components/Debugger.js.map +1 -0
- package/dist/frontend/components/Input.d.ts +13 -0
- package/dist/frontend/components/Input.js +65 -0
- package/dist/frontend/components/Input.js.map +1 -0
- package/dist/frontend/components/Output.d.ts +14 -0
- package/dist/frontend/components/Output.js +154 -0
- package/dist/frontend/components/Output.js.map +1 -0
- package/dist/frontend/components/PapyrosElement.d.ts +8 -0
- package/dist/frontend/components/PapyrosElement.js +24 -0
- package/dist/frontend/components/PapyrosElement.js.map +1 -0
- package/dist/frontend/components/app/App.d.ts +24 -0
- package/dist/frontend/components/app/App.js +204 -0
- package/dist/frontend/components/app/App.js.map +1 -0
- package/dist/frontend/components/app/ExamplePicker.d.ts +7 -0
- package/dist/frontend/components/app/ExamplePicker.js +35 -0
- package/dist/frontend/components/app/ExamplePicker.js.map +1 -0
- package/dist/frontend/components/app/LanguagePicker.d.ts +7 -0
- package/dist/frontend/components/app/LanguagePicker.js +35 -0
- package/dist/frontend/components/app/LanguagePicker.js.map +1 -0
- package/dist/frontend/components/app/ProgrammingLanguagePicker.d.ts +7 -0
- package/dist/frontend/components/app/ProgrammingLanguagePicker.js +39 -0
- package/dist/frontend/components/app/ProgrammingLanguagePicker.js.map +1 -0
- package/dist/frontend/components/app/examples/JavaScriptExamples.js.map +1 -0
- package/dist/frontend/components/app/examples/PythonExamples.js.map +1 -0
- package/dist/frontend/components/app/themes/ThemePicker.d.ts +11 -0
- package/dist/frontend/components/app/themes/ThemePicker.js +47 -0
- package/dist/frontend/components/app/themes/ThemePicker.js.map +1 -0
- package/dist/frontend/components/app/themes/ThemedButton.d.ts +9 -0
- package/dist/frontend/components/app/themes/ThemedButton.js +43 -0
- package/dist/frontend/components/app/themes/ThemedButton.js.map +1 -0
- package/dist/frontend/components/code_mirror/BatchInputEditor.d.ts +8 -0
- package/dist/frontend/components/code_mirror/BatchInputEditor.js +54 -0
- package/dist/frontend/components/code_mirror/BatchInputEditor.js.map +1 -0
- package/dist/frontend/components/code_mirror/CodeEditor.d.ts +24 -0
- package/dist/frontend/components/code_mirror/CodeEditor.js +205 -0
- package/dist/frontend/components/code_mirror/CodeEditor.js.map +1 -0
- package/dist/frontend/components/code_mirror/CodeMirrorEditor.d.ts +20 -0
- package/dist/frontend/components/code_mirror/CodeMirrorEditor.js +99 -0
- package/dist/frontend/components/code_mirror/CodeMirrorEditor.js.map +1 -0
- package/dist/frontend/components/code_mirror/Extensions.d.ts +15 -0
- package/dist/frontend/components/code_mirror/Extensions.js +169 -0
- package/dist/frontend/components/code_mirror/Extensions.js.map +1 -0
- package/dist/frontend/components/code_mirror/MaterialTheme.d.ts +5 -0
- package/dist/frontend/components/code_mirror/MaterialTheme.js +109 -0
- package/dist/frontend/components/code_mirror/MaterialTheme.js.map +1 -0
- package/dist/frontend/components/code_runner/ButtonLint.d.ts +9 -0
- package/dist/frontend/components/code_runner/ButtonLint.js +76 -0
- package/dist/frontend/components/code_runner/ButtonLint.js.map +1 -0
- package/dist/frontend/components/code_runner/Code.d.ts +7 -0
- package/dist/frontend/components/code_runner/Code.js +46 -0
- package/dist/frontend/components/code_runner/Code.js.map +1 -0
- package/dist/frontend/components/code_runner/RunState.d.ts +7 -0
- package/dist/frontend/components/code_runner/RunState.js +41 -0
- package/dist/frontend/components/code_runner/RunState.js.map +1 -0
- package/dist/frontend/components/input/BatchInput.d.ts +9 -0
- package/dist/frontend/components/input/BatchInput.js +53 -0
- package/dist/frontend/components/input/BatchInput.js.map +1 -0
- package/dist/frontend/components/input/InteractiveInput.d.ts +13 -0
- package/dist/frontend/components/input/InteractiveInput.js +73 -0
- package/dist/frontend/components/input/InteractiveInput.js.map +1 -0
- package/dist/frontend/state/Constants.d.ts +38 -0
- package/dist/frontend/state/Constants.js +108 -0
- package/dist/frontend/state/Constants.js.map +1 -0
- package/dist/frontend/state/Debugger.d.ts +23 -0
- package/dist/frontend/state/Debugger.js +84 -0
- package/dist/frontend/state/Debugger.js.map +1 -0
- package/dist/frontend/state/Examples.d.ts +11 -0
- package/dist/frontend/state/Examples.js +36 -0
- package/dist/frontend/state/Examples.js.map +1 -0
- package/dist/frontend/state/I18n.d.ts +16 -0
- package/dist/frontend/state/I18n.js +75 -0
- package/dist/frontend/state/I18n.js.map +1 -0
- package/dist/frontend/state/InputOutput.d.ts +64 -0
- package/dist/frontend/state/InputOutput.js +133 -0
- package/dist/frontend/state/InputOutput.js.map +1 -0
- package/dist/frontend/state/Papyros.d.ts +32 -0
- package/dist/frontend/state/Papyros.js +93 -0
- package/dist/frontend/state/Papyros.js.map +1 -0
- package/dist/frontend/state/Runner.d.ts +118 -0
- package/dist/frontend/state/Runner.js +334 -0
- package/dist/frontend/state/Runner.js.map +1 -0
- package/dist/frontend/state/Test.d.ts +11 -0
- package/dist/frontend/state/Test.js +59 -0
- package/dist/frontend/state/Test.js.map +1 -0
- package/dist/frontend/state/Translations.d.ts +178 -0
- package/dist/frontend/state/Translations.js +188 -0
- package/dist/frontend/state/Translations.js.map +1 -0
- package/dist/frontend/state/themes/blue-dark.d.ts +2 -0
- package/dist/frontend/state/themes/blue-dark.js +55 -0
- package/dist/frontend/state/themes/blue-dark.js.map +1 -0
- package/dist/frontend/state/themes/blue-light.d.ts +2 -0
- package/dist/frontend/state/themes/blue-light.js +55 -0
- package/dist/frontend/state/themes/blue-light.js.map +1 -0
- package/dist/frontend/state/themes/green-dark.d.ts +2 -0
- package/dist/frontend/state/themes/green-dark.js +55 -0
- package/dist/frontend/state/themes/green-dark.js.map +1 -0
- package/dist/frontend/state/themes/green-light.d.ts +2 -0
- package/dist/frontend/state/themes/green-light.js +55 -0
- package/dist/frontend/state/themes/green-light.js.map +1 -0
- package/dist/frontend/state/themes/red-dark.d.ts +2 -0
- package/dist/frontend/state/themes/red-dark.js +55 -0
- package/dist/frontend/state/themes/red-dark.js.map +1 -0
- package/dist/frontend/state/themes/red-light.d.ts +2 -0
- package/dist/frontend/state/themes/red-light.js +55 -0
- package/dist/frontend/state/themes/red-light.js.map +1 -0
- package/dist/util/Util.d.ts +0 -43
- package/dist/util/Util.js +0 -91
- package/dist/util/Util.js.map +1 -1
- package/package.json +13 -21
- package/dist/App.d.ts +0 -1
- package/dist/App.js +0 -76
- package/dist/App.js.map +0 -1
- package/dist/Backend.js.map +0 -1
- package/dist/BackendEvent.js.map +0 -1
- package/dist/BackendEventQueue.js.map +0 -1
- package/dist/BackendManager.js.map +0 -1
- package/dist/CodeRunner.d.ts +0 -188
- package/dist/CodeRunner.js +0 -548
- package/dist/CodeRunner.js.map +0 -1
- package/dist/Constants.d.ts +0 -31
- package/dist/Constants.js +0 -36
- package/dist/Constants.js.map +0 -1
- package/dist/Debugger.d.ts +0 -18
- package/dist/Debugger.js +0 -86
- package/dist/Debugger.js.map +0 -1
- package/dist/InputManager.d.ts +0 -38
- package/dist/InputManager.js +0 -101
- package/dist/InputManager.js.map +0 -1
- package/dist/InputServiceWorker.js.map +0 -1
- package/dist/OutputManager.d.ts +0 -90
- package/dist/OutputManager.js +0 -172
- package/dist/OutputManager.js.map +0 -1
- package/dist/Papyros.css +0 -657
- package/dist/Papyros.d.ts +0 -141
- package/dist/Papyros.js +0 -268
- package/dist/Papyros.js.map +0 -1
- package/dist/Translations.d.ts +0 -180
- package/dist/Translations.js +0 -191
- package/dist/Translations.js.map +0 -1
- package/dist/editor/BatchInputEditor.d.ts +0 -41
- package/dist/editor/BatchInputEditor.js +0 -80
- package/dist/editor/BatchInputEditor.js.map +0 -1
- package/dist/editor/CodeEditor.d.ts +0 -81
- package/dist/editor/CodeEditor.js +0 -213
- package/dist/editor/CodeEditor.js.map +0 -1
- package/dist/editor/CodeMirrorEditor.d.ts +0 -133
- package/dist/editor/CodeMirrorEditor.js +0 -169
- package/dist/editor/CodeMirrorEditor.js.map +0 -1
- package/dist/editor/DarkTheme.d.ts +0 -1
- package/dist/editor/DarkTheme.js +0 -72
- package/dist/editor/DarkTheme.js.map +0 -1
- package/dist/editor/DebugExtension.d.ts +0 -11
- package/dist/editor/DebugExtension.js +0 -70
- package/dist/editor/DebugExtension.js.map +0 -1
- package/dist/editor/Gutters.d.ts +0 -109
- package/dist/editor/Gutters.js +0 -201
- package/dist/editor/Gutters.js.map +0 -1
- package/dist/editor/LineEffectExtension.d.ts +0 -13
- package/dist/editor/LineEffectExtension.js +0 -48
- package/dist/editor/LineEffectExtension.js.map +0 -1
- package/dist/editor/TestCodeExtension.d.ts +0 -21
- package/dist/editor/TestCodeExtension.js +0 -134
- package/dist/editor/TestCodeExtension.js.map +0 -1
- package/dist/examples/Examples.d.ts +0 -6
- package/dist/examples/Examples.js +0 -23
- package/dist/examples/Examples.js.map +0 -1
- package/dist/examples/JavaScriptExamples.js.map +0 -1
- package/dist/examples/PythonExamples.js.map +0 -1
- package/dist/input/BatchInputHandler.d.ts +0 -55
- package/dist/input/BatchInputHandler.js +0 -131
- package/dist/input/BatchInputHandler.js.map +0 -1
- package/dist/input/InteractiveInputHandler.d.ts +0 -27
- package/dist/input/InteractiveInputHandler.js +0 -89
- package/dist/input/InteractiveInputHandler.js.map +0 -1
- package/dist/input/UserInputHandler.d.ts +0 -68
- package/dist/input/UserInputHandler.js +0 -39
- package/dist/input/UserInputHandler.js.map +0 -1
- package/dist/util/HTMLShapes.d.ts +0 -15
- package/dist/util/HTMLShapes.js +0 -25
- package/dist/util/HTMLShapes.js.map +0 -1
- package/dist/util/Rendering.d.ts +0 -120
- package/dist/util/Rendering.js +0 -142
- package/dist/util/Rendering.js.map +0 -1
- package/dist/workers/input/InputWorker.js.map +0 -1
- package/dist/workers/javascript/JavaScriptWorker.js.map +0 -1
- package/dist/workers/javascript/worker.js.map +0 -1
- package/dist/workers/python/PythonWorker.js.map +0 -1
- package/dist/workers/python/python_package.tar.gz.load_by_url +0 -0
- package/dist/workers/python/worker.js.map +0 -1
- /package/dist/{workers → backend/workers}/javascript/JavaScriptWorker.d.ts +0 -0
- /package/dist/{workers → backend/workers}/javascript/worker.d.ts +0 -0
- /package/dist/{workers → backend/workers}/javascript/worker.js +0 -0
- /package/dist/{workers → backend/workers}/python/worker.d.ts +0 -0
- /package/dist/{workers → backend/workers}/python/worker.js +0 -0
- /package/dist/{BackendEvent.d.ts → communication/BackendEvent.d.ts} +0 -0
- /package/dist/{BackendEvent.js → communication/BackendEvent.js} +0 -0
- /package/dist/{InputServiceWorker.d.ts → communication/InputServiceWorker.d.ts} +0 -0
- /package/dist/{workers/input → communication}/InputWorker.d.ts +0 -0
- /package/dist/{workers/input → communication}/InputWorker.js +0 -0
- /package/dist/{examples → frontend/components/app/examples}/JavaScriptExamples.d.ts +0 -0
- /package/dist/{examples → frontend/components/app/examples}/JavaScriptExamples.js +0 -0
- /package/dist/{examples → frontend/components/app/examples}/PythonExamples.d.ts +0 -0
- /package/dist/{examples → frontend/components/app/examples}/PythonExamples.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Debugger.js","sourceRoot":"","sources":["../../../src/frontend/state/Debugger.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAQzD,MAAM,OAAO,QAAS,SAAQ,KAAK;IAW/B,IAAW,MAAM,CAAC,MAAe;QAC7B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QAEtB,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IAGD,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,YAAY,OAAgB;QACxB,KAAK,EAAE,CAAC;QApBJ,gBAAW,GAAiB,EAAE,CAAC;QAEhC,gBAAW,GAAuB,SAAS,CAAC;QAE5C,UAAK,GAAY,EAAE,CAAC;QAEnB,YAAO,GAAY,KAAK,CAAC;QAe7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,EAAE,CAAC;QAEb,cAAc,CAAC,SAAS,CAAC,gBAAgB,CAAC,KAAK,EAAE,GAAG,EAAE;YAClD,IAAI,CAAC,KAAK,EAAE,CAAC;QACjB,C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,SAAS;;QACT,OAAO,MAAA,IAAI,CAAC,gBAAgB,0CAAE,IAAI,CAAC;IACvC,CAAC;IAED,IAAI,YAAY;;QACZ,OAAO,MAAA,IAAI,CAAC,gBAAgB,0CAAE,OAAO,CAAA;IACzC,CAAC;IAED,IAAI,eAAe;;QACf,OAAO,MAAA,IAAI,CAAC,gBAAgB,0CAAE,MAAM,CAAA;IACxC,CAAC;CACJ;AArEW;IADP,aAAa;6CACyB;AAEhC;IADN,aAAa;6CACqC;AAE5C;IADN,aAAa;uCACa;AAEnB;IADP,aAAa;yCACmB;AASjC;IADC,aAAa;sCAGb"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { State } from "@dodona/lit-state";
|
|
2
|
+
import { ProgrammingLanguage } from "../../ProgrammingLanguage";
|
|
3
|
+
import { Papyros } from "./Papyros";
|
|
4
|
+
export declare class Examples extends State {
|
|
5
|
+
papyros: Papyros;
|
|
6
|
+
private examples;
|
|
7
|
+
constructor(papyros: Papyros);
|
|
8
|
+
setExamples(language: ProgrammingLanguage, examples: Record<string, string>): void;
|
|
9
|
+
get names(): Array<string>;
|
|
10
|
+
getExampleCode(name: string): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { State, StateMap, stateProperty } from "@dodona/lit-state";
|
|
8
|
+
import { ProgrammingLanguage } from "../../ProgrammingLanguage";
|
|
9
|
+
import { JAVASCRIPT_EXAMPLES } from "../components/app/examples/JavaScriptExamples";
|
|
10
|
+
import { PYTHON_EXAMPLES } from "../components/app/examples/PythonExamples";
|
|
11
|
+
export class Examples extends State {
|
|
12
|
+
constructor(papyros) {
|
|
13
|
+
super();
|
|
14
|
+
this.examples = new StateMap();
|
|
15
|
+
this.papyros = papyros;
|
|
16
|
+
this.setExamples(ProgrammingLanguage.JavaScript, JAVASCRIPT_EXAMPLES);
|
|
17
|
+
this.setExamples(ProgrammingLanguage.Python, PYTHON_EXAMPLES);
|
|
18
|
+
}
|
|
19
|
+
setExamples(language, examples) {
|
|
20
|
+
this.examples.set(language, examples);
|
|
21
|
+
}
|
|
22
|
+
get names() {
|
|
23
|
+
var _a;
|
|
24
|
+
const language = this.papyros.runner.programmingLanguage;
|
|
25
|
+
return Object.keys((_a = this.examples.get(language)) !== null && _a !== void 0 ? _a : {});
|
|
26
|
+
}
|
|
27
|
+
getExampleCode(name) {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
const language = this.papyros.runner.programmingLanguage;
|
|
30
|
+
return (_b = (_a = this.examples.get(language)) === null || _a === void 0 ? void 0 : _a[name]) !== null && _b !== void 0 ? _b : "";
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
__decorate([
|
|
34
|
+
stateProperty
|
|
35
|
+
], Examples.prototype, "examples", void 0);
|
|
36
|
+
//# sourceMappingURL=Examples.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Examples.js","sourceRoot":"","sources":["../../../src/frontend/state/Examples.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAE5E,MAAM,OAAO,QAAS,SAAQ,KAAK;IAK/B,YAAY,OAAgB;QACxB,KAAK,EAAE,CAAC;QAHJ,aAAQ,GAAG,IAAI,QAAQ,EAA+C,CAAC;QAI3E,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC;QACtE,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAClE,CAAC;IAEM,WAAW,CAAC,QAA6B,EAAE,QAAgC;QAC9E,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED,IAAW,KAAK;;QACZ,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC;QACzD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,mCAAI,EAAE,CAAC,CAAC;IAC1D,CAAC;IAEM,cAAc,CAAC,IAAY;;QAC9B,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC;QACzD,OAAO,MAAA,MAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,0CAAG,IAAI,CAAC,mCAAI,EAAE,CAAC;IACrD,CAAC;CACJ;AAtBW;IADP,aAAa;0CACiE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { State } from "@dodona/lit-state";
|
|
2
|
+
export type Translations = {
|
|
3
|
+
[key: string]: string | Translations;
|
|
4
|
+
};
|
|
5
|
+
export declare class I18n extends State {
|
|
6
|
+
private readonly polyglot;
|
|
7
|
+
private readonly translations;
|
|
8
|
+
private _locale;
|
|
9
|
+
get availableLocales(): string[];
|
|
10
|
+
setTranslations(locale: string, translations: Translations): void;
|
|
11
|
+
set locale(locale: string);
|
|
12
|
+
get locale(): string;
|
|
13
|
+
t(phrase: string, options?: Record<string, any>): string;
|
|
14
|
+
getTranslations(key?: string): Translations | undefined;
|
|
15
|
+
constructor();
|
|
16
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { State, StateMap, stateProperty } from "@dodona/lit-state";
|
|
8
|
+
import Polyglot from "node-polyglot";
|
|
9
|
+
import { DUTCH_TRANSLATION, ENGLISH_TRANSLATION } from "./Translations";
|
|
10
|
+
export class I18n extends State {
|
|
11
|
+
get availableLocales() {
|
|
12
|
+
return [...this.translations.keys()];
|
|
13
|
+
}
|
|
14
|
+
setTranslations(locale, translations) {
|
|
15
|
+
this.translations.set(locale, translations);
|
|
16
|
+
if (this.locale === locale) {
|
|
17
|
+
this.dispatchStateEvent("t");
|
|
18
|
+
this.polyglot.replace(this.translations.get(locale));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
set locale(locale) {
|
|
22
|
+
if (this.translations.has(locale)) {
|
|
23
|
+
this.dispatchStateEvent("t");
|
|
24
|
+
this._locale = locale;
|
|
25
|
+
this.polyglot.locale(locale);
|
|
26
|
+
this.polyglot.replace(this.translations.get(locale));
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
throw new Error(`Locale ${locale} not loaded`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
get locale() {
|
|
33
|
+
return this._locale;
|
|
34
|
+
}
|
|
35
|
+
t(phrase, options) {
|
|
36
|
+
this.recordRead("t");
|
|
37
|
+
return this.polyglot.t(phrase, options);
|
|
38
|
+
}
|
|
39
|
+
getTranslations(key) {
|
|
40
|
+
if (!this.translations.has(this.locale)) {
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
if (!key) {
|
|
44
|
+
return this.translations.get(this.locale);
|
|
45
|
+
}
|
|
46
|
+
const keys = key.split(".");
|
|
47
|
+
let record = this.translations.get(this.locale);
|
|
48
|
+
for (const k of keys) {
|
|
49
|
+
if (typeof record === "string" || !(k in record)) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
record = record[k];
|
|
53
|
+
}
|
|
54
|
+
if (typeof record === "string") {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
return record;
|
|
58
|
+
}
|
|
59
|
+
constructor() {
|
|
60
|
+
super();
|
|
61
|
+
this.polyglot = new Polyglot();
|
|
62
|
+
this.translations = new StateMap();
|
|
63
|
+
this._locale = "en";
|
|
64
|
+
this.polyglot.locale(this.locale);
|
|
65
|
+
this.setTranslations("en", ENGLISH_TRANSLATION);
|
|
66
|
+
this.setTranslations("nl", DUTCH_TRANSLATION);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
__decorate([
|
|
70
|
+
stateProperty
|
|
71
|
+
], I18n.prototype, "_locale", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
stateProperty
|
|
74
|
+
], I18n.prototype, "locale", null);
|
|
75
|
+
//# sourceMappingURL=I18n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"I18n.js","sourceRoot":"","sources":["../../../src/frontend/state/I18n.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,QAAQ,MAAM,eAAe,CAAC;AAC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;IADC,aAAa;kCAGb"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { State } from "@dodona/lit-state";
|
|
2
|
+
import { Papyros } from "./Papyros";
|
|
3
|
+
/**
|
|
4
|
+
* Shape of Error objects that are easy to interpret
|
|
5
|
+
*/
|
|
6
|
+
export interface FriendlyError {
|
|
7
|
+
/**
|
|
8
|
+
* The name of the Error
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
/**
|
|
12
|
+
* Traceback for where in the code the Error occurred
|
|
13
|
+
*/
|
|
14
|
+
traceback?: string;
|
|
15
|
+
/**
|
|
16
|
+
* General information about this type of Error
|
|
17
|
+
*/
|
|
18
|
+
info?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Information about what went wrong in this case
|
|
21
|
+
*/
|
|
22
|
+
what?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Information about why this is wrong and how to fix it
|
|
25
|
+
*/
|
|
26
|
+
why?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Where specifically in the source code the Error occurred
|
|
29
|
+
*/
|
|
30
|
+
where?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare enum OutputType {
|
|
33
|
+
stdout = "stdout",
|
|
34
|
+
stderr = "stderr",
|
|
35
|
+
img = "img"
|
|
36
|
+
}
|
|
37
|
+
export type OutputEntry = {
|
|
38
|
+
type: OutputType;
|
|
39
|
+
content: string | FriendlyError;
|
|
40
|
+
contentType?: string;
|
|
41
|
+
};
|
|
42
|
+
export declare enum InputMode {
|
|
43
|
+
batch = "batch",
|
|
44
|
+
interactive = "interactive"
|
|
45
|
+
}
|
|
46
|
+
export declare class InputOutput extends State {
|
|
47
|
+
private papyros;
|
|
48
|
+
inputs: string[];
|
|
49
|
+
output: OutputEntry[];
|
|
50
|
+
prompt: string;
|
|
51
|
+
awaitingInput: boolean;
|
|
52
|
+
inputMode: InputMode;
|
|
53
|
+
private _inputBuffer;
|
|
54
|
+
get inputBuffer(): string;
|
|
55
|
+
set inputBuffer(value: string);
|
|
56
|
+
private get nextBufferedLine();
|
|
57
|
+
constructor(papyros: Papyros);
|
|
58
|
+
logError(error: FriendlyError | string): void;
|
|
59
|
+
logImage(imageData: string, contentType?: string): void;
|
|
60
|
+
logOutput(output: string): void;
|
|
61
|
+
provideInput(input: string): void;
|
|
62
|
+
clearInputs(): void;
|
|
63
|
+
reset(): void;
|
|
64
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { State, stateProperty } from "@dodona/lit-state";
|
|
8
|
+
import { BackendManager } from "../../communication/BackendManager";
|
|
9
|
+
import { BackendEventType } from "../../communication/BackendEvent";
|
|
10
|
+
import { parseData } from "../../util/Util";
|
|
11
|
+
import { RunState } from "./Runner";
|
|
12
|
+
export var OutputType;
|
|
13
|
+
(function (OutputType) {
|
|
14
|
+
OutputType["stdout"] = "stdout";
|
|
15
|
+
OutputType["stderr"] = "stderr";
|
|
16
|
+
OutputType["img"] = "img";
|
|
17
|
+
})(OutputType || (OutputType = {}));
|
|
18
|
+
export var InputMode;
|
|
19
|
+
(function (InputMode) {
|
|
20
|
+
InputMode["batch"] = "batch";
|
|
21
|
+
InputMode["interactive"] = "interactive";
|
|
22
|
+
})(InputMode || (InputMode = {}));
|
|
23
|
+
export class InputOutput extends State {
|
|
24
|
+
get inputBuffer() {
|
|
25
|
+
return this._inputBuffer;
|
|
26
|
+
}
|
|
27
|
+
set inputBuffer(value) {
|
|
28
|
+
this._inputBuffer = value;
|
|
29
|
+
if (this.nextBufferedLine !== undefined && this.inputMode === InputMode.batch && this.awaitingInput) {
|
|
30
|
+
this.provideInput(this.nextBufferedLine);
|
|
31
|
+
}
|
|
32
|
+
if (!this.papyros.debugger.active && this.papyros.runner.state === RunState.Ready) {
|
|
33
|
+
this.clearInputs();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
get nextBufferedLine() {
|
|
37
|
+
const bufferedLines = this.inputBuffer.split("\n").slice(0, -1);
|
|
38
|
+
if (bufferedLines.length > this.inputs.length) {
|
|
39
|
+
return bufferedLines[this.inputs.length];
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
constructor(papyros) {
|
|
44
|
+
super();
|
|
45
|
+
this.inputs = [];
|
|
46
|
+
this.output = [];
|
|
47
|
+
this.prompt = "";
|
|
48
|
+
this.awaitingInput = false;
|
|
49
|
+
this.inputMode = InputMode.interactive;
|
|
50
|
+
this._inputBuffer = "";
|
|
51
|
+
this.papyros = papyros;
|
|
52
|
+
this.reset();
|
|
53
|
+
BackendManager.subscribe(BackendEventType.Start, () => this.reset());
|
|
54
|
+
BackendManager.subscribe(BackendEventType.Output, e => {
|
|
55
|
+
const data = parseData(e.data, e.contentType);
|
|
56
|
+
if (e.contentType && e.contentType.startsWith("img")) {
|
|
57
|
+
this.logImage(data, e.contentType);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
this.logOutput(data);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
BackendManager.subscribe(BackendEventType.Error, e => {
|
|
64
|
+
const data = parseData(e.data, e.contentType);
|
|
65
|
+
this.logError(data);
|
|
66
|
+
});
|
|
67
|
+
BackendManager.subscribe(BackendEventType.Input, e => {
|
|
68
|
+
if (this.nextBufferedLine !== undefined && this.inputMode === InputMode.batch) {
|
|
69
|
+
this.provideInput(this.nextBufferedLine);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
this.prompt = e.data || "";
|
|
73
|
+
this.awaitingInput = true;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
logError(error) {
|
|
77
|
+
this.output = [...this.output, { type: OutputType.stderr, content: error }];
|
|
78
|
+
}
|
|
79
|
+
logImage(imageData, contentType = "img/png") {
|
|
80
|
+
this.output = [...this.output, { type: OutputType.img, content: imageData, contentType }];
|
|
81
|
+
}
|
|
82
|
+
logOutput(output) {
|
|
83
|
+
// lines have been merged to limit the number of events
|
|
84
|
+
// we split them again here, to simplify overflow detection
|
|
85
|
+
const lines = output.split("\n");
|
|
86
|
+
if (lines.length > 1) {
|
|
87
|
+
this.output = [...this.output,
|
|
88
|
+
...lines.slice(0, -1).map(line => ({ type: OutputType.stdout, content: line + "\n" })),
|
|
89
|
+
{ type: OutputType.stdout, content: lines[lines.length - 1] }
|
|
90
|
+
];
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
this.output = [...this.output, { type: OutputType.stdout, content: output }];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
provideInput(input) {
|
|
97
|
+
this.inputs = [...this.inputs, input];
|
|
98
|
+
this.papyros.runner.provideInput(input);
|
|
99
|
+
this.prompt = "";
|
|
100
|
+
this.awaitingInput = false;
|
|
101
|
+
}
|
|
102
|
+
clearInputs() {
|
|
103
|
+
this.inputs = [];
|
|
104
|
+
}
|
|
105
|
+
reset() {
|
|
106
|
+
this.inputs = [];
|
|
107
|
+
this.output = [];
|
|
108
|
+
this.prompt = "";
|
|
109
|
+
this.awaitingInput = false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
__decorate([
|
|
113
|
+
stateProperty
|
|
114
|
+
], InputOutput.prototype, "inputs", void 0);
|
|
115
|
+
__decorate([
|
|
116
|
+
stateProperty
|
|
117
|
+
], InputOutput.prototype, "output", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
stateProperty
|
|
120
|
+
], InputOutput.prototype, "prompt", void 0);
|
|
121
|
+
__decorate([
|
|
122
|
+
stateProperty
|
|
123
|
+
], InputOutput.prototype, "awaitingInput", void 0);
|
|
124
|
+
__decorate([
|
|
125
|
+
stateProperty
|
|
126
|
+
], InputOutput.prototype, "inputMode", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
stateProperty
|
|
129
|
+
], InputOutput.prototype, "_inputBuffer", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
stateProperty
|
|
132
|
+
], InputOutput.prototype, "inputBuffer", null);
|
|
133
|
+
//# sourceMappingURL=InputOutput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputOutput.js","sourceRoot":"","sources":["../../../src/frontend/state/InputOutput.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAgCpC,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IAClB,+BAAiB,CAAA;IACjB,+BAAiB,CAAA;IACjB,yBAAW,CAAA;AACf,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AAQD,MAAM,CAAN,IAAY,SAGX;AAHD,WAAY,SAAS;IACjB,4BAAe,CAAA;IACf,wCAA2B,CAAA;AAC/B,CAAC,EAHW,SAAS,KAAT,SAAS,QAGpB;AAED,MAAM,OAAO,WAAY,SAAQ,KAAK;IAgBlC,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IACD,IAAI,WAAW,CAAC,KAAa;QACzB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,IAAG,IAAI,CAAC,gBAA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,WAAW;QACd,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACrB,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC/B,CAAC;CACJ;AApGO;IADH,aAAa;2CACY;AAEtB;IADH,aAAa;2CACiB;AAE3B;IADH,aAAa;2CACU;AAEpB;IADH,aAAa;kDACqB;AAE/B;IADH,aAAa;8CACmC;AAGzC;IADP,aAAa;iDACoB;AAElC;IADC,aAAa;8CAGb"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { State } from "@dodona/lit-state";
|
|
2
|
+
import { Debugger } from "./Debugger";
|
|
3
|
+
import { Runner } from "./Runner";
|
|
4
|
+
import { InputOutput } from "./InputOutput";
|
|
5
|
+
import { Constants } from "./Constants";
|
|
6
|
+
import { Examples } from "./Examples";
|
|
7
|
+
import { I18n } from "./I18n";
|
|
8
|
+
import { Test } from "./Test";
|
|
9
|
+
export declare class Papyros extends State {
|
|
10
|
+
readonly debugger: Debugger;
|
|
11
|
+
readonly runner: Runner;
|
|
12
|
+
readonly io: InputOutput;
|
|
13
|
+
readonly constants: Constants;
|
|
14
|
+
readonly examples: Examples;
|
|
15
|
+
readonly i18n: I18n;
|
|
16
|
+
readonly test: Test;
|
|
17
|
+
serviceWorkerName: string;
|
|
18
|
+
/**
|
|
19
|
+
* Launch this instance of Papyros, making it ready to run code
|
|
20
|
+
* @return {Promise<Papyros>} Promise of launching, chainable
|
|
21
|
+
*/
|
|
22
|
+
launch(): Promise<Papyros>;
|
|
23
|
+
/**
|
|
24
|
+
* Configure how user input is handled within Papyros
|
|
25
|
+
* By default, we will try to use SharedArrayBuffers
|
|
26
|
+
* If this option is not available, the optional arguments in the channelOptions config are used
|
|
27
|
+
* They are needed to register a service worker to handle communication between threads
|
|
28
|
+
* @return {Promise<boolean>} Promise of configuring input
|
|
29
|
+
*/
|
|
30
|
+
private configureInput;
|
|
31
|
+
}
|
|
32
|
+
export declare const papyros: Papyros;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
import { State, stateProperty } from "@dodona/lit-state";
|
|
17
|
+
import { Debugger } from "./Debugger";
|
|
18
|
+
import { Runner } from "./Runner";
|
|
19
|
+
import { InputOutput } from "./InputOutput";
|
|
20
|
+
import { Constants } from "./Constants";
|
|
21
|
+
import { Examples } from "./Examples";
|
|
22
|
+
import { BackendManager } from "../../communication/BackendManager";
|
|
23
|
+
import { makeChannel } from "sync-message";
|
|
24
|
+
import { I18n } from "./I18n";
|
|
25
|
+
import { Test } from "./Test";
|
|
26
|
+
export class Papyros extends State {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
this.debugger = new Debugger(this);
|
|
30
|
+
this.runner = new Runner(this);
|
|
31
|
+
this.io = new InputOutput(this);
|
|
32
|
+
this.constants = new Constants();
|
|
33
|
+
this.examples = new Examples(this);
|
|
34
|
+
this.i18n = new I18n();
|
|
35
|
+
this.test = new Test(this);
|
|
36
|
+
this.serviceWorkerName = "InputServiceWorker.js";
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Launch this instance of Papyros, making it ready to run code
|
|
40
|
+
* @return {Promise<Papyros>} Promise of launching, chainable
|
|
41
|
+
*/
|
|
42
|
+
launch() {
|
|
43
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
if (!(yield this.configureInput())) {
|
|
45
|
+
alert(this.i18n.t("Papyros.service_worker_error"));
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
try {
|
|
49
|
+
yield this.runner.launch();
|
|
50
|
+
}
|
|
51
|
+
catch (_a) {
|
|
52
|
+
if (confirm(this.i18n.t("Papyros.launch_error"))) {
|
|
53
|
+
return this.launch();
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return this;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Configure how user input is handled within Papyros
|
|
62
|
+
* By default, we will try to use SharedArrayBuffers
|
|
63
|
+
* If this option is not available, the optional arguments in the channelOptions config are used
|
|
64
|
+
* They are needed to register a service worker to handle communication between threads
|
|
65
|
+
* @return {Promise<boolean>} Promise of configuring input
|
|
66
|
+
*/
|
|
67
|
+
configureInput() {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
if (typeof SharedArrayBuffer === "undefined") {
|
|
70
|
+
if (!this.serviceWorkerName || !("serviceWorker" in navigator)) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
yield navigator.serviceWorker.register(this.serviceWorkerName, { scope: "/" });
|
|
75
|
+
BackendManager.channel = makeChannel({ serviceWorker: { scope: "/" } });
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
console.error("Error registering service worker:", e);
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
BackendManager.channel = makeChannel({ atomics: {} });
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
__decorate([
|
|
90
|
+
stateProperty
|
|
91
|
+
], Papyros.prototype, "serviceWorkerName", void 0);
|
|
92
|
+
export const papyros = new Papyros();
|
|
93
|
+
//# sourceMappingURL=Papyros.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Papyros.js","sourceRoot":"","sources":["../../../src/frontend/state/Papyros.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,OAAO,OAAQ,SAAQ,KAAK;IAAlC;;QACa,aAAQ,GAAa,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;Q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oBAC/E,cAAc,CAAC,OAAO,GAAG,WAAW,CAAC,EAAE,aAAa,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAE,CAAC;gBAC7E,CAAC;gBAAC,OAAM,CAAC,EAAE,CAAC;oBACR,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,CAAC,CAAC,CAAC;oBACtD,OAAO,KAAK,CAAC;gBACjB,CAAC;YACL,CAAC;iBAAM,CAAC;gBACJ,cAAc,CAAC,OAAO,GAAG,WAAW,CAAC,EAAE,OAAO,EAAE,EAAI,EAAE,CAAE,CAAC;YAC7D,CAAC;YACD,OAAO,IAAI,CAAC;QAChB,CAAC;KAAA;CACJ;AA7CO;IADH,aAAa;kDAC0C;AA+C5D,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { SyncClient } from "comsync";
|
|
2
|
+
import { Backend, RunMode, WorkerDiagnostic } from "../../backend/Backend";
|
|
3
|
+
import { State } from "@dodona/lit-state";
|
|
4
|
+
import { Papyros } from "./Papyros";
|
|
5
|
+
import { ProgrammingLanguage } from "../../ProgrammingLanguage";
|
|
6
|
+
/**
|
|
7
|
+
* Enum representing the possible states while processing code
|
|
8
|
+
*/
|
|
9
|
+
export declare enum RunState {
|
|
10
|
+
Loading = "loading",
|
|
11
|
+
Running = "running",
|
|
12
|
+
AwaitingInput = "awaiting_input",
|
|
13
|
+
Stopping = "stopping",
|
|
14
|
+
Ready = "ready"
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Interface to represent information required when handling loading events
|
|
18
|
+
*/
|
|
19
|
+
export interface LoadingData {
|
|
20
|
+
/**
|
|
21
|
+
* List of module names that are being loaded
|
|
22
|
+
*/
|
|
23
|
+
modules: Array<string>;
|
|
24
|
+
/**
|
|
25
|
+
* The status of the import
|
|
26
|
+
*/
|
|
27
|
+
status: "loading" | "loaded" | "failed";
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Helper component to manage and visualize the current RunState
|
|
31
|
+
*/
|
|
32
|
+
export declare class Runner extends State {
|
|
33
|
+
/**
|
|
34
|
+
* The currently used programming language
|
|
35
|
+
*/
|
|
36
|
+
private _programmingLanguage;
|
|
37
|
+
get programmingLanguage(): ProgrammingLanguage;
|
|
38
|
+
set programmingLanguage(value: ProgrammingLanguage);
|
|
39
|
+
/**
|
|
40
|
+
* The backend that executes the code asynchronously
|
|
41
|
+
*/
|
|
42
|
+
backend: Promise<SyncClient<Backend>>;
|
|
43
|
+
/**
|
|
44
|
+
* Current state of the program
|
|
45
|
+
*/
|
|
46
|
+
state: RunState;
|
|
47
|
+
/**
|
|
48
|
+
* An explanatory message about the current state
|
|
49
|
+
*/
|
|
50
|
+
stateMessage: string;
|
|
51
|
+
/**
|
|
52
|
+
* Previous state to restore when loading is done
|
|
53
|
+
*/
|
|
54
|
+
private previousState;
|
|
55
|
+
/**
|
|
56
|
+
* Array of packages that are being installed
|
|
57
|
+
*/
|
|
58
|
+
loadingPackages: Array<string>;
|
|
59
|
+
/**
|
|
60
|
+
* Time at which the setState call occurred
|
|
61
|
+
*/
|
|
62
|
+
runStartTime: number;
|
|
63
|
+
/**
|
|
64
|
+
* The code we are working with
|
|
65
|
+
*/
|
|
66
|
+
_code: string;
|
|
67
|
+
get code(): string;
|
|
68
|
+
set code(value: string);
|
|
69
|
+
/**
|
|
70
|
+
* Async getter for the linting diagnostics of the current code
|
|
71
|
+
*/
|
|
72
|
+
lintSource(): Promise<WorkerDiagnostic[]>;
|
|
73
|
+
/**
|
|
74
|
+
* available run modes for the current code
|
|
75
|
+
*/
|
|
76
|
+
runModes: Array<RunMode>;
|
|
77
|
+
/**
|
|
78
|
+
* The global state where we are part of
|
|
79
|
+
*/
|
|
80
|
+
private papyros;
|
|
81
|
+
constructor(papyros: Papyros);
|
|
82
|
+
/**
|
|
83
|
+
* Stops the current run and resets the state of the program
|
|
84
|
+
* Regular and debug output is cleared
|
|
85
|
+
* @return {Promise<void>} Returns when the program has been reset
|
|
86
|
+
*/
|
|
87
|
+
reset(): Promise<void>;
|
|
88
|
+
/**
|
|
89
|
+
* Start the backend to enable running code
|
|
90
|
+
*/
|
|
91
|
+
launch(): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Execute the code in the editor
|
|
94
|
+
* @param {RunMode} mode The mode to run with
|
|
95
|
+
* @return {Promise<void>} Promise of running the code
|
|
96
|
+
*/
|
|
97
|
+
start(mode?: RunMode): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Interrupt the currently running code
|
|
100
|
+
* @return {Promise<void>} Returns when the code has been interrupted
|
|
101
|
+
*/
|
|
102
|
+
stop(): Promise<void>;
|
|
103
|
+
provideInput(input: string): Promise<void>;
|
|
104
|
+
provideFiles(inlinedFiles: Record<string, string>, hrefFiles: Record<string, string>): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Show the current state of the program to the user
|
|
107
|
+
* @param {RunState} state The current state of the run
|
|
108
|
+
* @param {string} message Optional message to indicate the state
|
|
109
|
+
*/
|
|
110
|
+
setState(state: RunState, message?: string): void;
|
|
111
|
+
/**
|
|
112
|
+
* Callback to handle loading events
|
|
113
|
+
* @param {BackendEvent} e The loading event
|
|
114
|
+
*/
|
|
115
|
+
private onLoad;
|
|
116
|
+
private onStart;
|
|
117
|
+
private updateRunModes;
|
|
118
|
+
}
|