@dodona/papyros 0.1.31-action → 0.1.35
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/README.md +4 -11
- package/dist/Backend.d.ts +2 -1
- package/dist/CodeEditor.d.ts +1 -0
- package/dist/Constants.d.ts +2 -1
- package/dist/OutputManager.d.ts +19 -0
- package/dist/Papyros.d.ts +5 -1
- package/dist/PapyrosEvent.d.ts +1 -0
- package/dist/StatusPanel.d.ts +0 -3
- package/dist/examples/Examples.d.ts +6 -0
- package/dist/examples/JavaScriptExamples.d.ts +5 -0
- package/dist/examples/PythonExamples.d.ts +11 -0
- package/dist/index.js +2 -1
- package/dist/index.js.LICENSE.txt +7 -0
- package/dist/inputServiceWorker.js +1 -0
- package/dist/util/HTMLShapes.d.ts +3 -0
- package/dist/util/Util.d.ts +3 -1
- package/package.json +6 -3
- package/dist/workers/python/init.py.d.ts +0 -1
package/README.md
CHANGED
|
@@ -12,29 +12,22 @@
|
|
|
12
12
|
</a>
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
|
-
Papyros is a programming scratchpad in the browser. It allows running
|
|
16
|
-
|
|
15
|
+
Papyros is a programming scratchpad in the browser. It allows running code
|
|
16
|
+
directly in your browser, no installation required. Right now, the focus in on providing a great experience for Python, while also supporting JavaScript.
|
|
17
17
|
By taking away obstacles between students and coding, the learning experience becomes
|
|
18
|
-
smoother and less error-prone.
|
|
19
|
-
|
|
20
|
-
Papyros aims to be:
|
|
21
|
-
|
|
22
|
-
- **Easy to use** by having minimal installation instructions and an intuitive user interface
|
|
23
|
-
- **Flexible** to support many programming languages
|
|
18
|
+
smoother and less error-prone.
|
|
24
19
|
|
|
25
20
|
Currently, Papyros provides support for the following programming languages:
|
|
26
21
|
- Python, powered by [Pyodide](https://pyodide.org/en/stable/)
|
|
27
22
|
- JavaScript, powered by your browser
|
|
28
23
|
|
|
29
|
-
##
|
|
24
|
+
## Using Papyros in your own project
|
|
30
25
|
|
|
31
26
|
You can install Papyros on your system using npm:
|
|
32
27
|
```shell
|
|
33
28
|
npm install -g @dodona/papyros
|
|
34
29
|
```
|
|
35
30
|
|
|
36
|
-
## Usage
|
|
37
|
-
|
|
38
31
|
Papyros currently supports two modes of operation: stand-alone and embedded.
|
|
39
32
|
|
|
40
33
|
In stand-alone mode, Papyros runs as a full application in the browser.
|
package/dist/Backend.d.ts
CHANGED
|
@@ -6,11 +6,12 @@ export declare abstract class Backend {
|
|
|
6
6
|
/**
|
|
7
7
|
* Initialize the backend, setting up any globals required
|
|
8
8
|
* @param {function(PapyrosEvent):void} onEvent Callback for when events occur
|
|
9
|
+
* @param {string} hostname Base URL for input
|
|
9
10
|
* @param {Uint8Array} inputTextArray Optional shared buffer for input
|
|
10
11
|
* @param {Int32Array} inputMetaData Optional shared buffer for metadata about input
|
|
11
12
|
* @return {Promise<void>} Promise of launching
|
|
12
13
|
*/
|
|
13
|
-
launch(onEvent: (e: PapyrosEvent) => void, inputTextArray?: Uint8Array, inputMetaData?: Int32Array): Promise<void>;
|
|
14
|
+
launch(onEvent: (e: PapyrosEvent) => void, hostname: string, inputTextArray?: Uint8Array, inputMetaData?: Int32Array): Promise<void>;
|
|
14
15
|
abstract _runCodeInternal(code: string): Promise<any>;
|
|
15
16
|
/**
|
|
16
17
|
* Validate and run arbitrary code
|
package/dist/CodeEditor.d.ts
CHANGED
package/dist/Constants.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare const SEND_INPUT_BTN_ID = "send-input-btn";
|
|
|
12
12
|
export declare const SWITCH_INPUT_MODE_A_ID = "switch-input-mode";
|
|
13
13
|
export declare const PROGRAMMING_LANGUAGE_SELECT_ID = "programming-language-select";
|
|
14
14
|
export declare const DEFAULT_PROGRAMMING_LANGUAGE = ProgrammingLanguage.Python;
|
|
15
|
+
export declare const EXAMPLE_SELECT_ID = "example-select";
|
|
15
16
|
export declare const LOCALE_SELECT_ID = "locale-select";
|
|
16
17
|
export declare const DEFAULT_LOCALE = "nl";
|
|
17
|
-
export declare const INPUT_RELATIVE_URL = "
|
|
18
|
+
export declare const INPUT_RELATIVE_URL = "__papyros_input";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PapyrosEvent } from "./PapyrosEvent";
|
|
2
|
+
export interface FriendlyError {
|
|
3
|
+
name: string;
|
|
4
|
+
traceback?: string;
|
|
5
|
+
info?: string;
|
|
6
|
+
why?: string;
|
|
7
|
+
what?: string;
|
|
8
|
+
where?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class OutputManager {
|
|
11
|
+
outputArea: HTMLElement;
|
|
12
|
+
constructor(outputWrapperId: string);
|
|
13
|
+
renderNextElement(html: string): void;
|
|
14
|
+
spanify(text: string, ignoreEmpty?: boolean): string;
|
|
15
|
+
showOutput(output: PapyrosEvent): void;
|
|
16
|
+
showError(error: FriendlyError | string): void;
|
|
17
|
+
onRunStart(): void;
|
|
18
|
+
onRunEnd(): void;
|
|
19
|
+
}
|
package/dist/Papyros.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { InputManager, InputMode } from "./InputManager";
|
|
|
6
6
|
import { PapyrosEvent } from "./PapyrosEvent";
|
|
7
7
|
import { ProgrammingLanguage } from "./ProgrammingLanguage";
|
|
8
8
|
import { StatusPanel } from "./StatusPanel";
|
|
9
|
+
import { OutputManager } from "./OutputManager";
|
|
9
10
|
declare enum PapyrosState {
|
|
10
11
|
Loading = "loading",
|
|
11
12
|
Running = "running",
|
|
@@ -38,12 +39,15 @@ export declare class Papyros {
|
|
|
38
39
|
stateManager: PapyrosStateManager;
|
|
39
40
|
codeState: PapyrosCodeState;
|
|
40
41
|
inputManager: InputManager;
|
|
42
|
+
outputManager: OutputManager;
|
|
41
43
|
constructor(programmingLanguage: ProgrammingLanguage, inputMode: InputMode);
|
|
42
44
|
get state(): PapyrosState;
|
|
43
45
|
launch(): Promise<Papyros>;
|
|
44
46
|
setProgrammingLanguage(programmingLanguage: ProgrammingLanguage): Promise<void>;
|
|
47
|
+
setCode(code: string): void;
|
|
45
48
|
startBackend(): Promise<void>;
|
|
46
|
-
static fromElement(parent: HTMLElement, config: PapyrosConfig):
|
|
49
|
+
static fromElement(parent: HTMLElement, config: PapyrosConfig): Papyros;
|
|
50
|
+
static configureInput(allowReload: boolean): Promise<boolean>;
|
|
47
51
|
onError(e: PapyrosEvent): void;
|
|
48
52
|
onInput(e: PapyrosEvent): Promise<void>;
|
|
49
53
|
onMessage(e: PapyrosEvent): void;
|
package/dist/PapyrosEvent.d.ts
CHANGED
package/dist/StatusPanel.d.ts
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ProgrammingLanguage } from "../ProgrammingLanguage";
|
|
2
|
+
export declare function getExamples(language: ProgrammingLanguage): {
|
|
3
|
+
[key: string]: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function getExampleNames(language: ProgrammingLanguage): Array<string>;
|
|
6
|
+
export declare function getCodeForExample(language: ProgrammingLanguage, name: string): string;
|