@dodona/papyros 0.1.61 → 0.1.91-tar
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 +72 -13
- package/dist/BackendEvent.d.ts +33 -0
- package/dist/BackendManager.d.ts +47 -3
- package/dist/CodeEditor.d.ts +96 -2
- package/dist/CodeRunner.d.ts +102 -0
- package/dist/Constants.d.ts +16 -15
- package/dist/InputManager.d.ts +21 -21
- package/dist/Library.d.ts +10 -0
- package/dist/OutputManager.d.ts +60 -8
- package/dist/Papyros.d.ts +121 -48
- package/dist/ProgrammingLanguage.d.ts +3 -0
- package/dist/RunListener.d.ts +13 -0
- package/dist/examples/PythonExamples.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/input/BatchInputHandler.d.ts +31 -0
- package/dist/input/InteractiveInputHandler.d.ts +20 -0
- package/dist/input/UserInputHandler.d.ts +61 -0
- package/dist/inputServiceWorker.js +1 -1
- package/dist/util/HTMLShapes.d.ts +13 -0
- package/dist/util/Logging.d.ts +9 -0
- package/dist/util/Util.d.ts +94 -2
- package/dist/workers/input/InputWorker.d.ts +18 -2
- package/dist/workers/python/Pyodide.d.ts +23 -0
- package/dist/workers/python/PythonWorker.worker.d.ts +2 -0
- package/dist/workers/python/package.tar +0 -0
- package/package.json +7 -3
- package/dist/PapyrosEvent.d.ts +0 -6
- package/dist/StatusPanel.d.ts +0 -8
- package/dist/library.d.ts +0 -9
package/dist/Papyros.d.ts
CHANGED
|
@@ -1,69 +1,142 @@
|
|
|
1
1
|
import "./Papyros.css";
|
|
2
|
-
import {
|
|
3
|
-
import { Backend } from "./Backend";
|
|
4
|
-
import { CodeEditor } from "./CodeEditor";
|
|
5
|
-
import { InputManager, InputMode } from "./InputManager";
|
|
6
|
-
import { PapyrosEvent } from "./PapyrosEvent";
|
|
2
|
+
import { InputMode } from "./InputManager";
|
|
7
3
|
import { ProgrammingLanguage } from "./ProgrammingLanguage";
|
|
8
|
-
import { RenderOptions } from "./util/Util";
|
|
9
|
-
import {
|
|
4
|
+
import { RenderOptions, ButtonOptions } from "./util/Util";
|
|
5
|
+
import { RunState, CodeRunner } from "./CodeRunner";
|
|
10
6
|
import { OutputManager } from "./OutputManager";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
AwaitingInput = "awaiting_input",
|
|
15
|
-
Stopping = "stopping",
|
|
16
|
-
Ready = "ready"
|
|
17
|
-
}
|
|
18
|
-
declare class PapyrosStateManager {
|
|
19
|
-
state: PapyrosState;
|
|
20
|
-
statusPanel: StatusPanel;
|
|
21
|
-
get runButton(): HTMLButtonElement;
|
|
22
|
-
get stopButton(): HTMLButtonElement;
|
|
23
|
-
constructor(statusPanel: StatusPanel);
|
|
24
|
-
setState(state: PapyrosState, message?: string): void;
|
|
25
|
-
render(options: RenderOptions): HTMLElement;
|
|
26
|
-
}
|
|
27
|
-
interface PapyrosCodeState {
|
|
28
|
-
programmingLanguage: ProgrammingLanguage;
|
|
29
|
-
editor: CodeEditor;
|
|
30
|
-
backend: Remote<Backend>;
|
|
31
|
-
runId: number;
|
|
32
|
-
}
|
|
7
|
+
/**
|
|
8
|
+
* Configuration options for this instance of Papyros
|
|
9
|
+
*/
|
|
33
10
|
interface PapyrosConfig {
|
|
11
|
+
/**
|
|
12
|
+
* Whether Papyros is run in standAlone mode or embedded in an application
|
|
13
|
+
*/
|
|
34
14
|
standAlone: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The programming language to use
|
|
17
|
+
*/
|
|
35
18
|
programmingLanguage: ProgrammingLanguage;
|
|
19
|
+
/**
|
|
20
|
+
* The language to use
|
|
21
|
+
*/
|
|
36
22
|
locale: string;
|
|
23
|
+
/**
|
|
24
|
+
* The InputMode to use
|
|
25
|
+
*/
|
|
37
26
|
inputMode: InputMode;
|
|
38
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Options for rendering Papyros
|
|
30
|
+
*/
|
|
39
31
|
interface PapyrosRenderOptions {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Options to render Papyros itself, only used in standAlone mode
|
|
34
|
+
*/
|
|
35
|
+
standAloneOptions?: RenderOptions;
|
|
36
|
+
/**
|
|
37
|
+
* RenderOptions for the code editor
|
|
38
|
+
*/
|
|
39
|
+
codeEditorOptions?: RenderOptions;
|
|
40
|
+
/**
|
|
41
|
+
* RenderOptions for the status panel in the editor
|
|
42
|
+
*/
|
|
43
|
+
statusPanelOptions?: RenderOptions;
|
|
44
|
+
/**
|
|
45
|
+
* RenderOptions for the input field
|
|
46
|
+
*/
|
|
47
|
+
inputOptions?: RenderOptions;
|
|
48
|
+
/**
|
|
49
|
+
* RenderOptions for the output field
|
|
50
|
+
*/
|
|
51
|
+
outputOptions?: RenderOptions;
|
|
45
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Class that manages multiple components to form a coding scratchpad
|
|
55
|
+
*/
|
|
46
56
|
export declare class Papyros {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Config used to initialize Papyros
|
|
59
|
+
*/
|
|
60
|
+
config: PapyrosConfig;
|
|
61
|
+
/**
|
|
62
|
+
* Component to run code entered by the user
|
|
63
|
+
*/
|
|
64
|
+
codeRunner: CodeRunner;
|
|
65
|
+
/**
|
|
66
|
+
* Component to handle output generated by the user's code
|
|
67
|
+
*/
|
|
50
68
|
outputManager: OutputManager;
|
|
51
|
-
|
|
52
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Whether this instance has been launched
|
|
71
|
+
*/
|
|
72
|
+
private launched;
|
|
73
|
+
/**
|
|
74
|
+
* Construct a new Papyros instance
|
|
75
|
+
* @param {PapyrosConfig} config Properties to configure this instance
|
|
76
|
+
*/
|
|
77
|
+
constructor(config: PapyrosConfig);
|
|
78
|
+
/**
|
|
79
|
+
* @return {RunState} The current state of the user's code
|
|
80
|
+
*/
|
|
81
|
+
getState(): RunState;
|
|
82
|
+
/**
|
|
83
|
+
* Launch this instance of Papyros, making it ready to run code
|
|
84
|
+
* @return {Promise<Papyros>} Promise of launching, chainable
|
|
85
|
+
*/
|
|
53
86
|
launch(): Promise<Papyros>;
|
|
87
|
+
/**
|
|
88
|
+
* Set the used programming language to the given one to allow editing and running code
|
|
89
|
+
* @param {ProgrammingLanguage} programmingLanguage The language to use
|
|
90
|
+
*/
|
|
54
91
|
setProgrammingLanguage(programmingLanguage: ProgrammingLanguage): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* @param {string} code The code to use in the editor
|
|
94
|
+
*/
|
|
55
95
|
setCode(code: string): void;
|
|
96
|
+
/**
|
|
97
|
+
* @return {string} The currently written code
|
|
98
|
+
*/
|
|
56
99
|
getCode(): string;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Helper method to perform the service worker related checks and initialisation
|
|
102
|
+
* @param {string} serviceWorkerRoot URL for the directory where the service worker lives
|
|
103
|
+
* @param {string} serviceWorkerName The name of the file containing the script
|
|
104
|
+
* @return {Promise<boolean>} Whether registration was successful
|
|
105
|
+
*/
|
|
106
|
+
private registerServiceWorker;
|
|
107
|
+
/**
|
|
108
|
+
* Configure how user input is handled within Papyros
|
|
109
|
+
* By default, we will try to use SharedArrayBuffers
|
|
110
|
+
* If this option is not available, the optional arguments become relevant
|
|
111
|
+
* They are needed to register a service worker to handle communication between threads
|
|
112
|
+
* @param {string} serviceWorkerRoot URL for the directory where the service worker lives
|
|
113
|
+
* @param {string} serviceWorkerName The name of the file containing the script
|
|
114
|
+
* @param {boolean} allowReload Whether we are allowed to force a reload of the page
|
|
115
|
+
* This allows using SharedArrayBuffers without configuring the HTTP headers yourself
|
|
116
|
+
* @return {Promise<boolean>} Promise of configuring input
|
|
117
|
+
*/
|
|
118
|
+
configureInput(serviceWorkerRoot?: string, serviceWorkerName?: string, allowReload?: boolean): Promise<boolean>;
|
|
119
|
+
/**
|
|
120
|
+
* Render Papyros with the given options
|
|
121
|
+
* @param {PapyrosRenderOptions} renderOptions Options to use
|
|
122
|
+
*/
|
|
123
|
+
render(renderOptions: PapyrosRenderOptions): void;
|
|
124
|
+
/**
|
|
125
|
+
* Add a button to the status panel within Papyros
|
|
126
|
+
* @param {ButtonOptions} options Options to render the button with
|
|
127
|
+
* @param {function} onClick Listener for click events on the button
|
|
128
|
+
*/
|
|
129
|
+
addButton(options: ButtonOptions, onClick: () => void): void;
|
|
130
|
+
/**
|
|
131
|
+
* @param {ProgrammingLanguage} language The language to check
|
|
132
|
+
* @return {boolean} Whether Papyros supports this language by default
|
|
133
|
+
*/
|
|
66
134
|
static supportsProgrammingLanguage(language: string): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Convert a string to a ProgrammingLanguage
|
|
137
|
+
* @param {string} language The language to convert
|
|
138
|
+
* @return {ProgrammingLanguage | undefined} The ProgrammingLanguage, or undefined if not supported
|
|
139
|
+
*/
|
|
67
140
|
static toProgrammingLanguage(language: string): ProgrammingLanguage | undefined;
|
|
68
141
|
}
|
|
69
142
|
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for components that maintain state based on runs of code
|
|
3
|
+
*/
|
|
4
|
+
export interface RunListener {
|
|
5
|
+
/**
|
|
6
|
+
* Inform this listener that a new run started
|
|
7
|
+
*/
|
|
8
|
+
onRunStart(): void;
|
|
9
|
+
/**
|
|
10
|
+
* Inform this listener that the run ended
|
|
11
|
+
*/
|
|
12
|
+
onRunEnd(): void;
|
|
13
|
+
}
|