@dodona/papyros 0.4.0-es6 → 0.4.4

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.
@@ -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: RenderOptions;
14
+ inputOptions: InputManagerRenderOptions;
15
15
  /**
16
16
  * Options for rendering the editor
17
17
  */
@@ -104,15 +104,10 @@ export declare class CodeRunner extends Renderable<CodeRunnerRenderOptions> {
104
104
  * @param {ProgrammingLanguage} programmingLanguage The language to use
105
105
  */
106
106
  setProgrammingLanguage(programmingLanguage: ProgrammingLanguage): Promise<void>;
107
- getProgrammingLanguage(): ProgrammingLanguage;
108
- /**
109
- * Get the button to run the code
110
- */
111
- get runButton(): HTMLButtonElement;
112
107
  /**
113
- * Get the button to interrupt the code
108
+ * @return {ProgrammingLanguage} The current programming language
114
109
  */
115
- get stopButton(): HTMLButtonElement;
110
+ getProgrammingLanguage(): ProgrammingLanguage;
116
111
  /**
117
112
  * Show or hide the spinning circle, representing a running animation
118
113
  * @param {boolean} show Whether to show the spinner
@@ -124,14 +119,30 @@ export declare class CodeRunner extends Renderable<CodeRunnerRenderOptions> {
124
119
  * @param {string} message Optional message to indicate the state
125
120
  */
126
121
  setState(state: RunState, message?: string): void;
122
+ /**
123
+ * @return {RunState} The state of the current run
124
+ */
127
125
  getState(): RunState;
128
- removeButton(id: string): void;
126
+ /**
127
+ * Remove a button from the internal button list. Requires a re-render to update
128
+ * @param {string} id Identifier of the button to remove
129
+ */
130
+ private removeButton;
129
131
  /**
130
132
  * Add a button to display to the user
131
133
  * @param {ButtonOptions} options Options for rendering the button
132
134
  * @param {function} onClick Listener for click events on the button
133
135
  */
134
136
  addButton(options: ButtonOptions, onClick: () => void): void;
137
+ /**
138
+ * Generate a button that the user can click to process code
139
+ * Can either run the code or interrupt it if already running
140
+ * @return {DynamicButton} A button to interact with the code according to the current state
141
+ */
142
+ private getCodeActionButton;
143
+ /**
144
+ * Specific helper method to render only the buttons required by the user
145
+ */
135
146
  private renderButtons;
136
147
  protected _render(options: CodeRunnerRenderOptions): HTMLElement;
137
148
  /**
@@ -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 declare class InputManager extends Renderable {
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;
@@ -17,7 +24,7 @@ export declare class InputManager extends Renderable {
17
24
  setInputMode(inputMode: InputMode): void;
18
25
  get inputHandler(): UserInputHandler;
19
26
  isWaiting(): boolean;
20
- protected _render(options: RenderOptions): void;
27
+ protected _render(options: InputManagerRenderOptions): void;
21
28
  private waitWithPrompt;
22
29
  private onUserInput;
23
30
  /**