@dodona/papyros 0.5.1 → 1.0.0

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.
@@ -0,0 +1,201 @@
1
+ export namespace TRANSLATIONS {
2
+ namespace en {
3
+ export { ENGLISH_TRANSLATION as Papyros };
4
+ }
5
+ namespace nl {
6
+ export { DUTCH_TRANSLATION as Papyros };
7
+ }
8
+ }
9
+ export namespace CODE_MIRROR_TRANSLATIONS {
10
+ export { ENGLISH_PHRASES as en };
11
+ export { DUTCH_PHRASES as nl };
12
+ }
13
+ declare namespace ENGLISH_TRANSLATION {
14
+ export const Papyros: string;
15
+ export const code: string;
16
+ export const code_placeholder: string;
17
+ export const input: string;
18
+ export namespace input_placeholder {
19
+ const interactive: string;
20
+ const batch: string;
21
+ }
22
+ export const input_disabled: string;
23
+ export const output: string;
24
+ export const output_placeholder: string;
25
+ export const run: string;
26
+ export const stop: string;
27
+ export const finished: string;
28
+ export const interrupted: string;
29
+ export namespace states {
30
+ const running: string;
31
+ const stopping: string;
32
+ const loading: string;
33
+ const awaiting_input: string;
34
+ const ready: string;
35
+ }
36
+ export const programming_language: string;
37
+ export namespace programming_languages {
38
+ const Python: string;
39
+ const JavaScript: string;
40
+ }
41
+ export namespace locales {
42
+ const en_1: string;
43
+ export { en_1 as en };
44
+ const nl_1: string;
45
+ export { nl_1 as nl };
46
+ }
47
+ export namespace switch_input_mode_to {
48
+ const interactive_1: string;
49
+ export { interactive_1 as interactive };
50
+ const batch_1: string;
51
+ export { batch_1 as batch };
52
+ }
53
+ export const enter: string;
54
+ export const examples: string;
55
+ export const dark_mode: string;
56
+ export const output_overflow: string;
57
+ export const output_overflow_download: string;
58
+ export const no_output: string;
59
+ export const service_worker_error: string;
60
+ export const launch_error: string;
61
+ const loading_1: string;
62
+ export { loading_1 as loading };
63
+ export namespace run_modes {
64
+ const doctest: string;
65
+ }
66
+ export const used_input: string;
67
+ export const used_input_with_prompt: string;
68
+ }
69
+ declare namespace DUTCH_TRANSLATION {
70
+ const Papyros_1: string;
71
+ export { Papyros_1 as Papyros };
72
+ const code_1: string;
73
+ export { code_1 as code };
74
+ const code_placeholder_1: string;
75
+ export { code_placeholder_1 as code_placeholder };
76
+ const input_1: string;
77
+ export { input_1 as input };
78
+ export namespace input_placeholder_1 {
79
+ const interactive_2: string;
80
+ export { interactive_2 as interactive };
81
+ const batch_2: string;
82
+ export { batch_2 as batch };
83
+ }
84
+ export { input_placeholder_1 as input_placeholder };
85
+ const input_disabled_1: string;
86
+ export { input_disabled_1 as input_disabled };
87
+ const output_1: string;
88
+ export { output_1 as output };
89
+ const output_placeholder_1: string;
90
+ export { output_placeholder_1 as output_placeholder };
91
+ const run_1: string;
92
+ export { run_1 as run };
93
+ const stop_1: string;
94
+ export { stop_1 as stop };
95
+ export namespace states_1 {
96
+ const running_1: string;
97
+ export { running_1 as running };
98
+ const stopping_1: string;
99
+ export { stopping_1 as stopping };
100
+ const loading_2: string;
101
+ export { loading_2 as loading };
102
+ const awaiting_input_1: string;
103
+ export { awaiting_input_1 as awaiting_input };
104
+ const ready_1: string;
105
+ export { ready_1 as ready };
106
+ }
107
+ export { states_1 as states };
108
+ const finished_1: string;
109
+ export { finished_1 as finished };
110
+ const interrupted_1: string;
111
+ export { interrupted_1 as interrupted };
112
+ const programming_language_1: string;
113
+ export { programming_language_1 as programming_language };
114
+ export namespace programming_languages_1 {
115
+ const Python_1: string;
116
+ export { Python_1 as Python };
117
+ const JavaScript_1: string;
118
+ export { JavaScript_1 as JavaScript };
119
+ }
120
+ export { programming_languages_1 as programming_languages };
121
+ export namespace locales_1 {
122
+ const en_2: string;
123
+ export { en_2 as en };
124
+ const nl_2: string;
125
+ export { nl_2 as nl };
126
+ }
127
+ export { locales_1 as locales };
128
+ export namespace switch_input_mode_to_1 {
129
+ const interactive_3: string;
130
+ export { interactive_3 as interactive };
131
+ const batch_3: string;
132
+ export { batch_3 as batch };
133
+ }
134
+ export { switch_input_mode_to_1 as switch_input_mode_to };
135
+ const enter_1: string;
136
+ export { enter_1 as enter };
137
+ const examples_1: string;
138
+ export { examples_1 as examples };
139
+ const dark_mode_1: string;
140
+ export { dark_mode_1 as dark_mode };
141
+ const output_overflow_1: string;
142
+ export { output_overflow_1 as output_overflow };
143
+ const output_overflow_download_1: string;
144
+ export { output_overflow_download_1 as output_overflow_download };
145
+ const no_output_1: string;
146
+ export { no_output_1 as no_output };
147
+ const service_worker_error_1: string;
148
+ export { service_worker_error_1 as service_worker_error };
149
+ const launch_error_1: string;
150
+ export { launch_error_1 as launch_error };
151
+ const loading_3: string;
152
+ export { loading_3 as loading };
153
+ export namespace run_modes_1 {
154
+ const doctest_1: string;
155
+ export { doctest_1 as doctest };
156
+ }
157
+ export { run_modes_1 as run_modes };
158
+ const used_input_1: string;
159
+ export { used_input_1 as used_input };
160
+ const used_input_with_prompt_1: string;
161
+ export { used_input_with_prompt_1 as used_input_with_prompt };
162
+ }
163
+ declare const ENGLISH_PHRASES: {
164
+ "Go to line": string;
165
+ go: string;
166
+ Find: string;
167
+ Replace: string;
168
+ next: string;
169
+ previous: string;
170
+ all: string;
171
+ "match case": string;
172
+ replace: string;
173
+ "replace all": string;
174
+ close: string;
175
+ };
176
+ declare const DUTCH_PHRASES: {
177
+ "Control character": string;
178
+ "Folded lines": string;
179
+ "Unfolded lines": string;
180
+ to: string;
181
+ "folded code": string;
182
+ unfold: string;
183
+ "Fold line": string;
184
+ "Unfold line": string;
185
+ "Go to line": string;
186
+ go: string;
187
+ Find: string;
188
+ Replace: string;
189
+ next: string;
190
+ previous: string;
191
+ all: string;
192
+ "match case": string;
193
+ replace: string;
194
+ "replace all": string;
195
+ close: string;
196
+ "current match": string;
197
+ "on line": string;
198
+ Diagnostics: string;
199
+ "No diagnostics": string;
200
+ };
201
+ export {};
@@ -10,4 +10,5 @@ export declare const PYTHON_EXAMPLES: {
10
10
  Matplotlib: string;
11
11
  Sleep: string;
12
12
  Overflow: string;
13
+ Interrupt: string;
13
14
  };
