@dodona/papyros 0.3.6 → 0.4.0-es6
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/LICENSE +0 -0
- package/README.md +0 -0
- package/dist/App.d.ts +0 -0
- package/dist/Backend.d.ts +14 -2
- package/dist/BackendEvent.d.ts +0 -0
- package/dist/BackendEventQueue.d.ts +11 -2
- package/dist/BackendManager.d.ts +0 -0
- package/dist/CodeRunner.d.ts +17 -4
- package/dist/Constants.d.ts +2 -0
- package/dist/InputManager.d.ts +3 -3
- package/dist/InputServiceWorker.d.ts +0 -0
- package/dist/Library.d.ts +1 -1
- package/dist/Library.js +1 -1
- package/dist/OutputManager.d.ts +13 -0
- package/dist/Papyros.d.ts +0 -5
- package/dist/ProgrammingLanguage.d.ts +0 -0
- package/dist/editor/BatchInputEditor.d.ts +27 -0
- package/dist/{CodeEditor.d.ts → editor/CodeEditor.d.ts} +10 -41
- package/dist/editor/CodeMirrorEditor.d.ts +126 -0
- package/dist/editor/Gutters.d.ts +94 -0
- package/dist/examples/Examples.d.ts +0 -0
- package/dist/examples/JavaScriptExamples.d.ts +0 -0
- package/dist/examples/PythonExamples.d.ts +0 -0
- package/dist/input/BatchInputHandler.d.ts +18 -0
- package/dist/input/InteractiveInputHandler.d.ts +0 -0
- package/dist/input/UserInputHandler.d.ts +8 -0
- package/dist/util/HTMLShapes.d.ts +0 -0
- package/dist/util/Logging.d.ts +0 -0
- package/dist/util/Rendering.d.ts +0 -0
- package/dist/util/Util.d.ts +6 -0
- package/dist/workers/input/InputWorker.d.ts +0 -0
- package/dist/workers/input/InputWorker.js +1 -1
- package/dist/workers/javascript/JavaScriptWorker.worker.d.ts +0 -0
- package/dist/workers/python/PythonWorker.worker.d.ts +0 -0
- package/package.json +5 -5
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/dist/App.d.ts
CHANGED
|
File without changes
|
package/dist/Backend.d.ts
CHANGED
|
@@ -62,6 +62,10 @@ export interface WorkerDiagnostic {
|
|
|
62
62
|
*/
|
|
63
63
|
message: string;
|
|
64
64
|
}
|
|
65
|
+
export interface RunMode {
|
|
66
|
+
mode: string;
|
|
67
|
+
active: boolean;
|
|
68
|
+
}
|
|
65
69
|
export declare abstract class Backend<Extras extends SyncExtras = SyncExtras> {
|
|
66
70
|
/**
|
|
67
71
|
* SyncExtras object that grants access to helpful methods
|
|
@@ -89,16 +93,24 @@ export declare abstract class Backend<Extras extends SyncExtras = SyncExtras> {
|
|
|
89
93
|
/**
|
|
90
94
|
* Initialize the backend by doing all setup-related work
|
|
91
95
|
* @param {function(BackendEvent):void} onEvent Callback for when events occur
|
|
96
|
+
* @param {function():void} onOverflow Callback for when overflow occurs
|
|
92
97
|
* @return {Promise<void>} Promise of launching
|
|
93
98
|
*/
|
|
94
|
-
launch(onEvent: (e: BackendEvent) => void): Promise<void>;
|
|
99
|
+
launch(onEvent: (e: BackendEvent) => void, onOverflow: () => void): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Determine whether the modes supported by this Backend are active
|
|
102
|
+
* @param {string} code The current code in the editor
|
|
103
|
+
* @return {Array<RunMode>} The run modes of this Backend
|
|
104
|
+
*/
|
|
105
|
+
runModes(code: string): Array<RunMode>;
|
|
95
106
|
/**
|
|
96
107
|
* Executes the given code
|
|
97
108
|
* @param {Extras} extras Helper properties to run code
|
|
98
109
|
* @param {string} code The code to run
|
|
110
|
+
* @param {string} mode The mode to run the code in
|
|
99
111
|
* @return {Promise<void>} Promise of execution
|
|
100
112
|
*/
|
|
101
|
-
abstract runCode(extras: Extras, code: string): Promise<void>;
|
|
113
|
+
abstract runCode(extras: Extras, code: string, mode?: string): Promise<void>;
|
|
102
114
|
/**
|
|
103
115
|
* Converts the context to a cloneable object containing useful properties
|
|
104
116
|
* to generate autocompletion suggestions with
|
package/dist/BackendEvent.d.ts
CHANGED
|
File without changes
|
|
@@ -25,6 +25,14 @@ export declare class BackendEventQueue {
|
|
|
25
25
|
* Queue storing Output-events after overflowing
|
|
26
26
|
*/
|
|
27
27
|
private overflow;
|
|
28
|
+
/**
|
|
29
|
+
* Callback for when overflow occurs
|
|
30
|
+
*/
|
|
31
|
+
private onOverflow;
|
|
32
|
+
/**
|
|
33
|
+
* Keep track whether the queue reached its limit this run
|
|
34
|
+
*/
|
|
35
|
+
private overflown;
|
|
28
36
|
/**
|
|
29
37
|
* Time in milliseconds when the last flush occurred
|
|
30
38
|
*/
|
|
@@ -38,11 +46,12 @@ export declare class BackendEventQueue {
|
|
|
38
46
|
*/
|
|
39
47
|
private decoder;
|
|
40
48
|
/**
|
|
41
|
-
* @param {
|
|
49
|
+
* @param {function(BackendEvent):void} callback Function to process events in the queue
|
|
50
|
+
* @param {function():void} onOverflow Callback for when overflow occurs
|
|
42
51
|
* @param {number} limit The maximal amount of output lines to send before overflowing
|
|
43
52
|
* @param {number} flushTime The time in milliseconds before sending events through
|
|
44
53
|
*/
|
|
45
|
-
constructor(callback: (e: BackendEvent) => void, limit?: number, flushTime?: number);
|
|
54
|
+
constructor(callback: (e: BackendEvent) => void, onOverflow: () => void, limit?: number, flushTime?: number);
|
|
46
55
|
/**
|
|
47
56
|
* Add an element to the queue
|
|
48
57
|
* @param {BackendEventType} type The type of the event
|
package/dist/BackendManager.d.ts
CHANGED
|
File without changes
|
package/dist/CodeRunner.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { CodeEditor } from "./CodeEditor";
|
|
2
|
-
import { InputManager } from "./InputManager";
|
|
1
|
+
import { CodeEditor } from "./editor/CodeEditor";
|
|
2
|
+
import { InputManager, InputMode } from "./InputManager";
|
|
3
3
|
import { ProgrammingLanguage } from "./ProgrammingLanguage";
|
|
4
4
|
import { RenderOptions, ButtonOptions, Renderable } from "./util/Rendering";
|
|
5
|
+
import { OutputManager } from "./OutputManager";
|
|
5
6
|
interface CodeRunnerRenderOptions {
|
|
6
7
|
/**
|
|
7
8
|
* Options for rendering the panel
|
|
@@ -15,6 +16,10 @@ interface CodeRunnerRenderOptions {
|
|
|
15
16
|
* Options for rendering the editor
|
|
16
17
|
*/
|
|
17
18
|
codeEditorOptions: RenderOptions;
|
|
19
|
+
/**
|
|
20
|
+
* RenderOptions for the output field
|
|
21
|
+
*/
|
|
22
|
+
outputOptions: RenderOptions;
|
|
18
23
|
}
|
|
19
24
|
/**
|
|
20
25
|
* Enum representing the possible states while processing code
|
|
@@ -55,6 +60,10 @@ export declare class CodeRunner extends Renderable<CodeRunnerRenderOptions> {
|
|
|
55
60
|
* Component to request and handle input from the user
|
|
56
61
|
*/
|
|
57
62
|
readonly inputManager: InputManager;
|
|
63
|
+
/**
|
|
64
|
+
* Component to handle output generated by the user's code
|
|
65
|
+
*/
|
|
66
|
+
readonly outputManager: OutputManager;
|
|
58
67
|
/**
|
|
59
68
|
* The backend that executes the code asynchronously
|
|
60
69
|
*/
|
|
@@ -78,8 +87,9 @@ export declare class CodeRunner extends Renderable<CodeRunnerRenderOptions> {
|
|
|
78
87
|
/**
|
|
79
88
|
* Construct a new RunStateManager with the given listeners
|
|
80
89
|
* @param {ProgrammingLanguage} programmingLanguage The language to use
|
|
90
|
+
* @param {InputMode} inputMode The input mode to use
|
|
81
91
|
*/
|
|
82
|
-
constructor(programmingLanguage: ProgrammingLanguage);
|
|
92
|
+
constructor(programmingLanguage: ProgrammingLanguage, inputMode: InputMode);
|
|
83
93
|
/**
|
|
84
94
|
* Start the backend to enable running code
|
|
85
95
|
*/
|
|
@@ -115,18 +125,21 @@ export declare class CodeRunner extends Renderable<CodeRunnerRenderOptions> {
|
|
|
115
125
|
*/
|
|
116
126
|
setState(state: RunState, message?: string): void;
|
|
117
127
|
getState(): RunState;
|
|
128
|
+
removeButton(id: string): void;
|
|
118
129
|
/**
|
|
119
130
|
* Add a button to display to the user
|
|
120
131
|
* @param {ButtonOptions} options Options for rendering the button
|
|
121
132
|
* @param {function} onClick Listener for click events on the button
|
|
122
133
|
*/
|
|
123
134
|
addButton(options: ButtonOptions, onClick: () => void): void;
|
|
135
|
+
private renderButtons;
|
|
124
136
|
protected _render(options: CodeRunnerRenderOptions): HTMLElement;
|
|
125
137
|
/**
|
|
126
138
|
* @param {string} code The code to run
|
|
139
|
+
* @param {string} mode The mode to run with
|
|
127
140
|
* @return {Promise<void>} Promise of running the code
|
|
128
141
|
*/
|
|
129
|
-
runCode(code: string): Promise<void>;
|
|
142
|
+
runCode(code: string, mode?: string): Promise<void>;
|
|
130
143
|
/**
|
|
131
144
|
* Callback to handle loading events
|
|
132
145
|
* @param {BackendEvent} e The loading event
|
package/dist/Constants.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export declare const EDITOR_WRAPPER_ID: string;
|
|
|
16
16
|
export declare const PANEL_WRAPPER_ID: string;
|
|
17
17
|
export declare const STATE_SPINNER_ID: string;
|
|
18
18
|
export declare const APPLICATION_STATE_TEXT_ID: string;
|
|
19
|
+
export declare const CODE_BUTTONS_WRAPPER_ID: string;
|
|
19
20
|
export declare const RUN_BTN_ID: string;
|
|
20
21
|
export declare const STOP_BTN_ID: string;
|
|
21
22
|
export declare const SEND_INPUT_BTN_ID: string;
|
|
@@ -27,3 +28,4 @@ export declare const DARK_MODE_TOGGLE_ID: string;
|
|
|
27
28
|
export declare const DEFAULT_PROGRAMMING_LANGUAGE = ProgrammingLanguage.Python;
|
|
28
29
|
export declare const DEFAULT_LOCALE = "nl";
|
|
29
30
|
export declare const DEFAULT_SERVICE_WORKER = "InputServiceWorker.js";
|
|
31
|
+
export declare const DEFAULT_EDITOR_DELAY = 750;
|
package/dist/InputManager.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { UserInputHandler } from "./input/UserInputHandler";
|
|
1
2
|
import { Renderable, RenderOptions } from "./util/Rendering";
|
|
2
3
|
export declare enum InputMode {
|
|
3
4
|
Interactive = "interactive",
|
|
@@ -10,11 +11,11 @@ export declare class InputManager extends Renderable {
|
|
|
10
11
|
private waiting;
|
|
11
12
|
private prompt;
|
|
12
13
|
private sendInput;
|
|
13
|
-
constructor(sendInput: (input: string) => void);
|
|
14
|
+
constructor(sendInput: (input: string) => void, inputMode: InputMode);
|
|
14
15
|
private buildInputHandlerMap;
|
|
15
16
|
getInputMode(): InputMode;
|
|
16
17
|
setInputMode(inputMode: InputMode): void;
|
|
17
|
-
|
|
18
|
+
get inputHandler(): UserInputHandler;
|
|
18
19
|
isWaiting(): boolean;
|
|
19
20
|
protected _render(options: RenderOptions): void;
|
|
20
21
|
private waitWithPrompt;
|
|
@@ -22,7 +23,6 @@ export declare class InputManager extends Renderable {
|
|
|
22
23
|
/**
|
|
23
24
|
* Asynchronously handle an input request by prompting the user for input
|
|
24
25
|
* @param {BackendEvent} e Event containing the input data
|
|
25
|
-
* @return {Promise<void>} Promise of handling the request
|
|
26
26
|
*/
|
|
27
27
|
private onInputRequest;
|
|
28
28
|
private onRunStart;
|
|
File without changes
|
package/dist/Library.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BackendEvent } from "./BackendEvent";
|
|
2
|
-
import { CodeEditor } from "./CodeEditor";
|
|
2
|
+
import { CodeEditor } from "./editor/CodeEditor";
|
|
3
3
|
import { InputManager, InputMode } from "./InputManager";
|
|
4
4
|
import { FriendlyError, OutputManager } from "./OutputManager";
|
|
5
5
|
import { Papyros, PapyrosConfig, PapyrosRenderOptions } from "./Papyros";
|