@dodona/papyros 3.0.2 → 4.0.0-beta-9

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.
Files changed (233) hide show
  1. package/README.md +132 -72
  2. package/dist/Library.d.ts +10 -11
  3. package/dist/Library.js +9 -7
  4. package/dist/Library.js.map +1 -1
  5. package/dist/{Backend.d.ts → backend/Backend.d.ts} +3 -12
  6. package/dist/{Backend.js → backend/Backend.js} +4 -17
  7. package/dist/backend/Backend.js.map +1 -0
  8. package/dist/{workers → backend/workers}/javascript/JavaScriptWorker.js +1 -1
  9. package/dist/backend/workers/javascript/JavaScriptWorker.js.map +1 -0
  10. package/dist/backend/workers/javascript/worker.js.map +1 -0
  11. package/dist/{workers → backend/workers}/python/PythonWorker.d.ts +2 -2
  12. package/dist/{workers → backend/workers}/python/PythonWorker.js +2 -2
  13. package/dist/backend/workers/python/PythonWorker.js.map +1 -0
  14. package/dist/backend/workers/python/python_package.tar.gz.load_by_url +0 -0
  15. package/dist/backend/workers/python/worker.js.map +1 -0
  16. package/dist/communication/BackendEvent.js.map +1 -0
  17. package/dist/{BackendEventQueue.d.ts → communication/BackendEventQueue.d.ts} +1 -36
  18. package/dist/{BackendEventQueue.js → communication/BackendEventQueue.js} +2 -45
  19. package/dist/communication/BackendEventQueue.js.map +1 -0
  20. package/dist/{BackendManager.d.ts → communication/BackendManager.d.ts} +2 -2
  21. package/dist/{BackendManager.js → communication/BackendManager.js} +4 -4
  22. package/dist/communication/BackendManager.js.map +1 -0
  23. package/dist/communication/InputServiceWorker.js +37 -0
  24. package/dist/communication/InputServiceWorker.js.map +1 -0
  25. package/dist/communication/InputWorker.js.map +1 -0
  26. package/dist/frontend/components/CodeRunner.d.ts +9 -0
  27. package/dist/frontend/components/CodeRunner.js +60 -0
  28. package/dist/frontend/components/CodeRunner.js.map +1 -0
  29. package/dist/frontend/components/Debugger.d.ts +7 -0
  30. package/dist/frontend/components/Debugger.js +61 -0
  31. package/dist/frontend/components/Debugger.js.map +1 -0
  32. package/dist/frontend/components/Input.d.ts +13 -0
  33. package/dist/frontend/components/Input.js +65 -0
  34. package/dist/frontend/components/Input.js.map +1 -0
  35. package/dist/frontend/components/Output.d.ts +14 -0
  36. package/dist/frontend/components/Output.js +154 -0
  37. package/dist/frontend/components/Output.js.map +1 -0
  38. package/dist/frontend/components/PapyrosElement.d.ts +8 -0
  39. package/dist/frontend/components/PapyrosElement.js +24 -0
  40. package/dist/frontend/components/PapyrosElement.js.map +1 -0
  41. package/dist/frontend/components/app/App.d.ts +24 -0
  42. package/dist/frontend/components/app/App.js +204 -0
  43. package/dist/frontend/components/app/App.js.map +1 -0
  44. package/dist/frontend/components/app/ExamplePicker.d.ts +7 -0
  45. package/dist/frontend/components/app/ExamplePicker.js +35 -0
  46. package/dist/frontend/components/app/ExamplePicker.js.map +1 -0
  47. package/dist/frontend/components/app/LanguagePicker.d.ts +7 -0
  48. package/dist/frontend/components/app/LanguagePicker.js +35 -0
  49. package/dist/frontend/components/app/LanguagePicker.js.map +1 -0
  50. package/dist/frontend/components/app/ProgrammingLanguagePicker.d.ts +7 -0
  51. package/dist/frontend/components/app/ProgrammingLanguagePicker.js +39 -0
  52. package/dist/frontend/components/app/ProgrammingLanguagePicker.js.map +1 -0
  53. package/dist/frontend/components/app/examples/JavaScriptExamples.js.map +1 -0
  54. package/dist/frontend/components/app/examples/PythonExamples.js.map +1 -0
  55. package/dist/frontend/components/app/themes/ThemePicker.d.ts +11 -0
  56. package/dist/frontend/components/app/themes/ThemePicker.js +47 -0
  57. package/dist/frontend/components/app/themes/ThemePicker.js.map +1 -0
  58. package/dist/frontend/components/app/themes/ThemedButton.d.ts +9 -0
  59. package/dist/frontend/components/app/themes/ThemedButton.js +43 -0
  60. package/dist/frontend/components/app/themes/ThemedButton.js.map +1 -0
  61. package/dist/frontend/components/code_mirror/BatchInputEditor.d.ts +8 -0
  62. package/dist/frontend/components/code_mirror/BatchInputEditor.js +54 -0
  63. package/dist/frontend/components/code_mirror/BatchInputEditor.js.map +1 -0
  64. package/dist/frontend/components/code_mirror/CodeEditor.d.ts +24 -0
  65. package/dist/frontend/components/code_mirror/CodeEditor.js +205 -0
  66. package/dist/frontend/components/code_mirror/CodeEditor.js.map +1 -0
  67. package/dist/frontend/components/code_mirror/CodeMirrorEditor.d.ts +20 -0
  68. package/dist/frontend/components/code_mirror/CodeMirrorEditor.js +99 -0
  69. package/dist/frontend/components/code_mirror/CodeMirrorEditor.js.map +1 -0
  70. package/dist/frontend/components/code_mirror/Extensions.d.ts +15 -0
  71. package/dist/frontend/components/code_mirror/Extensions.js +169 -0
  72. package/dist/frontend/components/code_mirror/Extensions.js.map +1 -0
  73. package/dist/frontend/components/code_mirror/MaterialTheme.d.ts +5 -0
  74. package/dist/frontend/components/code_mirror/MaterialTheme.js +109 -0
  75. package/dist/frontend/components/code_mirror/MaterialTheme.js.map +1 -0
  76. package/dist/frontend/components/code_runner/ButtonLint.d.ts +9 -0
  77. package/dist/frontend/components/code_runner/ButtonLint.js +76 -0
  78. package/dist/frontend/components/code_runner/ButtonLint.js.map +1 -0
  79. package/dist/frontend/components/code_runner/Code.d.ts +7 -0
  80. package/dist/frontend/components/code_runner/Code.js +46 -0
  81. package/dist/frontend/components/code_runner/Code.js.map +1 -0
  82. package/dist/frontend/components/code_runner/RunState.d.ts +7 -0
  83. package/dist/frontend/components/code_runner/RunState.js +41 -0
  84. package/dist/frontend/components/code_runner/RunState.js.map +1 -0
  85. package/dist/frontend/components/input/BatchInput.d.ts +9 -0
  86. package/dist/frontend/components/input/BatchInput.js +53 -0
  87. package/dist/frontend/components/input/BatchInput.js.map +1 -0
  88. package/dist/frontend/components/input/InteractiveInput.d.ts +13 -0
  89. package/dist/frontend/components/input/InteractiveInput.js +73 -0
  90. package/dist/frontend/components/input/InteractiveInput.js.map +1 -0
  91. package/dist/frontend/state/Constants.d.ts +38 -0
  92. package/dist/frontend/state/Constants.js +108 -0
  93. package/dist/frontend/state/Constants.js.map +1 -0
  94. package/dist/frontend/state/Debugger.d.ts +23 -0
  95. package/dist/frontend/state/Debugger.js +84 -0
  96. package/dist/frontend/state/Debugger.js.map +1 -0
  97. package/dist/frontend/state/Examples.d.ts +11 -0
  98. package/dist/frontend/state/Examples.js +36 -0
  99. package/dist/frontend/state/Examples.js.map +1 -0
  100. package/dist/frontend/state/I18n.d.ts +16 -0
  101. package/dist/frontend/state/I18n.js +75 -0
  102. package/dist/frontend/state/I18n.js.map +1 -0
  103. package/dist/frontend/state/InputOutput.d.ts +64 -0
  104. package/dist/frontend/state/InputOutput.js +133 -0
  105. package/dist/frontend/state/InputOutput.js.map +1 -0
  106. package/dist/frontend/state/Papyros.d.ts +32 -0
  107. package/dist/frontend/state/Papyros.js +93 -0
  108. package/dist/frontend/state/Papyros.js.map +1 -0
  109. package/dist/frontend/state/Runner.d.ts +118 -0
  110. package/dist/frontend/state/Runner.js +334 -0
  111. package/dist/frontend/state/Runner.js.map +1 -0
  112. package/dist/frontend/state/Test.d.ts +11 -0
  113. package/dist/frontend/state/Test.js +59 -0
  114. package/dist/frontend/state/Test.js.map +1 -0
  115. package/dist/frontend/state/Translations.d.ts +178 -0
  116. package/dist/frontend/state/Translations.js +188 -0
  117. package/dist/frontend/state/Translations.js.map +1 -0
  118. package/dist/frontend/state/themes/blue-dark.d.ts +2 -0
  119. package/dist/frontend/state/themes/blue-dark.js +55 -0
  120. package/dist/frontend/state/themes/blue-dark.js.map +1 -0
  121. package/dist/frontend/state/themes/blue-light.d.ts +2 -0
  122. package/dist/frontend/state/themes/blue-light.js +55 -0
  123. package/dist/frontend/state/themes/blue-light.js.map +1 -0
  124. package/dist/frontend/state/themes/green-dark.d.ts +2 -0
  125. package/dist/frontend/state/themes/green-dark.js +55 -0
  126. package/dist/frontend/state/themes/green-dark.js.map +1 -0
  127. package/dist/frontend/state/themes/green-light.d.ts +2 -0
  128. package/dist/frontend/state/themes/green-light.js +55 -0
  129. package/dist/frontend/state/themes/green-light.js.map +1 -0
  130. package/dist/frontend/state/themes/red-dark.d.ts +2 -0
  131. package/dist/frontend/state/themes/red-dark.js +55 -0
  132. package/dist/frontend/state/themes/red-dark.js.map +1 -0
  133. package/dist/frontend/state/themes/red-light.d.ts +2 -0
  134. package/dist/frontend/state/themes/red-light.js +55 -0
  135. package/dist/frontend/state/themes/red-light.js.map +1 -0
  136. package/dist/util/Util.d.ts +0 -43
  137. package/dist/util/Util.js +0 -91
  138. package/dist/util/Util.js.map +1 -1
  139. package/package.json +13 -21
  140. package/dist/App.d.ts +0 -1
  141. package/dist/App.js +0 -76
  142. package/dist/App.js.map +0 -1
  143. package/dist/Backend.js.map +0 -1
  144. package/dist/BackendEvent.js.map +0 -1
  145. package/dist/BackendEventQueue.js.map +0 -1
  146. package/dist/BackendManager.js.map +0 -1
  147. package/dist/CodeRunner.d.ts +0 -188
  148. package/dist/CodeRunner.js +0 -548
  149. package/dist/CodeRunner.js.map +0 -1
  150. package/dist/Constants.d.ts +0 -31
  151. package/dist/Constants.js +0 -36
  152. package/dist/Constants.js.map +0 -1
  153. package/dist/Debugger.d.ts +0 -18
  154. package/dist/Debugger.js +0 -86
  155. package/dist/Debugger.js.map +0 -1
  156. package/dist/InputManager.d.ts +0 -38
  157. package/dist/InputManager.js +0 -101
  158. package/dist/InputManager.js.map +0 -1
  159. package/dist/InputServiceWorker.js.map +0 -1
  160. package/dist/OutputManager.d.ts +0 -90
  161. package/dist/OutputManager.js +0 -172
  162. package/dist/OutputManager.js.map +0 -1
  163. package/dist/Papyros.css +0 -657
  164. package/dist/Papyros.d.ts +0 -141
  165. package/dist/Papyros.js +0 -268
  166. package/dist/Papyros.js.map +0 -1
  167. package/dist/Translations.d.ts +0 -180
  168. package/dist/Translations.js +0 -191
  169. package/dist/Translations.js.map +0 -1
  170. package/dist/editor/BatchInputEditor.d.ts +0 -41
  171. package/dist/editor/BatchInputEditor.js +0 -80
  172. package/dist/editor/BatchInputEditor.js.map +0 -1
  173. package/dist/editor/CodeEditor.d.ts +0 -81
  174. package/dist/editor/CodeEditor.js +0 -213
  175. package/dist/editor/CodeEditor.js.map +0 -1
  176. package/dist/editor/CodeMirrorEditor.d.ts +0 -133
  177. package/dist/editor/CodeMirrorEditor.js +0 -169
  178. package/dist/editor/CodeMirrorEditor.js.map +0 -1
  179. package/dist/editor/DarkTheme.d.ts +0 -1
  180. package/dist/editor/DarkTheme.js +0 -72
  181. package/dist/editor/DarkTheme.js.map +0 -1
  182. package/dist/editor/DebugExtension.d.ts +0 -11
  183. package/dist/editor/DebugExtension.js +0 -70
  184. package/dist/editor/DebugExtension.js.map +0 -1
  185. package/dist/editor/Gutters.d.ts +0 -109
  186. package/dist/editor/Gutters.js +0 -201
  187. package/dist/editor/Gutters.js.map +0 -1
  188. package/dist/editor/LineEffectExtension.d.ts +0 -13
  189. package/dist/editor/LineEffectExtension.js +0 -48
  190. package/dist/editor/LineEffectExtension.js.map +0 -1
  191. package/dist/editor/TestCodeExtension.d.ts +0 -21
  192. package/dist/editor/TestCodeExtension.js +0 -134
  193. package/dist/editor/TestCodeExtension.js.map +0 -1
  194. package/dist/examples/Examples.d.ts +0 -6
  195. package/dist/examples/Examples.js +0 -23
  196. package/dist/examples/Examples.js.map +0 -1
  197. package/dist/examples/JavaScriptExamples.js.map +0 -1
  198. package/dist/examples/PythonExamples.js.map +0 -1
  199. package/dist/input/BatchInputHandler.d.ts +0 -55
  200. package/dist/input/BatchInputHandler.js +0 -131
  201. package/dist/input/BatchInputHandler.js.map +0 -1
  202. package/dist/input/InteractiveInputHandler.d.ts +0 -27
  203. package/dist/input/InteractiveInputHandler.js +0 -89
  204. package/dist/input/InteractiveInputHandler.js.map +0 -1
  205. package/dist/input/UserInputHandler.d.ts +0 -68
  206. package/dist/input/UserInputHandler.js +0 -39
  207. package/dist/input/UserInputHandler.js.map +0 -1
  208. package/dist/util/HTMLShapes.d.ts +0 -15
  209. package/dist/util/HTMLShapes.js +0 -25
  210. package/dist/util/HTMLShapes.js.map +0 -1
  211. package/dist/util/Rendering.d.ts +0 -120
  212. package/dist/util/Rendering.js +0 -142
  213. package/dist/util/Rendering.js.map +0 -1
  214. package/dist/workers/input/InputWorker.js.map +0 -1
  215. package/dist/workers/javascript/JavaScriptWorker.js.map +0 -1
  216. package/dist/workers/javascript/worker.js.map +0 -1
  217. package/dist/workers/python/PythonWorker.js.map +0 -1
  218. package/dist/workers/python/python_package.tar.gz.load_by_url +0 -0
  219. package/dist/workers/python/worker.js.map +0 -1
  220. /package/dist/{workers → backend/workers}/javascript/JavaScriptWorker.d.ts +0 -0
  221. /package/dist/{workers → backend/workers}/javascript/worker.d.ts +0 -0
  222. /package/dist/{workers → backend/workers}/javascript/worker.js +0 -0
  223. /package/dist/{workers → backend/workers}/python/worker.d.ts +0 -0
  224. /package/dist/{workers → backend/workers}/python/worker.js +0 -0
  225. /package/dist/{BackendEvent.d.ts → communication/BackendEvent.d.ts} +0 -0
  226. /package/dist/{BackendEvent.js → communication/BackendEvent.js} +0 -0
  227. /package/dist/{InputServiceWorker.d.ts → communication/InputServiceWorker.d.ts} +0 -0
  228. /package/dist/{workers/input → communication}/InputWorker.d.ts +0 -0
  229. /package/dist/{workers/input → communication}/InputWorker.js +0 -0
  230. /package/dist/{examples → frontend/components/app/examples}/JavaScriptExamples.d.ts +0 -0
  231. /package/dist/{examples → frontend/components/app/examples}/JavaScriptExamples.js +0 -0
  232. /package/dist/{examples → frontend/components/app/examples}/PythonExamples.d.ts +0 -0
  233. /package/dist/{examples → frontend/components/app/examples}/PythonExamples.js +0 -0