@@ -0,0 +1 @@
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Papyros=t():e.Papyros=t()}(self,(()=>(()=>{var e={137:e=>{self,e.exports=(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{isServiceWorkerRequest:()=>s,serviceWorkerFetchListener:()=>i,asyncSleep:()=>u,ServiceWorkerError:()=>c,writeMessageAtomics:()=>a,writeMessageServiceWorker:()=>f,writeMessage:()=>d,makeChannel:()=>l,makeAtomicsChannel:()=>y,makeServiceWorkerChannel:()=>p,readMessage:()=>h,syncSleep:()=>v,uuidv4:()=>g});var r=function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{c(n.next(e))}catch(e){s(e)}}function u(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,u)}c((n=n.apply(e,t||[])).next())}))};const n="__SyncMessageServiceWorkerInput__",o="__sync-message-v2__";function s(e){return"string"!=typeof e&&(e=e.request.url),e.includes(n)}function i(){const e={},t={};return n=>{const{url:i}=n.request;return!!s(i)&&(n.respondWith(function(){return r(this,void 0,void 0,(function*(){function r(e){const t={message:e,version:o};return new Response(JSON.stringify(t),{status:200})}if(i.endsWith("/read")){const{messageId:o,timeout:s}=yield n.request.json(),i=e[o];return i?(delete e[o],r(i)):yield new Promise((e=>{t[o]=e,setTimeout((function(){delete t[o],e(new Response("",{status:408}))}),s)}))}if(i.endsWith("/write")){const{message:o,messageId:s}=yield n.request.json(),i=t[s];return i?(i(r(o)),delete t[s]):e[s]=o,r({early:!i})}if(i.endsWith("/version"))return new Response(o,{status:200})}))}()),!0)}}function u(e){return new Promise((t=>setTimeout(t,e)))}class c extends Error{constructor(e,t){super(`Received status ${t} from ${e}. Ensure the service worker is registered and active.`),this.url=e,this.status=t,this.type="ServiceWorkerError",Object.setPrototypeOf(this,c.prototype)}}function a(e,t){const r=(new TextEncoder).encode(JSON.stringify(t)),{data:n,meta:o}=e;if(r.length>n.length)throw new Error("Message is too big, increase bufferSize when making channel.");n.set(r,0),Atomics.store(o,0,r.length),Atomics.store(o,1,1),Atomics.notify(o,1)}function f(e,t,n){return r(this,void 0,void 0,(function*(){yield navigator.serviceWorker.ready;const r=e.baseUrl+"/write",s=Date.now();for(;;){const i={message:t,messageId:n},a=yield fetch(r,{method:"POST",body:JSON.stringify(i)});if(200===a.status&&(yield a.json()).version===o)return;if(!(Date.now()-s<e.timeout))throw new c(r,a.status);yield u(100)}}))}function d(e,t,n){return r(this,void 0,void 0,(function*(){"atomics"===e.type?a(e,t):yield f(e,t,n)}))}function l(e={}){return"undefined"!=typeof SharedArrayBuffer?y(e.atomics):"serviceWorker"in navigator?p(e.serviceWorker):null}function y({bufferSize:e}={}){return{type:"atomics",data:new Uint8Array(new SharedArrayBuffer(e||131072)),meta:new Int32Array(new SharedArrayBuffer(2*Int32Array.BYTES_PER_ELEMENT))}}function p(e={}){return{type:"serviceWorker",baseUrl:(e.scope||"/")+n,timeout:e.timeout||5e3}}function m(e,t){return e>0?+e:t}function h(e,t,{checkInterrupt:r,checkTimeout:n,timeout:s}={}){const i=performance.now();n=m(n,r?100:5e3);const u=m(s,Number.POSITIVE_INFINITY);let a;if("atomics"===e.type){const{data:t,meta:r}=e;a=()=>{if("timed-out"===Atomics.wait(r,1,0,n))return null;{const e=Atomics.exchange(r,0,0),n=t.slice(0,e);Atomics.store(r,1,0);const o=(new TextDecoder).decode(n);return JSON.parse(o)}}}else a=()=>{const r=new XMLHttpRequest,s=e.baseUrl+"/read";r.open("POST",s,!1);const u={messageId:t,timeout:n};r.send(JSON.stringify(u));const{status:a}=r;if(408===a)return null;if(200===a){const e=JSON.parse(r.responseText);return e.version!==o?null:e.message}if(performance.now()-i<e.timeout)return null;throw new c(s,a)};for(;;){const e=u-(performance.now()-i);if(e<=0)return null;n=Math.min(n,e);const t=a();if(null!==t)return t;if(null==r?void 0:r())return null}}function v(e,t){if(e=m(e,0))if("undefined"!=typeof SharedArrayBuffer){const t=new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));t[0]=0,Atomics.wait(t,0,0,e)}else h(t,`sleep ${e} ${g()}`,{timeout:e})}let g;return g="randomUUID"in crypto?function(){return crypto.randomUUID()}:function(){return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(e=>{const t=Number(e);return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)}))},t})()}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{InputWorker:()=>o});var e=r(137),t=function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{c(n.next(e))}catch(e){s(e)}}function u(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,u)}c((n=n.apply(e,t||[])).next())}))};class o{constructor(t=""){this.hostName=t,this.syncMessageListener=(0,e.serviceWorkerFetchListener)()}handleInputRequest(e){return t(this,void 0,void 0,(function*(){if(this.syncMessageListener(e))return!0;const t=e.request.url;return!(!this.hostName||!t.includes(this.hostName))&&(e.respondWith(fetch(e.request).then((e=>{const t=new Headers(e.headers);t.set("Cross-Origin-Embedder-Policy","require-corp"),t.set("Cross-Origin-Opener-Policy","same-origin"),t.set("Cross-Origin-Resource-Policy","cross-origin");return new Response(e.body,{status:e.status||200,statusText:e.statusText,headers:t})}))),!0)}))}}})(),n})()));
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@dodona/papyros",
3
- "version": "0.5.1",
3
+ "version": "1.0.0",
4
4
  "private": false,
