@dodona/papyros 0.4.4 → 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 +7 -2
- package/dist/InputManager.d.ts +1 -0
- package/dist/Library.js +1 -1
- package/dist/editor/BatchInputEditor.d.ts +21 -8
- package/dist/editor/CodeMirrorEditor.d.ts +2 -1
- package/dist/editor/DarkTheme.d.ts +1 -0
- package/dist/editor/Gutters.d.ts +6 -0
- package/dist/input/BatchInputHandler.d.ts +1 -1
- package/dist/input/UserInputHandler.d.ts +2 -2
- package/package.json +2 -2
|
@@ -1,28 +1,41 @@
|
|
|
1
1
|
import { CodeMirrorEditor } from "./CodeMirrorEditor";
|
|
2
2
|
import { UsedInputGutterInfo } from "./Gutters";
|
|
3
|
+
import { ViewUpdate } from "@codemirror/view";
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
+
* Arguments used to higlight lines in the Editor
|
|
5
6
|
*/
|
|
6
|
-
|
|
7
|
+
interface HighlightArgs {
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
+
* Whether the user's code is currently running and using input
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
+
running: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Function to obtain gutter info per line (1-based indexing)
|
|
14
|
+
*/
|
|
15
|
+
getInfo: (lineInfo: number) => UsedInputGutterInfo;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Editor to handle and highlight user input
|
|
19
|
+
*/
|
|
20
|
+
export declare class BatchInputEditor extends CodeMirrorEditor {
|
|
11
21
|
/**
|
|
12
22
|
* Gutters to show which lines were used
|
|
13
23
|
*/
|
|
14
24
|
private usedInputGutters;
|
|
25
|
+
private lastHighlightArgs?;
|
|
15
26
|
constructor();
|
|
27
|
+
private getLastHighlightArgs;
|
|
28
|
+
protected onViewUpdate(v: ViewUpdate): void;
|
|
16
29
|
/**
|
|
17
30
|
* Apply highlighting to the lines in the Editor
|
|
18
|
-
* @param {
|
|
19
|
-
* @param {
|
|
20
|
-
* info per line (1-based indexing)
|
|
31
|
+
* @param {HightlightArgs} args Arguments for highlighting
|
|
32
|
+
* @param {Array<string>} highlightClasses HTML classes to use for consumed lines
|
|
21
33
|
*/
|
|
22
|
-
highlight(
|
|
34
|
+
highlight(args: HighlightArgs, highlightClasses?: string[]): void;
|
|
23
35
|
/**
|
|
24
36
|
* @return {Array<string>} Array of valid user input
|
|
25
37
|
* Data in the last line that is not terminated by a newline is omitted
|
|
26
38
|
*/
|
|
27
39
|
getLines(): Array<string>;
|
|
28
40
|
}
|
|
41
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Compartment, Extension } from "@codemirror/state";
|
|
3
|
-
import { EditorView } from "@codemirror/view";
|
|
3
|
+
import { EditorView, ViewUpdate } from "@codemirror/view";
|
|
4
4
|
import { Renderable, RenderOptions } from "../util/Rendering";
|
|
5
5
|
import { StyleSpec } from "style-mod";
|
|
6
6
|
/**
|
|
@@ -84,6 +84,7 @@ export declare abstract class CodeMirrorEditor extends Renderable {
|
|
|
84
84
|
* @param {EditorStyling} styling Data to style this editor
|
|
85
85
|
*/
|
|
86
86
|
constructor(compartments: Set<string>, styling: EditorStyling);
|
|
87
|
+
protected onViewUpdate(v: ViewUpdate): void;
|
|
87
88
|
/**
|
|
88
89
|
* @param {Extension} extension The extension to add to the Editor
|
|
89
90
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const darkTheme: import("@codemirror/state").Extension;
|
package/dist/editor/Gutters.d.ts
CHANGED
|
@@ -23,6 +23,10 @@ export interface IGutterConfig<Info extends GutterInfo> {
|
|
|
23
23
|
* Name of this Gutter
|
|
24
24
|
*/
|
|
25
25
|
name: string;
|
|
26
|
+
/**
|
|
27
|
+
* HTML class names for the marker icons
|
|
28
|
+
*/
|
|
29
|
+
markerClasses?: string;
|
|
26
30
|
/**
|
|
27
31
|
* Handler for when a Gutter element is clicked
|
|
28
32
|
*/
|
|
@@ -53,6 +57,8 @@ export declare abstract class Gutters<Info extends GutterInfo = GutterInfo, Conf
|
|
|
53
57
|
* Will only be called when info.on is True
|
|
54
58
|
*/
|
|
55
59
|
protected abstract marker(info: Info): GutterMarker;
|
|
60
|
+
private applyClasses;
|
|
61
|
+
hasMarker(view: EditorView, lineNr: number): boolean;
|
|
56
62
|
/**
|
|
57
63
|
* Set a marker with the given info
|
|
58
64
|
* @param {EditorView} view View in which the Gutters live
|
|
@@ -27,7 +27,7 @@ export declare class BatchInputHandler extends UserInputHandler {
|
|
|
27
27
|
* Construct a new BatchInputHandler
|
|
28
28
|
* @param {function()} inputCallback Callback for when the user has entered a value
|
|
29
29
|
*/
|
|
30
|
-
constructor(inputCallback: () => void);
|
|
30
|
+
constructor(inputCallback: (line: string) => void);
|
|
31
31
|
/**
|
|
32
32
|
* Handle new input, potentially sending it to the awaiting receiver
|
|
33
33
|
* @param {string} newInput The new user input
|
|
@@ -11,12 +11,12 @@ export declare abstract class UserInputHandler extends Renderable<InputManagerRe
|
|
|
11
11
|
/**
|
|
12
12
|
* Function to call when the user provided new input
|
|
13
13
|
*/
|
|
14
|
-
protected inputCallback: () => void;
|
|
14
|
+
protected inputCallback: (line: string) => void;
|
|
15
15
|
/**
|
|
16
16
|
* Construct a new UserInputHandler
|
|
17
17
|
* @param {function()} inputCallback Callback for when the user has entered a value
|
|
18
18
|
*/
|
|
19
|
-
constructor(inputCallback: () => void);
|
|
19
|
+
constructor(inputCallback: (line: string) => void);
|
|
20
20
|
/**
|
|
21
21
|
* Whether this handler has input ready
|
|
22
22
|
*/
|
package/package.json
CHANGED