@dodona/papyros 0.4.1 → 0.4.2

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/Papyros.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import "./Papyros.css";
2
- import { InputMode } from "./InputManager";
2
+ import { InputManagerRenderOptions, InputMode } from "./InputManager";
3
3
  import { ProgrammingLanguage } from "./ProgrammingLanguage";
4
4
  import { RunState, CodeRunner } from "./CodeRunner";
5
5
  import { AtomicsChannelOptions, ServiceWorkerChannelOptions } from "sync-message";
@@ -54,7 +54,7 @@ export interface PapyrosRenderOptions {
54
54
  /**
55
55
  * RenderOptions for the input field
56
56
  */
57
- inputOptions?: RenderOptions;
57
+ inputOptions?: InputManagerRenderOptions;
58
58
  /**
59
59
  * RenderOptions for the output field
60
60
  */
@@ -116,9 +116,9 @@ export declare abstract class CodeMirrorEditor extends Renderable {
116
116
  setDarkMode(darkMode: boolean): void;
117
117
  /**
118
118
  * Override the style used by this Editor
119
- * @param {any} styling Object with keys of EditorStyling to override styles
119
+ * @param {Partial<EditorStyling>} styling Object with keys of EditorStyling to override styles
120
120
  */
121
- setStyling(styling: any): void;
121
+ setStyling(styling: Partial<EditorStyling>): void;
122
122
  protected _render(options: RenderOptions): void;
123
123
  /**
124
124
  * Process the changes by informing the listeners of the new contents
@@ -1,6 +1,5 @@
1
- import { InputMode } from "../InputManager";
1
+ import { InputManagerRenderOptions, InputMode } from "../InputManager";
2
2
  import { UserInputHandler } from "./UserInputHandler";
3
- import { RenderOptions } from "../util/Rendering";
4
3
  import { BatchInputEditor } from "../editor/BatchInputEditor";
5
4
  export declare class BatchInputHandler extends UserInputHandler {
6
5
  /**
@@ -45,5 +44,5 @@ export declare class BatchInputHandler extends UserInputHandler {
45
44
  waitWithPrompt(waiting: boolean, prompt?: string): void;
46
45
  protected setPlaceholder(placeholderValue: string): void;
47
46
  focus(): void;
48
- protected _render(options: RenderOptions): void;
47
+ protected _render(options: InputManagerRenderOptions): void;
49
48
  }
@@ -9,12 +9,19 @@ export declare class InteractiveInputHandler extends UserInputHandler {
9
9
  * Retrieve the button that users can click to send their input
10
10
  */
11
11
  private get sendButton();
12
+ /**
13
+ * Retrieve the HTMLInputElement for this InputHandler
14
+ */
15
+ private get inputArea();
12
16
  getInputMode(): InputMode;
13
17
  hasNext(): boolean;
14
18
  next(): string;
15
19
  waitWithPrompt(waiting: boolean, prompt?: string): void;
20
+ protected setPlaceholder(placeholder: string): void;
21
+ focus(): void;
16
22
  toggle(): void;
17
23
  onRunStart(): void;
18
24
  onRunEnd(): void;
19
25
  protected _render(options: RenderOptions): void;
26
+ protected reset(): void;
20
27
  }
@@ -1,13 +1,16 @@
1
- import { InputMode } from "../InputManager";
1
+ import { InputManagerRenderOptions, InputMode } from "../InputManager";
2
2
  import { Renderable } from "../util/Rendering";
3
3
  /**
4
4
  * Base class for components that handle input from the user
5
5
  */
6
- export declare abstract class UserInputHandler extends Renderable {
6
+ export declare abstract class UserInputHandler extends Renderable<InputManagerRenderOptions> {
7
7
  /**
8
8
  * Whether we are waiting for the user to input data
9
9
  */
10
10
  protected waiting: boolean;
11
+ /**
12
+ * Function to call when the user provided new input
13
+ */
11
14
  protected inputCallback: () => void;
12
15
  /**
13
16
  * Construct a new UserInputHandler
@@ -44,18 +47,14 @@ export declare abstract class UserInputHandler extends Renderable {
44
47
  * @param {boolean} active Whether this component is active
45
48
  */
46
49
  abstract toggle(active: boolean): void;
47
- /**
48
- * Retrieve the HTMLInputElement for this InputHandler
49
- */
50
- get inputArea(): HTMLInputElement;
51
50
  /**
52
51
  * @param {string} placeholder The placeholder to show
53
52
  */
54
- protected setPlaceholder(placeholder: string): void;
53
+ protected abstract setPlaceholder(placeholder: string): void;
55
54
  /**
56
55
  * Focus the area in which the user enters input
57
56
  */
58
- focus(): void;
57
+ abstract focus(): void;
59
58
  /**
60
59
  * Wait for input of the user for a certain prompt
61
60
  * @param {boolean} waiting Whether we are waiting for input
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dodona/papyros",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "private": false,
5
5
  "homepage": ".",
6
6
  "devDependencies": {