5
- "homepage": "https://papyros.dodona.be/",
5
+ "homepage": ".",
6
6
  "devDependencies": {
7
7
  "@types/escape-html": "^1.0.1",
8
8
  "@types/i18n-js": "^3.8.2",
9
9
  "@types/jest": "27.4.1",
10
- "@types/serviceworker": "^0.0.46",
11
- "@typescript-eslint/eslint-plugin": "^5.21.0",
12
- "@typescript-eslint/parser": "^5.21.0",
10
+ "@types/serviceworker": "^0.0.47",
11
+ "@typescript-eslint/eslint-plugin": "^5.29.0",
12
+ "@typescript-eslint/parser": "^5.29.0",
13
13
  "autoprefixer": "^10.4.0",
14
14
  "css-loader": "^6.5.1",
15
- "eslint": "^8.15.0",
15
+ "eslint": "^8.18.0",
16
16
  "eslint-config-google": "^0.14.0",
17
17
  "eslint-plugin-jest": "^26.1.5",
18
18
  "i18n-extract": "^0.6.7",
@@ -21,28 +21,29 @@
21
21
  "postcss-import": "^14.0.2",
22
22
  "postcss-loader": "^7.0.0",
23
23
  "style-loader": "^3.3.1",
24
- "tailwindcss": "^3.0.24",
24
+ "tailwindcss": "^3.1.4",
25
25
  "terser-webpack-plugin": "^5.3.1",
26
26
  "ts-jest": "^27.1.4",
27
27
  "ts-loader": "^9.2.6",
28
- "typescript": "^4.6.4",
28
+ "typescript": "^4.7.4",
29
29
  "url-loader": "^4.1.1",
30
30
  "webpack": "^5.70.0",
31
- "webpack-cli": "^4.9.2",
32
- "webpack-dev-server": "^4.7.4",
31
+ "webpack-cli": "^4.10.0",
32
+ "webpack-dev-server": "^4.9.2",
33
33
  "worker-loader": "^3.0.8"
34
34
  },
