@dodona/papyros 0.1.2-rc → 0.1.3-action
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/LICENSE +0 -0
- package/README.md +0 -0
- package/lib/Backend.d.ts +22 -0
- package/lib/BackendManager.d.ts +5 -0
- package/lib/CodeEditor.d.ts +14 -0
- package/lib/Constants.d.ts +17 -0
- package/lib/InputManager.d.ts +31 -0
- package/lib/Papyros.d.ts +53 -0
- package/lib/PapyrosEvent.d.ts +5 -0
- package/lib/ProgrammingLanguage.d.ts +6 -0
- package/lib/StatusPanel.d.ts +10 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/library.d.ts +9 -0
- package/lib/util/Logging.d.ts +6 -0
- package/lib/util/Util.d.ts +6 -0
- package/lib/workers/javascript/JavaScriptWorker.worker.d.ts +2 -0
- package/lib/workers/python/PythonWorker.worker.d.ts +2 -0
- package/lib/workers/python/init.py.d.ts +1 -0
- package/package.json +25 -31
package/LICENSE
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/lib/Backend.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PapyrosEvent } from "./PapyrosEvent";
|
|
2
|
+
export declare abstract class Backend {
|
|
3
|
+
onEvent: (e: PapyrosEvent) => any;
|
|
4
|
+
runId: number;
|
|
5
|
+
constructor();
|
|
6
|
+
/**
|
|
7
|
+
* Initialize the backend, setting up any globals required
|
|
8
|
+
* @param {function(PapyrosEvent):void} onEvent Callback for when events occur
|
|
9
|
+
* @param {Uint8Array} inputTextArray Optional shared buffer for input
|
|
10
|
+
* @param {Int32Array} inputMetaData Optional shared buffer for metadata about input
|
|
11
|
+
* @return {Promise<void>} Promise of launching
|
|
12
|
+
*/
|
|
13
|
+
launch(onEvent: (e: PapyrosEvent) => void, inputTextArray?: Uint8Array, inputMetaData?: Int32Array): Promise<void>;
|
|
14
|
+
abstract _runCodeInternal(code: string): Promise<any>;
|
|
15
|
+
/**
|
|
16
|
+
* Validate and run arbitrary code
|
|
17
|
+
* @param {string} code The code to run
|
|
18
|
+
* @param {string} runId The uuid for this execution
|
|
19
|
+
* @return {Promise<void>} Promise of execution
|
|
20
|
+
*/
|
|
21
|
+
runCode(code: string, runId: number): Promise<void>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Remote } from "comlink";
|
|
2
|
+
import { Backend } from "./Backend";
|
|
3
|
+
import { ProgrammingLanguage } from "./ProgrammingLanguage";
|
|
4
|
+
export declare function getBackend(language: ProgrammingLanguage): Remote<Backend>;
|
|
5
|
+
export declare function stopBackend(backend: Remote<Backend>): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Compartment } from "@codemirror/state";
|
|
2
|
+
import { ProgrammingLanguage } from "./ProgrammingLanguage";
|
|
3
|
+
import { EditorView } from "@codemirror/view";
|
|
4
|
+
export declare class CodeEditor {
|
|
5
|
+
editorView: EditorView;
|
|
6
|
+
languageCompartment: Compartment;
|
|
7
|
+
indentCompartment: Compartment;
|
|
8
|
+
placeholderCompartment: Compartment;
|
|
9
|
+
constructor(element: HTMLElement, language: ProgrammingLanguage, panel: HTMLElement, editorPlaceHolder: string, initialCode?: string, indentLength?: number);
|
|
10
|
+
setLanguage(language: ProgrammingLanguage, editorPlaceHolder: string): void;
|
|
11
|
+
setIndentLength(indentLength: number): void;
|
|
12
|
+
getCode(): string;
|
|
13
|
+
focus(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ProgrammingLanguage } from "./ProgrammingLanguage";
|
|
2
|
+
export declare const MAIN_APP_ID = "papyros";
|
|
3
|
+
export declare const OUTPUT_TA_ID = "code-output-area";
|
|
4
|
+
export declare const INPUT_AREA_WRAPPER_ID = "code-input-area-wrapper";
|
|
5
|
+
export declare const INPUT_TA_ID = "code-input-area";
|
|
6
|
+
export declare const EDITOR_WRAPPER_ID = "code-area";
|
|
7
|
+
export declare const STATE_SPINNER_ID = "state-spinner";
|
|
8
|
+
export declare const APPLICATION_STATE_TEXT_ID = "application-state-text";
|
|
9
|
+
export declare const RUN_BTN_ID = "run-code-btn";
|
|
10
|
+
export declare const STOP_BTN_ID = "stop-btn";
|
|
11
|
+
export declare const SEND_INPUT_BTN_ID = "send-input-btn";
|
|
12
|
+
export declare const SWITCH_INPUT_MODE_A_ID = "switch-input-mode";
|
|
13
|
+
export declare const PROGRAMMING_LANGUAGE_SELECT_ID = "programming-language-select";
|
|
14
|
+
export declare const DEFAULT_PROGRAMMING_LANGUAGE = ProgrammingLanguage.Python;
|
|
15
|
+
export declare const LOCALE_SELECT_ID = "locale-select";
|
|
16
|
+
export declare const DEFAULT_LOCALE = "nl";
|
|
17
|
+
export declare const INPUT_RELATIVE_URL = "/__papyros_input";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PapyrosEvent } from "./PapyrosEvent";
|
|
2
|
+
export declare enum InputMode {
|
|
3
|
+
Interactive = "interactive",
|
|
4
|
+
Batch = "batch"
|
|
5
|
+
}
|
|
6
|
+
export declare const INPUT_MODES: InputMode[];
|
|
7
|
+
interface InputSession {
|
|
8
|
+
lineNr: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class InputManager {
|
|
11
|
+
inputWrapper: HTMLElement;
|
|
12
|
+
inputMode: InputMode;
|
|
13
|
+
waiting: boolean;
|
|
14
|
+
batchInput: string;
|
|
15
|
+
onSend: () => void;
|
|
16
|
+
session: InputSession;
|
|
17
|
+
inputTextArray?: Uint8Array;
|
|
18
|
+
inputMetaData?: Int32Array;
|
|
19
|
+
textEncoder: TextEncoder;
|
|
20
|
+
constructor(onSend: () => void, inputMode: InputMode);
|
|
21
|
+
get enterButton(): HTMLButtonElement;
|
|
22
|
+
get inputArea(): HTMLInputElement;
|
|
23
|
+
buildInputArea(): void;
|
|
24
|
+
setInputMode(inputMode: InputMode): void;
|
|
25
|
+
setWaiting(waiting: boolean, prompt?: string): void;
|
|
26
|
+
sendLine(): Promise<boolean>;
|
|
27
|
+
onInput(e?: PapyrosEvent): Promise<void>;
|
|
28
|
+
onRunStart(): void;
|
|
29
|
+
onRunEnd(): void;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
package/lib/Papyros.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import "./Papyros.css";
|
|
2
|
+
import { Remote } from "comlink";
|
|
3
|
+
import { Backend } from "./Backend";
|
|
4
|
+
import { CodeEditor } from "./CodeEditor";
|
|
5
|
+
import { InputManager, InputMode } from "./InputManager";
|
|
6
|
+
import { PapyrosEvent } from "./PapyrosEvent";
|
|
7
|
+
import { ProgrammingLanguage } from "./ProgrammingLanguage";
|
|
8
|
+
import { StatusPanel } from "./StatusPanel";
|
|
9
|
+
declare enum PapyrosState {
|
|
10
|
+
Loading = "loading",
|
|
11
|
+
Running = "running",
|
|
12
|
+
AwaitingInput = "awaiting_input",
|
|
13
|
+
Stopping = "stopping",
|
|
14
|
+
Ready = "ready"
|
|
15
|
+
}
|
|
16
|
+
declare class PapyrosStateManager {
|
|
17
|
+
state: PapyrosState;
|
|
18
|
+
statusPanel: StatusPanel;
|
|
19
|
+
runButton: HTMLButtonElement;
|
|
20
|
+
stopButton: HTMLButtonElement;
|
|
21
|
+
constructor(statusPanel: StatusPanel);
|
|
22
|
+
setState(state: PapyrosState, message?: string): void;
|
|
23
|
+
}
|
|
24
|
+
interface PapyrosCodeState {
|
|
25
|
+
programmingLanguage: ProgrammingLanguage;
|
|
26
|
+
editor: CodeEditor;
|
|
27
|
+
backend: Remote<Backend>;
|
|
28
|
+
runId: number;
|
|
29
|
+
outputArea: HTMLInputElement;
|
|
30
|
+
}
|
|
31
|
+
interface PapyrosConfig {
|
|
32
|
+
standAlone: boolean;
|
|
33
|
+
programmingLanguage: ProgrammingLanguage;
|
|
34
|
+
locale: string;
|
|
35
|
+
inputMode: InputMode;
|
|
36
|
+
}
|
|
37
|
+
export declare class Papyros {
|
|
38
|
+
stateManager: PapyrosStateManager;
|
|
39
|
+
codeState: PapyrosCodeState;
|
|
40
|
+
inputManager: InputManager;
|
|
41
|
+
constructor(programmingLanguage: ProgrammingLanguage, inputMode: InputMode);
|
|
42
|
+
get state(): PapyrosState;
|
|
43
|
+
launch(): Promise<Papyros>;
|
|
44
|
+
setProgrammingLanguage(programmingLanguage: ProgrammingLanguage): Promise<void>;
|
|
45
|
+
startBackend(): Promise<void>;
|
|
46
|
+
static fromElement(parent: HTMLElement, config: PapyrosConfig): Promise<Papyros>;
|
|
47
|
+
onError(e: PapyrosEvent): void;
|
|
48
|
+
onInput(e: PapyrosEvent): Promise<void>;
|
|
49
|
+
onMessage(e: PapyrosEvent): void;
|
|
50
|
+
runCode(): Promise<void>;
|
|
51
|
+
stop(): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class StatusPanel {
|
|
2
|
+
onRun: () => void;
|
|
3
|
+
constructor(onRun: () => void);
|
|
4
|
+
initialize(): void;
|
|
5
|
+
get statusSpinner(): HTMLElement;
|
|
6
|
+
get statusText(): HTMLElement;
|
|
7
|
+
showSpinner(show: boolean): void;
|
|
8
|
+
setStatus(status: string): void;
|
|
9
|
+
render(parent: HTMLElement): HTMLElement;
|
|
10
|
+
}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|