@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.
- package/dist/CodeEditor.d.ts +10 -12
- package/dist/CodeRunner.d.ts +18 -10
- package/dist/Constants.d.ts +1 -0
- package/dist/InputManager.d.ts +3 -4
- package/dist/Library.js +1 -1
- package/dist/OutputManager.d.ts +7 -9
- package/dist/Papyros.d.ts +15 -7
- package/dist/input/BatchInputHandler.d.ts +2 -2
- package/dist/input/InteractiveInputHandler.d.ts +2 -2
- package/dist/input/UserInputHandler.d.ts +2 -8
- package/dist/util/Rendering.d.ts +108 -0
- package/dist/util/Util.d.ts +6 -72
- package/dist/workers/input/InputWorker.js +1 -1
- package/package.json +3 -2
package/dist/OutputManager.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BackendEvent } from "./BackendEvent";
|
|
2
|
-
import { RenderOptions } from "./util/
|
|
2
|
+
import { Renderable, RenderOptions } from "./util/Rendering";
|
|
3
3
|
/**
|
|
4
4
|
* Shape of Error objects that are easy to interpret
|
|
5
5
|
*/
|
|
@@ -32,8 +32,11 @@ export interface FriendlyError {
|
|
|
32
32
|
/**
|
|
33
33
|
* Component for displaying code output or errors to the user
|
|
34
34
|
*/
|
|
35
|
-
export declare class OutputManager {
|
|
36
|
-
|
|
35
|
+
export declare class OutputManager extends Renderable {
|
|
36
|
+
/**
|
|
37
|
+
* Store the HTML that is rendered to restore when changing language/theme
|
|
38
|
+
*/
|
|
39
|
+
private content;
|
|
37
40
|
constructor();
|
|
38
41
|
/**
|
|
39
42
|
* Retrieve the parent element containing all output parts
|
|
@@ -62,12 +65,7 @@ export declare class OutputManager {
|
|
|
62
65
|
* @param {BackendEvent} error Event containing the error data
|
|
63
66
|
*/
|
|
64
67
|
showError(error: BackendEvent): void;
|
|
65
|
-
|
|
66
|
-
* Render the OutputManager with the given options
|
|
67
|
-
* @param {RenderOptions} options Options for rendering
|
|
68
|
-
* @return {HTMLElement} The rendered output area
|
|
69
|
-
*/
|
|
70
|
-
render(options: RenderOptions): HTMLElement;
|
|
68
|
+
protected _render(options: RenderOptions): void;
|
|
71
69
|
/**
|
|
72
70
|
* Clear the contents of the output area
|
|
73
71
|
*/
|
package/dist/Papyros.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "./Papyros.css";
|
|
2
2
|
import { InputMode } from "./InputManager";
|
|
3
3
|
import { ProgrammingLanguage } from "./ProgrammingLanguage";
|
|
4
|
-
import { RenderOptions, ButtonOptions } from "./util/Util";
|
|
5
4
|
import { RunState, CodeRunner } from "./CodeRunner";
|
|
6
5
|
import { OutputManager } from "./OutputManager";
|
|
6
|
+
import { RenderOptions, ButtonOptions, Renderable } from "./util/Rendering";
|
|
7
7
|
/**
|
|
8
8
|
* Configuration options for this instance of Papyros
|
|
9
9
|
*/
|
|
@@ -49,11 +49,15 @@ interface PapyrosRenderOptions {
|
|
|
49
49
|
* RenderOptions for the output field
|
|
50
50
|
*/
|
|
51
51
|
outputOptions?: RenderOptions;
|
|
52
|
+
/**
|
|
53
|
+
* Whether to render in dark mode
|
|
54
|
+
*/
|
|
55
|
+
darkMode?: boolean;
|
|
52
56
|
}
|
|
53
57
|
/**
|
|
54
58
|
* Class that manages multiple components to form a coding scratchpad
|
|
55
59
|
*/
|
|
56
|
-
export declare class Papyros {
|
|
60
|
+
export declare class Papyros extends Renderable<PapyrosRenderOptions> {
|
|
57
61
|
/**
|
|
58
62
|
* Config used to initialize Papyros
|
|
59
63
|
*/
|
|
@@ -89,6 +93,14 @@ export declare class Papyros {
|
|
|
89
93
|
* @param {ProgrammingLanguage} programmingLanguage The language to use
|
|
90
94
|
*/
|
|
91
95
|
setProgrammingLanguage(programmingLanguage: ProgrammingLanguage): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* @param {string} locale The locale to use
|
|
98
|
+
*/
|
|
99
|
+
setLocale(locale: string): void;
|
|
100
|
+
/**
|
|
101
|
+
* @param {boolean} darkMode Whether to use dark mode
|
|
102
|
+
*/
|
|
103
|
+
setDarkMode(darkMode: boolean): void;
|
|
92
104
|
/**
|
|
93
105
|
* @param {string} code The code to use in the editor
|
|
94
106
|
*/
|
|
@@ -109,11 +121,7 @@ export declare class Papyros {
|
|
|
109
121
|
* @return {Promise<boolean>} Promise of configuring input
|
|
110
122
|
*/
|
|
111
123
|
configureInput(serviceWorkerRoot?: string, serviceWorkerName?: string): Promise<boolean>;
|
|
112
|
-
|
|
113
|
-
* Render Papyros with the given options
|
|
114
|
-
* @param {PapyrosRenderOptions} renderOptions Options to use
|
|
115
|
-
*/
|
|
116
|
-
render(renderOptions: PapyrosRenderOptions): void;
|
|
124
|
+
protected _render(renderOptions: PapyrosRenderOptions): void;
|
|
117
125
|
/**
|
|
118
126
|
* Add a button to the status panel within Papyros
|
|
119
127
|
* @param {ButtonOptions} options Options to render the button with
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InputMode } from "../InputManager";
|
|
2
|
-
import { RenderOptions } from "../util/Util";
|
|
3
2
|
import { UserInputHandler } from "./UserInputHandler";
|
|
3
|
+
import { RenderOptions } from "../util/Rendering";
|
|
4
4
|
export declare class BatchInputHandler extends UserInputHandler {
|
|
5
5
|
/**
|
|
6
6
|
* The index of the next line in lines to send
|
|
@@ -27,5 +27,5 @@ export declare class BatchInputHandler extends UserInputHandler {
|
|
|
27
27
|
next(): string;
|
|
28
28
|
onRunStart(): void;
|
|
29
29
|
onRunEnd(): void;
|
|
30
|
-
|
|
30
|
+
protected _render(options: RenderOptions): void;
|
|
31
31
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InputMode } from "../InputManager";
|
|
2
|
-
import { RenderOptions } from "../util/Util";
|
|
3
2
|
import { UserInputHandler } from "./UserInputHandler";
|
|
3
|
+
import { RenderOptions } from "../util/Rendering";
|
|
4
4
|
/**
|
|
5
5
|
* Input handler that takes input from the user in an interactive fashion
|
|
6
6
|
*/
|
|
@@ -16,5 +16,5 @@ export declare class InteractiveInputHandler extends UserInputHandler {
|
|
|
16
16
|
onToggle(): void;
|
|
17
17
|
onRunStart(): void;
|
|
18
18
|
onRunEnd(): void;
|
|
19
|
-
|
|
19
|
+
protected _render(options: RenderOptions): void;
|
|
20
20
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { InputMode } from "../InputManager";
|
|
2
|
-
import {
|
|
2
|
+
import { Renderable } from "../util/Rendering";
|
|
3
3
|
/**
|
|
4
4
|
* Base class for components that handle input from the user
|
|
5
5
|
*/
|
|
6
|
-
export declare abstract class UserInputHandler {
|
|
6
|
+
export declare abstract class UserInputHandler extends Renderable {
|
|
7
7
|
/**
|
|
8
8
|
* Whether we are waiting for the user to input data
|
|
9
9
|
*/
|
|
@@ -26,12 +26,6 @@ export declare abstract class UserInputHandler {
|
|
|
26
26
|
* @return {string} The next value
|
|
27
27
|
*/
|
|
28
28
|
abstract next(): string;
|
|
29
|
-
/**
|
|
30
|
-
* Render this UserInputHandler with the given options
|
|
31
|
-
* @param {RenderOptions} options The options to use while rendering
|
|
32
|
-
* @return {HTMLElement} The parent with the new content
|
|
33
|
-
*/
|
|
34
|
-
abstract render(options: RenderOptions): HTMLElement;
|
|
35
29
|
abstract onRunStart(): void;
|
|
36
30
|
abstract onRunEnd(): void;
|
|
37
31
|
/**
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Useful options for rendering an element
|
|
3
|
+
*/
|
|
4
|
+
export interface RenderOptions {
|
|
5
|
+
/**
|
|
6
|
+
* String identifier for the parent in which the element will be rendered
|
|
7
|
+
*/
|
|
8
|
+
parentElementId: string;
|
|
9
|
+
/**
|
|
10
|
+
* Names of HTML classes to be added to the element, separated by 1 space
|
|
11
|
+
*/
|
|
12
|
+
classNames?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Extra attributes to add to the element, such as style or data
|
|
15
|
+
*/
|
|
16
|
+
attributes?: Map<string, string>;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to render in dark mode
|
|
19
|
+
*/
|
|
20
|
+
darkMode?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Helper method to append classes to the class attribute of an HTMLElement
|
|
24
|
+
* as consecutive whitespace is not allowed
|
|
25
|
+
* @param {Object} options Object containing classNames
|
|
26
|
+
* @param {string} classNames The classes to append
|
|
27
|
+
*/
|
|
28
|
+
export declare function appendClasses(options: {
|
|
29
|
+
classNames?: string;
|
|
30
|
+
}, classNames: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Helper method to add attributes to options with a possibly undefined attribute Map
|
|
33
|
+
* @param {Object} options Object containing attributes
|
|
34
|
+
* @param {Map<string, string>} attributes The attributes to add
|
|
35
|
+
*/
|
|
36
|
+
export declare function addAttributes(options: {
|
|
37
|
+
attributes?: Map<string, string>;
|
|
38
|
+
}, attributes: Map<string, string>): void;
|
|
39
|
+
/**
|
|
40
|
+
* Renders an element with the given options
|
|
41
|
+
* @param {RenderOptions} options Options to be used while rendering
|
|
42
|
+
* @param {string | HTMLElement} content What to fill the parent with.
|
|
43
|
+
* If the content is a string, it should be properly formatted HTML
|
|
44
|
+
* @return {HTMLElement} The parent with the new child
|
|
45
|
+
*/
|
|
46
|
+
export declare function renderWithOptions(options: RenderOptions, content: string | HTMLElement): HTMLElement;
|
|
47
|
+
/**
|
|
48
|
+
* Interface for options to use while rendering a button element
|
|
49
|
+
*/
|
|
50
|
+
export interface ButtonOptions {
|
|
51
|
+
/**
|
|
52
|
+
* The HTML id of the button
|
|
53
|
+
*/
|
|
54
|
+
id: string;
|
|
55
|
+
/**
|
|
56
|
+
* The text to display in the button, can also be HTML
|
|
57
|
+
*/
|
|
58
|
+
buttonText: string;
|
|
59
|
+
/**
|
|
60
|
+
* Optional classes to apply to the button
|
|
61
|
+
*/
|
|
62
|
+
classNames?: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Construct a HTML button string from the given options
|
|
66
|
+
* @param {ButtonOptions} options The options for the button
|
|
67
|
+
* @return {string} HTML string for the button
|
|
68
|
+
*/
|
|
69
|
+
export declare function renderButton(options: ButtonOptions): string;
|
|
70
|
+
/**
|
|
71
|
+
* Constructs the options for use within an HTML select element
|
|
72
|
+
* @param {Array<T>} options All options to display in the list
|
|
73
|
+
* @param {function(T):string} optionText Function to convert the elements to a string
|
|
74
|
+
* @param {T} selected The initially selected element in the list, if any
|
|
75
|
+
* @return {string} The string representation of the select options
|
|
76
|
+
*/
|
|
77
|
+
export declare function getSelectOptions<T>(options: Array<T>, optionText: (option: T) => string, selected?: T): string;
|
|
78
|
+
/**
|
|
79
|
+
* Constructs an HTML select element
|
|
80
|
+
* @param {string} selectId The HTML id for the element
|
|
81
|
+
* @param {Array<T>} options to display in the list
|
|
82
|
+
* @param {function(T):string} optionText to convert elements to a string
|
|
83
|
+
* @param {T} selected The initially selected element in the list, if any
|
|
84
|
+
* @param {string} labelText Optional text to display in a label
|
|
85
|
+
* @return {string} The string representation of the select element
|
|
86
|
+
*/
|
|
87
|
+
export declare function renderSelect<T>(selectId: string, options: Array<T>, optionText: (option: T) => string, selected?: T, labelText?: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* Helper superclass to handle storing options used during rendering
|
|
90
|
+
* to allow re-rendering without needing to explicitly store used options each time
|
|
91
|
+
*/
|
|
92
|
+
export declare abstract class Renderable<Options = RenderOptions> {
|
|
93
|
+
/**
|
|
94
|
+
* The options to render with
|
|
95
|
+
*/
|
|
96
|
+
private _renderOptions?;
|
|
97
|
+
protected get renderOptions(): Options;
|
|
98
|
+
/**
|
|
99
|
+
* Render this component into the DOM
|
|
100
|
+
* @param {Options} options Optional options to render with. If omitted, stored options are used
|
|
101
|
+
*/
|
|
102
|
+
render(options?: Options): void;
|
|
103
|
+
/**
|
|
104
|
+
* Internal method to actually perform the rendering
|
|
105
|
+
* @param {Options} options The options to render with
|
|
106
|
+
*/
|
|
107
|
+
protected abstract _render(options: Options): void;
|
|
108
|
+
}
|
package/dist/util/Util.d.ts
CHANGED
|
@@ -5,51 +5,16 @@ export declare const t: typeof I18n.t;
|
|
|
5
5
|
*/
|
|
6
6
|
export declare function loadTranslations(): void;
|
|
7
7
|
export declare function getLocales(): Array<string>;
|
|
8
|
-
/**
|
|
9
|
-
* Constructs the options for use within an HTML select element
|
|
10
|
-
* @param {Array<T>} options All options to display in the list
|
|
11
|
-
* @param {function(T):string} optionText Function to convert the elements to a string
|
|
12
|
-
* @param {T} selected The initially selected element in the list, if any
|
|
13
|
-
* @return {string} The string representation of the select options
|
|
14
|
-
*/
|
|
15
|
-
export declare function getSelectOptions<T>(options: Array<T>, optionText: (option: T) => string, selected?: T): string;
|
|
16
|
-
/**
|
|
17
|
-
* Constructs an HTML select element
|
|
18
|
-
* @param {string} selectId The HTML id for the element
|
|
19
|
-
* @param {Array<T>} options to display in the list
|
|
20
|
-
* @param {function(T):string} optionText to convert elements to a string
|
|
21
|
-
* @param {T} selected The initially selected element in the list, if any
|
|
22
|
-
* @param {string} labelText Optional text to display in a label
|
|
23
|
-
* @return {string} The string representation of the select element
|
|
24
|
-
*/
|
|
25
|
-
export declare function renderSelect<T>(selectId: string, options: Array<T>, optionText: (option: T) => string, selected?: T, labelText?: string): string;
|
|
26
|
-
/**
|
|
27
|
-
* Interface for options to use while rendering a button element
|
|
28
|
-
*/
|
|
29
|
-
export interface ButtonOptions {
|
|
30
|
-
/**
|
|
31
|
-
* The HTML id of the button
|
|
32
|
-
*/
|
|
33
|
-
id: string;
|
|
34
|
-
/**
|
|
35
|
-
* The text to display in the button, can also be HTML
|
|
36
|
-
*/
|
|
37
|
-
buttonText: string;
|
|
38
|
-
/**
|
|
39
|
-
* Optional classes to apply to the button
|
|
40
|
-
*/
|
|
41
|
-
extraClasses?: string;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Construct a HTML button string from the given options
|
|
45
|
-
* @param {ButtonOptions} options The options for the button
|
|
46
|
-
* @return {string} HTML string for the button
|
|
47
|
-
*/
|
|
48
|
-
export declare function renderButton(options: ButtonOptions): string;
|
|
49
8
|
/**
|
|
50
9
|
* Helper type to access a HTML element, either via its id or the element itself
|
|
51
10
|
*/
|
|
52
11
|
declare type ElementIdentifier = string | HTMLElement;
|
|
12
|
+
/**
|
|
13
|
+
* Resolve an ElementIdentifier to the corresponding HTLMElement
|
|
14
|
+
* @param {ElementIdentifier} elementId The identifier for the element
|
|
15
|
+
* @return {T} The corresponding element
|
|
16
|
+
*/
|
|
17
|
+
export declare function getElement<T extends HTMLElement>(elementId: ElementIdentifier): T;
|
|
53
18
|
/**
|
|
54
19
|
* Add a listener to an HTML element for an event on an attribute
|
|
55
20
|
* Element attributes tend to be strings, but string Enums can also be used
|
|
@@ -65,37 +30,6 @@ export declare function addListener<T extends string>(elementId: ElementIdentifi
|
|
|
65
30
|
* @param {ElementIdentifier} selectId Identifier for the select element
|
|
66
31
|
*/
|
|
67
32
|
export declare function removeSelection(selectId: string): void;
|
|
68
|
-
/**
|
|
69
|
-
* Useful options for rendering an element
|
|
70
|
-
*/
|
|
71
|
-
export interface RenderOptions {
|
|
72
|
-
/**
|
|
73
|
-
* String identifier for the parent in which the element will be rendered
|
|
74
|
-
*/
|
|
75
|
-
parentElementId: string;
|
|
76
|
-
/**
|
|
77
|
-
* Names of HTML classes to be added to the element, separated by 1 space
|
|
78
|
-
*/
|
|
79
|
-
classNames?: string;
|
|
80
|
-
/**
|
|
81
|
-
* Extra attributes to add to the element, such as style or data
|
|
82
|
-
*/
|
|
83
|
-
attributes?: Map<string, string>;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Resolve an ElementIdentifier to the corresponding HTLMElement
|
|
87
|
-
* @param {ElementIdentifier} elementId The identifier for the element
|
|
88
|
-
* @return {T} The corresponding element
|
|
89
|
-
*/
|
|
90
|
-
export declare function getElement<T extends HTMLElement>(elementId: ElementIdentifier): T;
|
|
91
|
-
/**
|
|
92
|
-
* Renders an element with the given options
|
|
93
|
-
* @param {RenderOptions} options Options to be used while rendering
|
|
94
|
-
* @param {string | HTMLElement} content What to fill the parent with.
|
|
95
|
-
* If the content is a string, it should be properly formatted HTML
|
|
96
|
-
* @return {HTMLElement} The parent with the new child
|
|
97
|
-
*/
|
|
98
|
-
export declare function renderWithOptions(options: RenderOptions, content: string | HTMLElement): HTMLElement;
|
|
99
33
|
/**
|
|
100
34
|
* Parse the data contained within a PapyrosEvent using its contentType
|
|
101
35
|
* Supported content types are: text/plain, text/json, img/png;base64
|
|
@@ -1 +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,(
|
|
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:()=>a,writeMessageAtomics:()=>c,writeMessageServiceWorker:()=>f,writeMessage:()=>l,makeChannel:()=>d,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{a(n.next(e))}catch(e){s(e)}}function u(e){try{a(n.throw(e))}catch(e){s(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,u)}a((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 a 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,a.prototype)}}function c(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},c=yield fetch(r,{method:"POST",body:JSON.stringify(i)});if(200===c.status&&(yield c.json()).version===o)return;if(!(Date.now()-s<e.timeout))throw new a(r,c.status);yield u(100)}}))}function l(e,t,n){return r(this,void 0,void 0,(function*(){"atomics"===e.type?c(e,t):yield f(e,t,n)}))}function d(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 c;if("atomics"===e.type){const{data:t,meta:r}=e;c=()=>{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 c=()=>{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:c}=r;if(408===c)return null;if(200===c){const e=JSON.parse(r.responseText);return e.version!==o?null:e.message}if(performance.now()-i<e.timeout)return null;throw new a(s,c)};for(;;){const e=u-(performance.now()-i);if(e<=0)return null;n=Math.min(n,e);const t=c();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:()=>s});var e=r(137),t=function(e,t,r,n){return new(r||(r=Promise))((function(o,s){function i(e){try{a(n.next(e))}catch(e){s(e)}}function u(e){try{a(n.throw(e))}catch(e){s(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,u)}a((n=n.apply(e,t||[])).next())}))},o=function(e,t){var r,n,o,s,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return s={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(s){return function(u){return function(s){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(o=2&s[0]?n.return:s[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,s[1])).done)return o;switch(n=0,o&&(s=[2&s[0],o.value]),s[0]){case 0:case 1:o=s;break;case 4:return i.label++,{value:s[1],done:!1};case 5:i.label++,n=s[1],s=[0];continue;case 7:s=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]<o[3])){i.label=s[1];break}if(6===s[0]&&i.label<o[1]){i.label=o[1],o=s;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(s);break}o[2]&&i.ops.pop(),i.trys.pop();continue}s=t.call(e,i)}catch(e){s=[6,e],n=0}finally{r=o=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}},s=function(){function r(t){void 0===t&&(t=""),this.hostName=t,this.syncMessageListener=(0,e.serviceWorkerFetchListener)()}return r.prototype.handleInputRequest=function(e){return t(this,void 0,void 0,(function(){var t;return o(this,(function(r){return this.syncMessageListener(e)?[2,!0]:(t=e.request.url,this.hostName&&t.includes(this.hostName)?(e.respondWith(fetch(e.request).then((function(e){var t=new Headers(e.headers);return t.set("Cross-Origin-Embedder-Policy","require-corp"),t.set("Cross-Origin-Opener-Policy","same-origin"),t.set("Cross-Origin-Resource-Policy","cross-origin"),new Response(e.body,{status:e.status||200,statusText:e.statusText,headers:t})}))),[2,!0]):[2,!1])}))}))},r}()})(),n})()));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dodona/papyros",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.95-darkmode",
|
|
4
4
|
"private": false,
|
|
5
5
|
"homepage": ".",
|
|
6
6
|
"devDependencies": {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"postcss-loader": "^6.2.0",
|
|
29
29
|
"raw-loader": "^4.0.2",
|
|
30
30
|
"style-loader": "^3.3.1",
|
|
31
|
-
"tailwindcss": "^
|
|
31
|
+
"tailwindcss": "^3.0.24",
|
|
32
32
|
"terser-webpack-plugin": "^5.3.1",
|
|
33
33
|
"ts-jest": "^27.0.7",
|
|
34
34
|
"ts-loader": "^9.2.6",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"@codemirror/rectangular-selection": "^0.19.1",
|
|
54
54
|
"@codemirror/search": "^0.19.3",
|
|
55
55
|
"@codemirror/state": "^0.19.6",
|
|
56
|
+
"@codemirror/theme-one-dark": "^0.19.0",
|
|
56
57
|
"comlink": "^4.3.1",
|
|
57
58
|
"comsync": "^0.0.8",
|
|
58
59
|
"escape-html": "^1.0.3",
|