35
35
  "dependencies": {
36
- "@codemirror/autocomplete": "^0.20.0",
37
- "@codemirror/commands": "^0.20.0",
38
- "@codemirror/lang-javascript": "^0.20.0",
39
- "@codemirror/lang-python": "^0.20.0",
40
- "@codemirror/language": "^0.20.0",
41
- "@codemirror/lint": "^0.20.2",
42
- "@codemirror/search": "^0.20.1",
43
- "@codemirror/state": "^0.20.0",
44
- "@codemirror/theme-one-dark": "^0.20.0",
45
- "@codemirror/view": "^0.20.3",
36
+ "@codemirror/autocomplete": "^6.0.2",
37
+ "@codemirror/commands": "^6.0.0",
38
+ "@codemirror/lang-javascript": "^6.0.0",
39
+ "@codemirror/lang-python": "^6.0.0",
40
+ "@codemirror/language": "^6.1.0",
41
+ "@codemirror/lint": "^6.0.0",
42
+ "@codemirror/search": "^6.0.0",
43
+ "@codemirror/state": "^6.0.1",
44
+ "@codemirror/theme-one-dark": "^6.0.0",
45
+ "@codemirror/view": "^6.0.2",
46
+ "@lezer/common": "^1.0.0",
46
47
  "comlink": "^4.3.1",
47
48
  "comsync": "^0.0.8",
48
49
  "escape-html": "^1.0.3",