@dodona/papyros 0.3.7-scoped → 0.4.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.
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
@@ -93,13 +97,20 @@ export declare abstract class Backend<Extras extends SyncExtras = SyncExtras> {
93
97
  * @return {Promise<void>} Promise of launching
94
98
  */
95
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>;
96
106
  /**
97
107
  * Executes the given code
98
108
  * @param {Extras} extras Helper properties to run code
99
109
  * @param {string} code The code to run
110
+ * @param {string} mode The mode to run the code in
100
111
  * @return {Promise<void>} Promise of execution
101
112
  */
102
- abstract runCode(extras: Extras, code: string): Promise<void>;
113
+ abstract runCode(extras: Extras, code: string, mode?: string): Promise<void>;
103
114
  /**
104
115
  * Converts the context to a cloneable object containing useful properties
105
116
  * to generate autocompletion suggestions with
@@ -1,5 +1,5 @@
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
5
  import { OutputManager } from "./OutputManager";
@@ -87,8 +87,9 @@ export declare class CodeRunner extends Renderable<CodeRunnerRenderOptions> {
87
87
  /**
88
88
  * Construct a new RunStateManager with the given listeners
89
89
  * @param {ProgrammingLanguage} programmingLanguage The language to use
90
+ * @param {InputMode} inputMode The input mode to use
90
91
  */
91
- constructor(programmingLanguage: ProgrammingLanguage);
92
+ constructor(programmingLanguage: ProgrammingLanguage, inputMode: InputMode);
92
93
  /**
93
94
  * Start the backend to enable running code
94
95
  */
@@ -124,18 +125,21 @@ export declare class CodeRunner extends Renderable<CodeRunnerRenderOptions> {
124
125
  */
125
126
  setState(state: RunState, message?: string): void;
126
127
  getState(): RunState;
128
+ removeButton(id: string): void;
127
129
  /**
128
130
  * Add a button to display to the user
129
131
  * @param {ButtonOptions} options Options for rendering the button
130
132
  * @param {function} onClick Listener for click events on the button
131
133
  */
132
134
  addButton(options: ButtonOptions, onClick: () => void): void;
135
+ private renderButtons;
133
136
  protected _render(options: CodeRunnerRenderOptions): HTMLElement;
134
137
  /**
135
138
  * @param {string} code The code to run
139
+ * @param {string} mode The mode to run with
136
140
  * @return {Promise<void>} Promise of running the code
137
141
  */
138
- runCode(code: string): Promise<void>;
142
+ runCode(code: string, mode?: string): Promise<void>;
139
143
  /**
140
144
  * Callback to handle loading events
141
145
  * @param {BackendEvent} e The loading event
@@ -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;
@@ -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
- private get inputHandler();
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;
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";