@@ -1,133 +0,0 @@
1
- import { Compartment, Extension } from "@codemirror/state";
2
- import { EditorView, ViewUpdate } from "@codemirror/view";
3
- import { Renderable, RenderOptions } from "../util/Rendering";
4
- import { StyleSpec } from "style-mod";
5
- /**
6
- * Data structure containing common elements for styling
7
- */
8
- export interface EditorStyling {
9
- /**
10
- * Array of HTML classes to apply to this editor
11
- */
12
- classes: Array<string>;
13
- /**
14
- * The maximum height of the editor
15
- */
16
- maxHeight: string;
17
- /**
18
- * The minimum height of the editor
19
- */
20
- minHeight: string;
21
- /**
22
- * Extra theme options to be passed to EditorView.theme
23
- */
24
- theme?: {
25
- [selectorSpec: string]: StyleSpec;
26
- };
27
- }
28
- /**
29
- * Interface for listeners to textual changes in the editor
30
- */
31
- export interface DocChangeListener {
32
- /**
33
- * Method to call with the new document value
34
- */
35
- onChange: (code: string) => void;
36
- /**
37
- * How many milliseconds should pass since the last change
38
- * before notifying (in case computations are expensive)
39
- */
40
- delay?: number;
41
- }
42
- /**
43
- * Interface for storing data related to delayed function calls
44
- */
45
- interface TimeoutData {
46
- /**
47
- * The time in ms at which the last call occurred
48
- */
49
- lastCalled: number;
50
- /**
51
- * The timeout identifier associated with the delayed call
52
- * null if not currently scheduled
53
- */
54
- timeout: NodeJS.Timeout | null;
55
- }
56
- /**
57
- * Base class for Editors implemented using CodeMirror 6
58
- * https://codemirror.net/6/
59
- */
60
- export declare abstract class CodeMirrorEditor extends Renderable {
61
- static STYLE: string;
62
- static PLACEHOLDER: string;
63
- static THEME: string;
64
- static LANGUAGE: string;
65
- /**
66
- * CodeMirror EditorView representing the internal editor
67
- */
68
- readonly editorView: EditorView;
69
- /**
70
- * Mapping of strings to Compartments associated with that property
71
- */
72
- protected compartments: Map<string, Compartment>;
73
- /**
74
- * Data to style this Editor
75
- */
76
- protected styling: EditorStyling;
77
- /**
78
- * Mapping for each change listener to its timeout identifier and last call time
79
- */
80
- protected listenerTimeouts: Map<DocChangeListener, TimeoutData>;
81
- /**
82
- * @param {Set<string>} compartments Identifiers for configurable extensions
83
- * @param {EditorStyling} styling Data to style this editor
84
- */
85
- constructor(compartments: Set<string>, styling: EditorStyling);
86
- protected onViewUpdate(v: ViewUpdate): void;
87
- /**
88
- * @param {Extension} extension The extension to add to the Editor
89
- */
90
- protected addExtension(extension: Extension): void;
91
- /**
92
- * @return {string} The text within the editor
93
- */
94
- getText(): string;
95
- /**
96
- * @param {string} text The new value to be shown in the editor
97
- */
98
- setText(text: string): void;
99
- /**
100
- * Helper method to dispatch configuration changes at runtime
101
- * @param {Array<[Option, Extension]>} items Array of items to reconfigure
102
- * The option indicates the relevant compartment
103
- * The extension indicates the new configuration
104
- */
105
- reconfigure(...items: Array<[string, Extension]>): void;
106
- /**
107
- * Apply focus to the Editor
108
- */
109
- focus(): void;
110
- /**
111
- * @param {string} placeholderValue The contents of the placeholder
112
- */
113
- setPlaceholder(placeholderValue: string): void;
114
- /**
115
- * @param {boolean} darkMode Whether to use dark mode
116
- */
117
- setDarkMode(darkMode: boolean): void;
118
- /**
119
- * Override the style used by this Editor
120
- * @param {Partial<EditorStyling>} styling Object with keys of EditorStyling to override styles
121
- */
122
- setStyling(styling: Partial<EditorStyling>): void;
123
- protected _render(options: RenderOptions): void;
124
- /**
125
- * Process the changes by informing the listeners of the new contents
126
- */
127
- private handleChange;
128
- /**
129
- * @param {DocChangeListener} changeListener Listener that performs actions on the new contents
130
- */
131
- onChange(changeListener: DocChangeListener): void;
132
- }
133
- export {};
@@ -1,169 +0,0 @@
1
- import { Compartment, EditorState, StateEffect } from "@codemirror/state";
2
- import { EditorView, placeholder } from "@codemirror/view";
3
- import { Renderable, renderWithOptions } from "../util/Rendering";
4
- import { darkTheme } from "./DarkTheme";
5
- import { CODE_MIRROR_TRANSLATIONS } from "../Translations";
6
- import { cursorDocEnd } from "@codemirror/commands";
7
- import { i18n } from "../util/Util";
8
- /**
9
- * Base class for Editors implemented using CodeMirror 6
10
- * https://codemirror.net/6/
11
- */
12
- export class CodeMirrorEditor extends Renderable {
13
- /**
14
- * @param {Set<string>} compartments Identifiers for configurable extensions
15
- * @param {EditorStyling} styling Data to style this editor
16
- */
17
- constructor(compartments, styling) {
18
- super();
19
- this.styling = styling;
20
- this.listenerTimeouts = new Map();
21
- // Ensure default compartments are present
22
- compartments.add(CodeMirrorEditor.STYLE);
23
- compartments.add(CodeMirrorEditor.PLACEHOLDER);
24
- compartments.add(CodeMirrorEditor.THEME);
25
- compartments.add(CodeMirrorEditor.LANGUAGE);
26
- this.compartments = new Map();
27
- const configurableExtensions = [];
28
- compartments.forEach(opt => {
29
- const compartment = new Compartment();
30
- this.compartments.set(opt, compartment);
31
- configurableExtensions.push(compartment.of([]));
32
- });
33
- this.editorView = new EditorView({
34
- state: EditorState.create({
35
- extensions: [
36
- configurableExtensions,
37
- EditorView.updateListener.of(this.onViewUpdate.bind(this))
38
- ]
39
- })
40
- });
41
- }
42
- onViewUpdate(v) {
43
- if (v.docChanged) {
44
- this.handleChange();
45
- }
46
- }
47
- /**
48
- * @param {Extension} extension The extension to add to the Editor
49
- */
50
- addExtension(extension) {
51
- this.editorView.dispatch({
52
- effects: StateEffect.appendConfig.of(extension)
53
- });
54
- }
55
- /**
56
- * @return {string} The text within the editor
57
- */
58
- getText() {
59
- return this.editorView.state.doc.toString();
60
- }
61
- /**
62
- * @param {string} text The new value to be shown in the editor
63
- */
64
- setText(text) {
65
- this.editorView.dispatch({ changes: { from: 0, to: this.getText().length, insert: text } });
66
- }
67
- /**
68
- * Helper method to dispatch configuration changes at runtime
69
- * @param {Array<[Option, Extension]>} items Array of items to reconfigure
70
- * The option indicates the relevant compartment
71
- * The extension indicates the new configuration
72
- */
73
- reconfigure(...items) {
74
- this.editorView.dispatch({
75
- effects: items.map(([opt, ext]) => this.compartments.get(opt).reconfigure(ext))
76
- });
77
- }
78
- /**
79
- * Apply focus to the Editor
80
- */
81
- focus() {
82
- this.editorView.focus();
83
- cursorDocEnd(this.editorView);
84
- }
85
- /**
86
- * @param {string} placeholderValue The contents of the placeholder
87
- */
88
- setPlaceholder(placeholderValue) {
89
- this.reconfigure([
90
- CodeMirrorEditor.PLACEHOLDER,
91
- placeholder(placeholderValue)
92
- ]);
93
- }
94
- /**
95
- * @param {boolean} darkMode Whether to use dark mode
96
- */
97
- setDarkMode(darkMode) {
98
- let styleExtensions = [];
99
- if (darkMode) {
100
- styleExtensions = [darkTheme];
101
- }
102
- this.reconfigure([CodeMirrorEditor.STYLE, styleExtensions]);
103
- }
104
- /**
105
- * Override the style used by this Editor
106
- * @param {Partial<EditorStyling>} styling Object with keys of EditorStyling to override styles
107
- */
108
- setStyling(styling) {
109
- Object.assign(this.styling, styling);
110
- this.reconfigure([
111
- CodeMirrorEditor.THEME,
112
- EditorView.theme(Object.assign({ ".cm-scroller": { overflow: "auto" }, "&": {
113
- "maxHeight": this.styling.maxHeight, "height": "100%",
114
- "font-size": "14px" // use proper size to align gutters with editor
115
- }, ".cm-gutter,.cm-content": { minHeight: this.styling.minHeight }, ".cm-button": {
116
- "background-color": "#455A64",
117
- "color": "white", "background-image": "none"
118
- } }, (this.styling.theme || {})))
119
- ]);
120
- }
121
- _render(options) {
122
- this.setStyling(this.styling);
123
- this.setDarkMode(options.darkMode || false);
124
- const language = i18n.locale;
125
- this.reconfigure([
126
- CodeMirrorEditor.LANGUAGE,
127
- EditorState.phrases.of(CODE_MIRROR_TRANSLATIONS[language])
128
- ]);
129
- const wrappingDiv = document.createElement("div");
130
- wrappingDiv.classList.add(...this.styling.classes);
131
- wrappingDiv.replaceChildren(this.editorView.dom);
132
- renderWithOptions(options, wrappingDiv);
133
- }
134
- /**
135
- * Process the changes by informing the listeners of the new contents
136
- */
137
- handleChange() {
138
- const currentDoc = this.getText();
139
- const now = Date.now();
140
- this.listenerTimeouts.forEach((timeoutData, listener) => {
141
- // Clear existing scheduled calls
142
- if (timeoutData.timeout !== null) {
143
- clearTimeout(timeoutData.timeout);
144
- }
145
- timeoutData.lastCalled = now;
146
- if (listener.delay && listener.delay > 0) {
147
- timeoutData.timeout = setTimeout(() => {
148
- timeoutData.timeout = null;
149
- listener.onChange(currentDoc);
150
- }, listener.delay);
151
- }
152
- else {
153
- listener.onChange(currentDoc);
154
- }
155
- timeoutData.lastCalled = now;
156
- });
157
- }
158
- /**
159
- * @param {DocChangeListener} changeListener Listener that performs actions on the new contents
160
- */
161
- onChange(changeListener) {
162
- this.listenerTimeouts.set(changeListener, { timeout: null, lastCalled: 0 });
163
- }
164
- }
165
- CodeMirrorEditor.STYLE = "style";
166
- CodeMirrorEditor.PLACEHOLDER = "placeholder";
167
- CodeMirrorEditor.THEME = "theme";
168
- CodeMirrorEditor.LANGUAGE = "language";
169
- //# sourceMappingURL=CodeMirrorEditor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CodeMirrorEditor.js","sourceRoot":"","sources":["../../src/editor/CodeMirrorEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAa,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAc,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,UAAU,EAAiB,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEjF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAyDpC;;;GAGG;AACH,MAAM,OAAgB,gBAAiB,SAAQ,UAAU;IAsBrD;;;OAGG;IACH,YAAY,YAAyB,EAAE,OAAsB;QACzD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,gBAAgB,GAAG,IAAI,GAAG,EAAE,CAAC;QAClC,0CAA0C;QAC1C,YAAY,CAAC,GAAG,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QACzC,YAAY,CAAC,GAAG,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QAC/C,YAAY,CAAC,GAAG,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QACzC,YAAY,CAAC,GAAG,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAC5C,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;QAC9B,MAAM,sBAAsB,GAAqB,EAAE,C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W,CAAC,UAAU,GAAG,GAAG,CAAC;YAC7B,IAAI,QAAQ,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;gBACvC,WAAW,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;oBAClC,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC;oBAC3B,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;gBAClC,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC;YACvB,CAAC;iBAAM,CAAC;gBACJ,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YAClC,CAAC;YACD,WAAW,CAAC,UAAU,GAAG,GAAG,CAAC;QACjC,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACI,QAAQ,CAAC,cAAiC;QAC7C,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,cAAc,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;IAChF,CAAC;;AA9La,sBAAK,GAAG,OAAO,CAAC;AAChB,4BAAW,GAAG,aAAa,CAAC;AAC5B,sBAAK,GAAG,OAAO,CAAC;AAChB,yBAAQ,GAAG,UAAU,CAAC"}
@@ -1 +0,0 @@
1
- export declare const darkTheme: import("@codemirror/state").Extension;
@@ -1,72 +0,0 @@
1
- // Based on https://github.com/codemirror/theme-one-dark/blob/main/src/one-dark.ts with slight edits
2
- import { EditorView } from "@codemirror/view";
3
- // Using https://github.com/one-dark/vscode-one-dark-theme/ as reference for the colors
4
- const ivory = "#abb2bf";
5
- const stone = "#7d8799"; // Brightened compared to original to increase contrast
6
- const darkBackground = "#21252b";
7
- const highlightBackground = "#2c313a";
8
- const background = "#282c34";
9
- const tooltipBackground = "#353a42";
10
- const selection = "#3E4451";
11
- const cursor = "#528bff";
12
- // / The editor theme styles
13
- export const darkTheme = EditorView.theme({
14
- "&": {
15
- color: ivory,
16
- backgroundColor: background
17
- },
18
- ".cm-content": {
19
- caretColor: cursor
20
- },
21
- ".cm-cursor, .cm-dropCursor": { borderLeftColor: cursor },
22
- "&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: selection },
23
- ".cm-panels": { backgroundColor: darkBackground, color: ivory },
24
- ".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
25
- ".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
26
- ".cm-searchMatch": {
27
- backgroundColor: "#72a1ff59",
28
- outline: "1px solid #457dff"
29
- },
30
- ".cm-searchMatch.cm-searchMatch-selected": {
31
- backgroundColor: "#6199ff2f"
32
- },
33
- ".cm-activeLine": { backgroundColor: highlightBackground },
34
- ".cm-selectionMatch": { backgroundColor: "#aafe661a" },
35
- "&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket": {
36
- backgroundColor: "#bad0f847",
37
- outline: "1px solid #515a6b"
38
- },
39
- ".cm-gutters": {
40
- // make gutters darker
41
- backgroundColor: darkBackground,
42
- color: stone,
43
- border: "none"
44
- },
45
- ".cm-activeLineGutter": {
46
- backgroundColor: highlightBackground
47
- },
48
- ".cm-foldPlaceholder": {
49
- backgroundColor: "transparent",
50
- border: "none",
51
- color: "#ddd"
52
- },
53
- ".cm-tooltip": {
54
- border: "none",
55
- backgroundColor: tooltipBackground
56
- },
57
- ".cm-tooltip .cm-tooltip-arrow:before": {
58
- borderTopColor: "transparent",
59
- borderBottomColor: "transparent"
60
- },
61
- ".cm-tooltip .cm-tooltip-arrow:after": {
62
- borderTopColor: tooltipBackground,
63
- borderBottomColor: tooltipBackground
64
- },
65
- ".cm-tooltip-autocomplete": {
66
- "& > ul > li[aria-selected]": {
67
- backgroundColor: highlightBackground,
68
- color: ivory
69
- }
70
- }
71
- }, { dark: true });
72
- //# sourceMappingURL=DarkTheme.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DarkTheme.js","sourceRoot":"","sources":["../../src/editor/DarkTheme.ts"],"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AAe,EAAE,cAAc;QAC/B,KAAK,EAAE,KAAK;QACZ,MAAM,EAAE,MAAM;KACjB;IAED,sBAAsB,EAAE;QACpB,eAAe,EAAE,mBAAmB;KACvC;IAED,qBAAqB,EAAE;QACnB,eAAe,EAAE,aAAa;QAC9B,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,MAAM;KAChB;IAED,aAAa,EAAE;QACX,MAAM,EAAE,MAAM;QACd,eAAe,EAAE,iBAAiB;KACrC;IACD,sCAAsC,EAAE;QACpC,cAAc,EAAE,aAAa;QAC7B,iBAAiB,EAAE,aAAa;KACnC;IACD,qCAAqC,EAAE;QACnC,cAAc,EAAE,iBAAiB;QACjC,iBAAiB,EAAE,iBAAiB;KACvC;IACD,0BAA0B,EAAE;QACxB,4BAA4B,EAAE;YAC1B,eAAe,EAAE,mBAAmB;YACpC,KAAK,EAAE,KAAK;SACf;KACJ;CACJ,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- import { EditorView } from "@codemirror/view";
2
- import { Extension } from "@codemirror/state";
3
- export declare class DebugExtension {
4
- private readonly view;
5
- private gutter;
6
- private lineEffect;
7
- constructor(view: EditorView);
8
- reset(): void;
9
- markLine(lineNr: number | undefined): void;
10
- toExtension(): Extension;
11
- }
@@ -1,70 +0,0 @@
1
- import { Decoration, EditorView, gutterLineClass, GutterMarker } from "@codemirror/view";
2
- import { LineEffectExtension } from "./LineEffectExtension";
3
- import { DebugLineGutter } from "./Gutters";
4
- import { RangeSet, StateEffect, StateField } from "@codemirror/state";
5
- import { BackendManager } from "../BackendManager";
6
- import { BackendEventType } from "../BackendEvent";
7
- const activeLineDecoration = Decoration.line({ class: "cm-activeLine" });
8
- const activeLineGutterMarker = new class extends GutterMarker {
9
- constructor() {
10
- super(...arguments);
11
- this.elementClass = "cm-activeLineGutter";
12
- }
13
- };
14
- const markLine = StateEffect.define();
15
- const markedLine = StateField.define({
16
- create: () => undefined,
17
- update(value, tr) {
18
- for (const effect of tr.effects) {
19
- if (effect.is(markLine)) {
20
- return effect.value;
21
- }
22
- }
23
- return value;
24
- }
25
- });
26
- const markedLineGutterHighlighter = gutterLineClass.compute([markedLine], state => {
27
- if (state.field(markedLine) === undefined) {
28
- return RangeSet.empty;
29
- }
30
- const linePos = state.doc.line(state.field(markedLine)).from;
31
- return RangeSet.of([activeLineGutterMarker.range(linePos)]);
32
- });
33
- export class DebugExtension {
34
- constructor(view) {
35
- this.view = view;
36
- this.gutter = new DebugLineGutter();
37
- this.lineEffect = new LineEffectExtension(view);
38
- BackendManager.subscribe(BackendEventType.FrameChange, e => {
39
- const line = e.data.line;
40
- this.markLine(line);
41
- });
42
- }
43
- reset() {
44
- this.markLine(1);
45
- }
46
- markLine(lineNr) {
47
- if (lineNr === undefined) {
48
- this.gutter.markLine(this.view, lineNr);
49
- this.lineEffect.set([]);
50
- this.view.dispatch({ effects: [markLine.of(undefined)] });
51
- return;
52
- }
53
- this.gutter.markLine(this.view, lineNr);
54
- this.lineEffect.set([activeLineDecoration.range(this.view.state.doc.line(lineNr).from)]);
55
- this.view.dispatch({ effects: [
56
- markLine.of(lineNr),
57
- EditorView.scrollIntoView(this.view.state.doc.line(lineNr).from)
58
- ] });
59
- }
60
- toExtension() {
61
- return [
62
- this.lineEffect.toExtension(),
63
- this.gutter.toExtension(),
64
- markedLine,
65
- markedLineGutterHighlighter,
66
- EditorView.editable.of(false)
67
- ];
68
- }
69
- }
70
- //# sourceMappingURL=DebugExtension.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DebugExtension.js","sourceRoot":"","sources":["../../src/editor/DebugExtension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EA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Q,CAAC,EAAE,CAAC,MAAM,CAAC;gBACnB,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;aACnE,EAAE,CAAC,CAAC;IACT,CAAC;IAEM,WAAW;QACd,OAAO;YACH,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE;YAC7B,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE;YACzB,UAAU;YACV,2BAA2B;YAC3B,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC;SAChC,CAAC;IACN,CAAC;CACJ"}
@@ -1,109 +0,0 @@
1
- import { StateEffectType, StateField } from "@codemirror/state";
2
- import { Extension } from "@codemirror/state";
3
- import { GutterMarker } from "@codemirror/view";
4
- import { EditorView } from "@codemirror/view";
5
- /**
6
- * Data used in Gutter elements
7
- */
8
- export interface GutterInfo {
9
- /**
10
- * The number of the line (1-based)
11
- */
12
- lineNr: number;
13
- /**
14
- * Whether the Gutter element should be shown
15
- */
16
- on: boolean;
17
- }
18
- /**
19
- * Configuration for Gutters
20
- */
21
- export interface IGutterConfig<Info extends GutterInfo> {
22
- /**
23
- * Name of this Gutter
24
- */
25
- name: string;
26
- /**
27
- * HTML class names for the marker icons
28
- */
29
- markerClasses?: string;
30
- /**
31
- * Handler for when a Gutter element is clicked
32
- */
33
- onClick?: (view: EditorView, info: Info) => void;
34
- /**
35
- * Extra extensions to use for the Gutters
36
- */
37
- extraExtensions?: Extension;
38
- }
39
- export declare abstract class Gutters<Info extends GutterInfo = GutterInfo, Config extends IGutterConfig<Info> = IGutterConfig<Info>> {
40
- /**
41
- * Config used to initialize the Gutters
42
- */
43
- protected config: Config;
44
- /**
45
- * Effect to signal changes in the Gutters
46
- */
47
- protected effect: StateEffectType<Info>;
48
- /**
49
- * Current state of the Gutters
50
- * Consists of a mapping for line numbers to Info objects
51
- */
52
- protected state: StateField<Map<number, Info>>;
53
- constructor(config: Config);
54
- /**
55
- * Render a marker with the given info
56
- * @param {Info} info Info used to render the marker
57
- * Will only be called when info.on is True
58
- */
59
- protected abstract marker(info: Info): GutterMarker;
60
- private applyClasses;
61
- hasMarker(view: EditorView, lineNr: number): boolean;
62
- /**
63
- * Set a marker with the given info
64
- * @param {EditorView} view View in which the Gutters live
65
- * @param {Info} info Info used to render the marker
66
- */
67
- setMarker(view: EditorView, info: Info): void;
68
- /**
69
- * @param {EditorView} view The view in which the Gutters live
70
- * @return {Set<number>} The 1-based line numbers with a breakpoint
71
- */
72
- getMarkedLines(view: EditorView): Set<number>;
73
- /**
74
- * @return {Extension} The Gutters as a CodeMirror Extension
75
- */
76
- toExtension(): Extension;
77
- }
78
- /**
79
- * Gutters to show and allow toggling of breakpoints
80
- */
81
- export declare class BreakpointsGutter extends Gutters {
82
- constructor();
83
- protected marker(): GutterMarker;
84
- }
85
- /**
86
- * Extra data used to represent input gutters
87
- */
88
- export interface UsedInputGutterInfo extends GutterInfo {
89
- /**
90
- * Text value to display when hovering over the Gutter element
91
- */
92
- title: string;
93
- }
94
- /**
95
- * Gutters to show a checkmark for used input
96
- */
97
- export declare class UsedInputGutters extends Gutters<UsedInputGutterInfo> {
98
- constructor();
99
- protected marker(info: UsedInputGutterInfo): GutterMarker;
100
- }
101
- /**
102
- * shows the debugged line
103
- */
104
- export declare class DebugLineGutter extends Gutters<GutterInfo> {
105
- private activeLine;
106
- constructor();
107
- protected marker(): GutterMarker;
108
- markLine(view: EditorView, lineNr: number | undefined): void;
109
- }