@dodona/papyros 0.4.1 → 0.5.0
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/dist/CodeRunner.d.ts +28 -12
- package/dist/InputManager.d.ts +10 -2
- package/dist/Library.js +1 -1
- package/dist/Papyros.d.ts +2 -2
- package/dist/editor/BatchInputEditor.d.ts +21 -7
- package/dist/editor/CodeMirrorEditor.d.ts +5 -3
- package/dist/editor/DarkTheme.d.ts +1 -0
- package/dist/editor/Gutters.d.ts +11 -5
- package/dist/input/BatchInputHandler.d.ts +7 -4
- package/dist/input/InteractiveInputHandler.d.ts +7 -0
- package/dist/input/UserInputHandler.d.ts +9 -10
- package/package.json +2 -2
package/dist/CodeRunner.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CodeEditor } from "./editor/CodeEditor";
|
|
2
|
-
import { InputManager, InputMode } from "./InputManager";
|
|
2
|
+
import { InputManager, InputManagerRenderOptions, InputMode } from "./InputManager";
|
|
3
3
|
import { ProgrammingLanguage } from "./ProgrammingLanguage";
|
|
4
4
|
import { RenderOptions, ButtonOptions, Renderable } from "./util/Rendering";
|
|
5
5
|
import { OutputManager } from "./OutputManager";
|
|
@@ -11,7 +11,7 @@ interface CodeRunnerRenderOptions {
|
|
|
11
11
|
/**
|
|
12
12
|
* Options for rendering the InputManager
|
|
13
13
|
*/
|
|
14
|
-
inputOptions:
|
|
14
|
+
inputOptions: InputManagerRenderOptions;
|
|
15
15
|
/**
|
|
16
16
|
* Options for rendering the editor
|
|
17
17
|
*/
|
|
@@ -40,9 +40,9 @@ export interface LoadingData {
|
|
|
40
40
|
*/
|
|
41
41
|
modules: Array<string>;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* The status of the import
|
|
44
44
|
*/
|
|
45
|
-
|
|
45
|
+
status: "loading" | "loaded" | "failed";
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
48
48
|
* Helper component to manage and visualize the current RunState
|
|
@@ -84,6 +84,10 @@ export declare class CodeRunner extends Renderable<CodeRunnerRenderOptions> {
|
|
|
84
84
|
* Previous state to restore when loading is done
|
|
85
85
|
*/
|
|
86
86
|
private previousState;
|
|
87
|
+
/**
|
|
88
|
+
* Time at which the setState call occurred
|
|
89
|
+
*/
|
|
90
|
+
private runStartTime;
|
|
87
91
|
/**
|
|
88
92
|
* Construct a new RunStateManager with the given listeners
|
|
89
93
|
* @param {ProgrammingLanguage} programmingLanguage The language to use
|
|
@@ -104,15 +108,10 @@ export declare class CodeRunner extends Renderable<CodeRunnerRenderOptions> {
|
|
|
104
108
|
* @param {ProgrammingLanguage} programmingLanguage The language to use
|
|
105
109
|
*/
|
|
106
110
|
setProgrammingLanguage(programmingLanguage: ProgrammingLanguage): Promise<void>;
|
|
107
|
-
getProgrammingLanguage(): ProgrammingLanguage;
|
|
108
111
|
/**
|
|
109
|
-
*
|
|
112
|
+
* @return {ProgrammingLanguage} The current programming language
|
|
110
113
|
*/
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Get the button to interrupt the code
|
|
114
|
-
*/
|
|
115
|
-
get stopButton(): HTMLButtonElement;
|
|
114
|
+
getProgrammingLanguage(): ProgrammingLanguage;
|
|
116
115
|
/**
|
|
117
116
|
* Show or hide the spinning circle, representing a running animation
|
|
118
117
|
* @param {boolean} show Whether to show the spinner
|
|
@@ -124,14 +123,30 @@ export declare class CodeRunner extends Renderable<CodeRunnerRenderOptions> {
|
|
|
124
123
|
* @param {string} message Optional message to indicate the state
|
|
125
124
|
*/
|
|
126
125
|
setState(state: RunState, message?: string): void;
|
|
126
|
+
/**
|
|
127
|
+
* @return {RunState} The state of the current run
|
|
128
|
+
*/
|
|
127
129
|
getState(): RunState;
|
|
128
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Remove a button from the internal button list. Requires a re-render to update
|
|
132
|
+
* @param {string} id Identifier of the button to remove
|
|
133
|
+
*/
|
|
134
|
+
private removeButton;
|
|
129
135
|
/**
|
|
130
136
|
* Add a button to display to the user
|
|
131
137
|
* @param {ButtonOptions} options Options for rendering the button
|
|
132
138
|
* @param {function} onClick Listener for click events on the button
|
|
133
139
|
*/
|
|
134
140
|
addButton(options: ButtonOptions, onClick: () => void): void;
|
|
141
|
+
/**
|
|
142
|
+
* Generate a button that the user can click to process code
|
|
143
|
+
* Can either run the code or interrupt it if already running
|
|
144
|
+
* @return {DynamicButton} A button to interact with the code according to the current state
|
|
145
|
+
*/
|
|
146
|
+
private getCodeActionButton;
|
|
147
|
+
/**
|
|
148
|
+
* Specific helper method to render only the buttons required by the user
|
|
149
|
+
*/
|
|
135
150
|
private renderButtons;
|
|
136
151
|
protected _render(options: CodeRunnerRenderOptions): HTMLElement;
|
|
137
152
|
/**
|
|
@@ -145,5 +160,6 @@ export declare class CodeRunner extends Renderable<CodeRunnerRenderOptions> {
|
|
|
145
160
|
* @param {BackendEvent} e The loading event
|
|
146
161
|
*/
|
|
147
162
|
private onLoad;
|
|
163
|
+
private onStart;
|
|
148
164
|
}
|
|
149
165
|
export {};
|
package/dist/InputManager.d.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { UserInputHandler } from "./input/UserInputHandler";
|
|
2
2
|
import { Renderable, RenderOptions } from "./util/Rendering";
|
|
3
|
+
import { EditorStyling } from "./editor/CodeMirrorEditor";
|
|
3
4
|
export declare enum InputMode {
|
|
4
5
|
Interactive = "interactive",
|
|
5
6
|
Batch = "batch"
|
|
6
7
|
}
|
|
7
8
|
export declare const INPUT_MODES: InputMode[];
|
|
8
|
-
export
|
|
9
|
+
export interface InputManagerRenderOptions extends RenderOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Option to allow styling the editor area of the input handler
|
|
12
|
+
*/
|
|
13
|
+
inputStyling?: Partial<EditorStyling>;
|
|
14
|
+
}
|
|
15
|
+
export declare class InputManager extends Renderable<InputManagerRenderOptions> {
|
|
9
16
|
private inputMode;
|
|
10
17
|
private inputHandlers;
|
|
11
18
|
private waiting;
|
|
@@ -15,9 +22,10 @@ export declare class InputManager extends Renderable {
|
|
|
15
22
|
private buildInputHandlerMap;
|
|
16
23
|
getInputMode(): InputMode;
|
|
17
24
|
setInputMode(inputMode: InputMode): void;
|
|
25
|
+
getInputHandler(inputMode: InputMode): UserInputHandler;
|
|
18
26
|
get inputHandler(): UserInputHandler;
|
|
19
27
|
isWaiting(): boolean;
|
|
20
|
-
protected _render(options:
|
|
28
|
+
protected _render(options: InputManagerRenderOptions): void;
|
|
21
29
|
private waitWithPrompt;
|
|
22
30
|
private onUserInput;
|
|
23
31
|
/**
|