@dodona/papyros 0.1.94 → 0.1.95-darkmode

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.
@@ -3,11 +3,11 @@ import { Compartment, Extension } from "@codemirror/state";
3
3
  import { ProgrammingLanguage } from "./ProgrammingLanguage";
4
4
  import { EditorView } from "@codemirror/view";
5
5
  import { CompletionSource } from "@codemirror/autocomplete";
6
- import { RenderOptions } from "./util/Util";
6
+ import { Renderable, RenderOptions } from "./util/Rendering";
7
7
  /**
8
8
  * Component that provides useful features to users writing code
9
9
  */
10
- export declare class CodeEditor {
10
+ export declare class CodeEditor extends Renderable {
11
11
  /**
12
12
  * Reference to the user interface of the editor
13
13
  */
@@ -32,21 +32,17 @@ export declare class CodeEditor {
32
32
  * Compartment to configure the autocompletion at runtime
33
33
  */
34
34
  autocompletionCompartment: Compartment;
35
+ /**
36
+ * Compartment to configure styling at runtime (e.g. switching to dark mode)
37
+ */
38
+ styleCompartent: Compartment;
35
39
  /**
36
40
  * Construct a new CodeEditor
37
- * @param {ProgrammingLanguage} language The used programming language
38
- * @param {string} editorPlaceHolder The placeholder for the editor
39
41
  * @param {string} initialCode The initial code to display
40
42
  * @param {number} indentLength The length in spaces for the indent unit
41
43
  */
42
44
  constructor(initialCode?: string, indentLength?: number);
43
- /**
44
- * Render the editor with the given options and panel
45
- * @param {RenderOptions} options Options for rendering
46
- * @param {HTMLElement} panel The panel to display at the bottom
47
- * @return {HTMLElement} The rendered element
48
- */
49
- render(options: RenderOptions, panel?: HTMLElement): HTMLElement;
45
+ protected _render(options: RenderOptions): void;
50
46
  /**
51
47
  * Set the language that is currently used
52
48
  * @param {ProgrammingLanguage} language The language to use
@@ -97,7 +93,8 @@ export declare class CodeEditor {
97
93
  * - [custom selection drawing](#view.drawSelection)
98
94
  * - [multiple selections](#state.EditorState^allowMultipleSelections)
99
95
  * - [reindentation on input](#language.indentOnInput)
100
- * - [the default highlight style](#highlight.defaultHighlightStyle) (as fallback)
96
+ * - [syntax highlighting with the default highlight style]
97
+ * (#highlight.defaultHighlightStyle) (as fallback)
101
98
  * - [bracket matching](#matchbrackets.bracketMatching)
102
99
  * - [bracket closing](#closebrackets.closeBrackets)
103
100
  * - [autocompletion](#autocomplete.autocompletion)
@@ -106,6 +103,7 @@ export declare class CodeEditor {
106
103
  * - [active line gutter highlighting](#gutter.highlightActiveLineGutter)
107
104
  * - [selection match highlighting](#search.highlightSelectionMatches)
108
105
  * Keymaps:
106
+ * - [bracket closing](#commands.closeBracketsKeymap)
109
107
  * - [the default command bindings](#commands.defaultKeymap)
110
108
  * - [search](#search.searchKeymap)
111
109
  * - [commenting](#comment.commentKeymap)
@@ -1,7 +1,21 @@
1
1
  import { CodeEditor } from "./CodeEditor";
2
2
  import { InputManager } from "./InputManager";
3
3
  import { ProgrammingLanguage } from "./ProgrammingLanguage";
4
- import { ButtonOptions, RenderOptions } from "./util/Util";
4
+ import { RenderOptions, ButtonOptions, Renderable } from "./util/Rendering";
5
+ interface CodeRunnerRenderOptions {
6
+ /**
7
+ * Options for rendering the panel
8
+ */
9
+ statusPanelOptions: RenderOptions;
10
+ /**
11
+ * Options for rendering the InputManager
12
+ */
13
+ inputOptions: RenderOptions;
14
+ /**
15
+ * Options for rendering the editor
16
+ */
17
+ codeEditorOptions: RenderOptions;
18
+ }
5
19
  /**
6
20
  * Enum representing the possible states while processing code
7
21
  */
@@ -15,7 +29,7 @@ export declare enum RunState {
15
29
  /**
16
30
  * Helper component to manage and visualize the current RunState
17
31
  */
18
- export declare class CodeRunner {
32
+ export declare class CodeRunner extends Renderable<CodeRunnerRenderOptions> {
19
33
  /**
20
34
  * The currently used programming language
21
35
  */
@@ -86,17 +100,11 @@ export declare class CodeRunner {
86
100
  * @param {function} onClick Listener for click events on the button
87
101
  */
88
102
  addButton(options: ButtonOptions, onClick: () => void): void;
89
- /**
90
- * Render the RunStateManager with the given options
91
- * @param {RenderOptions} statusPanelOptions Options for rendering the panel
92
- * @param {RenderOptions} inputOptions Options for rendering the InputManager
93
- * @param {RenderOptions} codeEditorOptions Options for rendering the editor
94
- * @return {HTMLElement} The rendered RunStateManager
95
- */
96
- render(statusPanelOptions: RenderOptions, inputOptions: RenderOptions, codeEditorOptions: RenderOptions): HTMLElement;
103
+ protected _render(options: CodeRunnerRenderOptions): HTMLElement;
97
104
  /**
98
105
  * Run the code that is currently present in the editor
99
106
  * @return {Promise<void>} Promise of running the code
100
107
  */
101
108
  runCode(): Promise<void>;
102
109
  }
110
+ export {};
@@ -15,6 +15,7 @@ export declare const SWITCH_INPUT_MODE_A_ID: string;
15
15
  export declare const EXAMPLE_SELECT_ID: string;
16
16
  export declare const LOCALE_SELECT_ID: string;
17
17
  export declare const PROGRAMMING_LANGUAGE_SELECT_ID: string;
18
+ export declare const DARK_MODE_TOGGLE_ID: string;
18
19
  export declare const DEFAULT_PROGRAMMING_LANGUAGE = ProgrammingLanguage.Python;
19
20
  export declare const DEFAULT_LOCALE = "nl";
20
21
  export declare const DEFAULT_SERVICE_WORKER = "InputServiceWorker.js";
@@ -1,15 +1,14 @@
1
1
  import { BackendEvent } from "./BackendEvent";
2
- import { RenderOptions } from "./util/Util";
3
2
  import { UserInputHandler } from "./input/UserInputHandler";
3
+ import { Renderable, RenderOptions } from "./util/Rendering";
4
4
  export declare enum InputMode {
5
5
  Interactive = "interactive",
6
6
  Batch = "batch"
7
7
  }
8
8
  export declare const INPUT_MODES: InputMode[];
9
- export declare class InputManager {
9
+ export declare class InputManager extends Renderable {
10
10
  private inputMode;
11
11
  private inputHandlers;
12
- private renderOptions;
13
12
  private waiting;
14
13
  private prompt;
15
14
  private sendInput;
@@ -18,7 +17,7 @@ export declare class InputManager {
18
17
  getInputMode(): InputMode;
19
18
  setInputMode(inputMode: InputMode): void;
20
19
  get inputHandler(): UserInputHandler;
21
- render(options: RenderOptions): void;
20
+ _render(options: RenderOptions): void;
22
21
  waitWithPrompt(waiting: boolean, prompt?: string): void;
23
22
  onUserInput(): Promise<void>;
24
23
  /**