@cedx/base 0.19.0 → 0.21.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.
- package/ReadMe.md +1 -1
- package/lib/{DateExtensions.d.ts → Date.d.ts} +9 -9
- package/lib/Date.d.ts.map +1 -0
- package/lib/{DateExtensions.js → Date.js} +12 -10
- package/lib/{FileExtensions.d.ts → File.d.ts} +1 -1
- package/lib/File.d.ts.map +1 -0
- package/lib/{NumberExtensions.d.ts → Number.d.ts} +1 -1
- package/lib/Number.d.ts.map +1 -0
- package/lib/{StringExtensions.d.ts → String.d.ts} +1 -19
- package/lib/String.d.ts.map +1 -0
- package/lib/{StringExtensions.js → String.js} +0 -40
- package/lib/UI/Components/{MessageBox.d.ts → DialogBox.d.ts} +18 -48
- package/lib/UI/Components/DialogBox.d.ts.map +1 -0
- package/lib/UI/Components/{MessageBox.js → DialogBox.js} +49 -79
- package/lib/UI/Components/LoadingIndicator.d.ts +27 -2
- package/lib/UI/Components/LoadingIndicator.d.ts.map +1 -1
- package/lib/UI/Components/LoadingIndicator.js +55 -2
- package/lib/UI/Components/OfflineIndicator.d.ts +29 -0
- package/lib/UI/Components/OfflineIndicator.d.ts.map +1 -1
- package/lib/UI/Components/OfflineIndicator.js +70 -7
- package/lib/UI/Components/Toast.d.ts +11 -11
- package/lib/UI/Components/Toast.d.ts.map +1 -1
- package/lib/UI/Components/Toast.js +21 -21
- package/lib/UI/Components/Toaster.d.ts +6 -6
- package/lib/UI/Components/Toaster.d.ts.map +1 -1
- package/lib/UI/Components/Toaster.js +12 -13
- package/lib/UI/{FormExtensions.d.ts → Form.d.ts} +1 -1
- package/lib/UI/Form.d.ts.map +1 -0
- package/lib/UI/Tag.d.ts +15 -0
- package/lib/UI/Tag.d.ts.map +1 -0
- package/lib/UI/Tag.js +44 -0
- package/package.json +1 -1
- package/src/Client/{DateExtensions.ts → Date.ts} +13 -10
- package/src/Client/{StringExtensions.ts → String.ts} +0 -40
- package/src/Client/UI/Components/{MessageBox.ts → DialogBox.ts} +51 -106
- package/src/Client/UI/Components/LoadingIndicator.ts +57 -2
- package/src/Client/UI/Components/OfflineIndicator.ts +70 -7
- package/src/Client/UI/Components/Toast.ts +27 -27
- package/src/Client/UI/Components/Toaster.ts +14 -15
- package/src/Client/UI/Tag.ts +52 -0
- package/src/Client/tsconfig.json +0 -2
- package/lib/DateExtensions.d.ts.map +0 -1
- package/lib/FileExtensions.d.ts.map +0 -1
- package/lib/Hosting/Environment.d.ts +0 -22
- package/lib/Hosting/Environment.d.ts.map +0 -1
- package/lib/Hosting/Environment.js +0 -17
- package/lib/Hosting/HostEnvironment.d.ts +0 -61
- package/lib/Hosting/HostEnvironment.d.ts.map +0 -1
- package/lib/Hosting/HostEnvironment.js +0 -56
- package/lib/Net/Http/HttpMethod.d.ts +0 -46
- package/lib/Net/Http/HttpMethod.d.ts.map +0 -1
- package/lib/Net/Http/HttpMethod.js +0 -41
- package/lib/Net/Http/StatusCode.d.ts +0 -122
- package/lib/Net/Http/StatusCode.d.ts.map +0 -1
- package/lib/Net/Http/StatusCode.js +0 -117
- package/lib/Net/Mime/DispositionType.d.ts +0 -18
- package/lib/Net/Mime/DispositionType.d.ts.map +0 -1
- package/lib/Net/Mime/DispositionType.js +0 -13
- package/lib/Net/Mime/MediaType.d.ts +0 -151
- package/lib/Net/Mime/MediaType.d.ts.map +0 -1
- package/lib/Net/Mime/MediaType.js +0 -150
- package/lib/NumberExtensions.d.ts.map +0 -1
- package/lib/StringExtensions.d.ts.map +0 -1
- package/lib/UI/Components/MessageBox.d.ts.map +0 -1
- package/lib/UI/ElementExtensions.d.ts +0 -13
- package/lib/UI/ElementExtensions.d.ts.map +0 -1
- package/lib/UI/ElementExtensions.js +0 -18
- package/lib/UI/FormExtensions.d.ts.map +0 -1
- package/src/Client/Hosting/Environment.ts +0 -25
- package/src/Client/Hosting/HostEnvironment.ts +0 -86
- package/src/Client/Hosting/tsconfig.json +0 -13
- package/src/Client/Net/Http/HttpMethod.ts +0 -55
- package/src/Client/Net/Http/StatusCode.ts +0 -150
- package/src/Client/Net/Mime/DispositionType.ts +0 -20
- package/src/Client/Net/Mime/MediaType.ts +0 -185
- package/src/Client/Net/tsconfig.json +0 -13
- package/src/Client/UI/ElementExtensions.ts +0 -19
- /package/lib/{FileExtensions.js → File.js} +0 -0
- /package/lib/{NumberExtensions.js → Number.js} +0 -0
- /package/lib/UI/{FormExtensions.js → Form.js} +0 -0
- /package/src/Client/{FileExtensions.ts → File.ts} +0 -0
- /package/src/Client/{NumberExtensions.ts → Number.ts} +0 -0
- /package/src/Client/UI/{FormExtensions.ts → Form.ts} +0 -0
|
@@ -6,11 +6,6 @@ import {Context, getIcon, toCss} from "../Context.js";
|
|
|
6
6
|
*/
|
|
7
7
|
export interface IToast {
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* Value indicating whether to apply a fade transition.
|
|
11
|
-
*/
|
|
12
|
-
animation?: boolean;
|
|
13
|
-
|
|
14
9
|
/**
|
|
15
10
|
* Value indicating whether to automatically hide the toast.
|
|
16
11
|
*/
|
|
@@ -19,7 +14,7 @@ export interface IToast {
|
|
|
19
14
|
/**
|
|
20
15
|
* The child content displayed in the body.
|
|
21
16
|
*/
|
|
22
|
-
body: DocumentFragment
|
|
17
|
+
body: DocumentFragment;
|
|
23
18
|
|
|
24
19
|
/**
|
|
25
20
|
* The title displayed in the header.
|
|
@@ -41,6 +36,11 @@ export interface IToast {
|
|
|
41
36
|
*/
|
|
42
37
|
delay?: number;
|
|
43
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Value indicating whether to apply a transition.
|
|
41
|
+
*/
|
|
42
|
+
fade?: boolean;
|
|
43
|
+
|
|
44
44
|
/**
|
|
45
45
|
* The icon displayed next to the caption.
|
|
46
46
|
*/
|
|
@@ -55,7 +55,7 @@ export class Toast extends HTMLElement {
|
|
|
55
55
|
/**
|
|
56
56
|
* The list of observed attributes.
|
|
57
57
|
*/
|
|
58
|
-
static readonly observedAttributes = ["
|
|
58
|
+
static readonly observedAttributes = ["autohide", "caption", "context", "culture", "delay", "fade", "icon"];
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* The time units.
|
|
@@ -89,16 +89,6 @@ export class Toast extends HTMLElement {
|
|
|
89
89
|
customElements.define("toaster-item", this);
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
/**
|
|
93
|
-
* Value indicating whether to apply a fade transition.
|
|
94
|
-
*/
|
|
95
|
-
get animation(): boolean {
|
|
96
|
-
return this.hasAttribute("animation");
|
|
97
|
-
}
|
|
98
|
-
set animation(value: boolean) {
|
|
99
|
-
this.toggleAttribute("animation", value);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
92
|
/**
|
|
103
93
|
* Value indicating whether to automatically hide this toast.
|
|
104
94
|
*/
|
|
@@ -166,6 +156,16 @@ export class Toast extends HTMLElement {
|
|
|
166
156
|
return Date.now() - this.#initialTime;
|
|
167
157
|
}
|
|
168
158
|
|
|
159
|
+
/**
|
|
160
|
+
* Value indicating whether to apply a transition.
|
|
161
|
+
*/
|
|
162
|
+
get fade(): boolean {
|
|
163
|
+
return this.hasAttribute("fade");
|
|
164
|
+
}
|
|
165
|
+
set fade(value: boolean) {
|
|
166
|
+
this.toggleAttribute("fade", value);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
169
|
/**
|
|
170
170
|
* The icon displayed next to the caption.
|
|
171
171
|
*/
|
|
@@ -179,7 +179,7 @@ export class Toast extends HTMLElement {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
|
-
* Value indicating whether to initially show this
|
|
182
|
+
* Value indicating whether to initially show this component.
|
|
183
183
|
*/
|
|
184
184
|
get open(): boolean {
|
|
185
185
|
return this.hasAttribute("open");
|
|
@@ -196,12 +196,12 @@ export class Toast extends HTMLElement {
|
|
|
196
196
|
*/
|
|
197
197
|
attributeChangedCallback(attribute: string, oldValue: string|null, newValue: string|null): void {
|
|
198
198
|
if (newValue != oldValue) switch (attribute) {
|
|
199
|
-
case "animation": this.#updateAnimation(newValue != null); break;
|
|
200
199
|
case "autohide": this.#updateAutoHide(newValue != null); break;
|
|
201
200
|
case "caption": this.#updateCaption(newValue ?? ""); break;
|
|
202
201
|
case "context": this.#updateContext(Object.values(Context).includes(newValue as Context) ? newValue as Context : Context.Info); break;
|
|
203
202
|
case "culture": this.#formatter = new Intl.RelativeTimeFormat((newValue ?? "").trim() || navigator.language, {style: "long"}); break;
|
|
204
203
|
case "delay": this.#updateDelay(Number(newValue)); break;
|
|
204
|
+
case "fade": this.#updateFade(newValue != null); break;
|
|
205
205
|
case "icon": this.#updateIcon(newValue); break;
|
|
206
206
|
// No default
|
|
207
207
|
}
|
|
@@ -261,14 +261,6 @@ export class Toast extends HTMLElement {
|
|
|
261
261
|
return this.#formatter.format(Math.ceil(-elapsed), Toast.#timeUnits[index]);
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
/**
|
|
265
|
-
* Updates the value indicating whether to apply a fade transition.
|
|
266
|
-
* @param value The new value.
|
|
267
|
-
*/
|
|
268
|
-
#updateAnimation(value: boolean): void {
|
|
269
|
-
(this.firstElementChild! as HTMLElement).dataset.bsAnimation = value ? "true" : "false";
|
|
270
|
-
}
|
|
271
|
-
|
|
272
264
|
/**
|
|
273
265
|
* Updates the value indicating whether to automatically hide this toast.
|
|
274
266
|
* @param value The new value.
|
|
@@ -318,6 +310,14 @@ export class Toast extends HTMLElement {
|
|
|
318
310
|
this.querySelector(".toast-header small")!.textContent = elapsedTime > 0 ? this.#formatTime(elapsedTime / 1_000) : "";
|
|
319
311
|
};
|
|
320
312
|
|
|
313
|
+
/**
|
|
314
|
+
* Updates the value indicating whether to apply a transition.
|
|
315
|
+
* @param value The new value.
|
|
316
|
+
*/
|
|
317
|
+
#updateFade(value: boolean): void {
|
|
318
|
+
(this.firstElementChild! as HTMLElement).dataset.bsAnimation = value ? "true" : "false";
|
|
319
|
+
}
|
|
320
|
+
|
|
321
321
|
/**
|
|
322
322
|
* Updates the icon displayed next to the caption.
|
|
323
323
|
* @param value The new value.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {Context} from "../Context.js";
|
|
2
|
-
import {createDocumentFragment} from "../ElementExtensions.js";
|
|
3
2
|
import {Position, toCss} from "../Position.js";
|
|
4
3
|
import type {IToast} from "./Toast.js";
|
|
5
4
|
|
|
@@ -33,16 +32,6 @@ export class Toaster extends HTMLElement {
|
|
|
33
32
|
customElements.define("toaster-container", this);
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
/**
|
|
37
|
-
* Value indicating whether to apply a fade transition.
|
|
38
|
-
*/
|
|
39
|
-
get animation(): boolean {
|
|
40
|
-
return this.hasAttribute("animation");
|
|
41
|
-
}
|
|
42
|
-
set animation(value: boolean) {
|
|
43
|
-
this.toggleAttribute("animation", value);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
35
|
/**
|
|
47
36
|
* Value indicating whether to automatically hide the toasts.
|
|
48
37
|
*/
|
|
@@ -86,6 +75,16 @@ export class Toaster extends HTMLElement {
|
|
|
86
75
|
this.setAttribute("delay", value.toString());
|
|
87
76
|
}
|
|
88
77
|
|
|
78
|
+
/**
|
|
79
|
+
* Value indicating whether to apply a transition.
|
|
80
|
+
*/
|
|
81
|
+
get fade(): boolean {
|
|
82
|
+
return this.hasAttribute("fade");
|
|
83
|
+
}
|
|
84
|
+
set fade(value: boolean) {
|
|
85
|
+
this.toggleAttribute("fade", value);
|
|
86
|
+
}
|
|
87
|
+
|
|
89
88
|
/**
|
|
90
89
|
* The default icon displayed next to the captions.
|
|
91
90
|
*/
|
|
@@ -128,7 +127,7 @@ export class Toaster extends HTMLElement {
|
|
|
128
127
|
* @param caption The title displayed in the toast header.
|
|
129
128
|
* @param body The child content displayed in the toast body.
|
|
130
129
|
*/
|
|
131
|
-
show(context: Context, caption: string, body: DocumentFragment
|
|
130
|
+
show(context: Context, caption: string, body: DocumentFragment): void;
|
|
132
131
|
|
|
133
132
|
/**
|
|
134
133
|
* Shows a toast.
|
|
@@ -142,7 +141,7 @@ export class Toaster extends HTMLElement {
|
|
|
142
141
|
* @param caption The title displayed in the toast header.
|
|
143
142
|
* @param body The child content displayed in the toast body.
|
|
144
143
|
*/
|
|
145
|
-
show(toast: IToast|Context, caption = "", body
|
|
144
|
+
show(toast: IToast|Context, caption = "", body = document.createDocumentFragment()): void {
|
|
146
145
|
if (typeof toast == "string") toast = {context: toast, caption, body};
|
|
147
146
|
|
|
148
147
|
const item = document.createElement("toaster-item");
|
|
@@ -150,13 +149,13 @@ export class Toaster extends HTMLElement {
|
|
|
150
149
|
childContent.addEventListener("hidden.bs.toast", () => item.remove());
|
|
151
150
|
item.appendChild(childContent);
|
|
152
151
|
|
|
153
|
-
item.animation = toast.animation ?? this.animation;
|
|
154
152
|
item.autoHide = toast.autoHide ?? this.autoHide;
|
|
155
|
-
item.body =
|
|
153
|
+
item.body = toast.body;
|
|
156
154
|
item.caption = toast.caption;
|
|
157
155
|
item.context = toast.context ?? this.context;
|
|
158
156
|
item.culture = toast.culture ?? this.culture;
|
|
159
157
|
item.delay = toast.delay ?? this.delay;
|
|
158
|
+
item.fade = toast.fade ?? this.fade;
|
|
160
159
|
item.icon = toast.icon ?? this.icon;
|
|
161
160
|
|
|
162
161
|
this.firstElementChild!.appendChild(item);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a CSS stylesheet from the specified template literal.
|
|
3
|
+
* @param fragments The string fragments.
|
|
4
|
+
* @param values The interpolated values.
|
|
5
|
+
* @returns The CSS stylesheet corresponding to the specified template literal.
|
|
6
|
+
*/
|
|
7
|
+
export function css(fragments: TemplateStringsArray, ...values: unknown[]): CSSStyleSheet {
|
|
8
|
+
const styleSheet = new CSSStyleSheet;
|
|
9
|
+
styleSheet.replaceSync(fragments.length == 1 ? fragments[0] : values.reduce(
|
|
10
|
+
(fragment: string, value: unknown, index: number) => fragment + stringFromCss(value) + fragments[index + 1],
|
|
11
|
+
fragments[0]
|
|
12
|
+
));
|
|
13
|
+
|
|
14
|
+
return styleSheet;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Creates a document fragment from the specified template literal.
|
|
19
|
+
* @param fragments The string fragments.
|
|
20
|
+
* @param values The interpolated values.
|
|
21
|
+
* @returns The document fragment corresponding to the specified template literal.
|
|
22
|
+
*/
|
|
23
|
+
export function html(fragments: TemplateStringsArray, ...values: unknown[]): DocumentFragment {
|
|
24
|
+
return document.createRange().createContextualFragment(fragments.length == 1 ? fragments[0] : values.reduce(
|
|
25
|
+
(fragment: string, value: unknown, index: number) => fragment + stringFromHtml(value) + fragments[index + 1],
|
|
26
|
+
fragments[0]
|
|
27
|
+
));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Converts the specified value to a CSS string.
|
|
32
|
+
* @param value A value representing a CSS fragment.
|
|
33
|
+
* @returns The CSS string corresponding to the specified value.
|
|
34
|
+
*/
|
|
35
|
+
function stringFromCss(value: unknown): string {
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
37
|
+
if (!(value instanceof CSSStyleSheet)) return value === null || typeof value == "undefined" ? "" : String(value);
|
|
38
|
+
return Array.from(value.cssRules).map(cssRule => cssRule.cssText).join("\n");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Converts the specified value to an HTML string.
|
|
43
|
+
* @param value A value representing an HTML fragment.
|
|
44
|
+
* @returns The HTML string corresponding to the specified value.
|
|
45
|
+
*/
|
|
46
|
+
function stringFromHtml(value: unknown): string {
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
48
|
+
if (!(value instanceof DocumentFragment)) return value === null || typeof value == "undefined" ? "" : String(value);
|
|
49
|
+
const element = document.createElement("div");
|
|
50
|
+
element.appendChild(value);
|
|
51
|
+
return element.innerHTML;
|
|
52
|
+
}
|
package/src/Client/tsconfig.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DateExtensions.d.ts","sourceRoot":"","sources":["../src/Client/DateExtensions.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAE3C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,SAA2B,GAAG,IAAI,CAY/D;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,SAA2B,GAAG,IAAI,EAAE,CAoBnE;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAE7C;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAIhD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAG9C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAG7C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAGhD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAE5C;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE;IAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAM,GAAG,MAAM,CAM7H"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FileExtensions.d.ts","sourceRoot":"","sources":["../src/Client/FileExtensions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAUzC;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,GAAE;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAM,GAAG,IAAI,CAkBvE;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAatC;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAOlD"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Commonly used environment names.
|
|
3
|
-
*/
|
|
4
|
-
export declare const Environment: Readonly<{
|
|
5
|
-
/**
|
|
6
|
-
* Specifies the development environment.
|
|
7
|
-
*/
|
|
8
|
-
Development: "Development";
|
|
9
|
-
/**
|
|
10
|
-
* Specifies the production environment.
|
|
11
|
-
*/
|
|
12
|
-
Production: "Production";
|
|
13
|
-
/**
|
|
14
|
-
* Specifies the staging environment.
|
|
15
|
-
*/
|
|
16
|
-
Staging: "Staging";
|
|
17
|
-
}>;
|
|
18
|
-
/**
|
|
19
|
-
* Commonly used environment names.
|
|
20
|
-
*/
|
|
21
|
-
export type Environment = typeof Environment[keyof typeof Environment];
|
|
22
|
-
//# sourceMappingURL=Environment.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Environment.d.ts","sourceRoot":"","sources":["../../src/Client/Hosting/Environment.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,WAAW;IAEvB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;EAEF,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Commonly used environment names.
|
|
3
|
-
*/
|
|
4
|
-
export const Environment = Object.freeze({
|
|
5
|
-
/**
|
|
6
|
-
* Specifies the development environment.
|
|
7
|
-
*/
|
|
8
|
-
Development: "Development",
|
|
9
|
-
/**
|
|
10
|
-
* Specifies the production environment.
|
|
11
|
-
*/
|
|
12
|
-
Production: "Production",
|
|
13
|
-
/**
|
|
14
|
-
* Specifies the staging environment.
|
|
15
|
-
*/
|
|
16
|
-
Staging: "Staging"
|
|
17
|
-
});
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Provides information about the hosting environment an application is running in.
|
|
3
|
-
*/
|
|
4
|
-
export declare class HostEnvironment {
|
|
5
|
-
/**
|
|
6
|
-
* The name of the application.
|
|
7
|
-
*/
|
|
8
|
-
readonly applicationName: string;
|
|
9
|
-
/**
|
|
10
|
-
* The path to the directory that contains the application content files.
|
|
11
|
-
*/
|
|
12
|
-
readonly contentRootPath: string;
|
|
13
|
-
/**
|
|
14
|
-
* The name of the environment.
|
|
15
|
-
*/
|
|
16
|
-
readonly environmentName: string;
|
|
17
|
-
/**
|
|
18
|
-
* Creates a new host environment.
|
|
19
|
-
* @param options An object providing values to initialize this instance.
|
|
20
|
-
*/
|
|
21
|
-
constructor(options?: HostEnvironmentOptions);
|
|
22
|
-
/**
|
|
23
|
-
* Checks if the current environment name is {@link Environment.Development}.
|
|
24
|
-
* @returns `true` if the environment name is {@link Environment.Development}, otherwise `false`.
|
|
25
|
-
*/
|
|
26
|
-
get isDevelopment(): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Checks if the current environment name is {@link Environment.Production}.
|
|
29
|
-
* @returns `true` if the environment name is {@link Environment.Production}, otherwise `false`.
|
|
30
|
-
*/
|
|
31
|
-
get isProduction(): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Checks if the current environment name is {@link Environment.Staging}.
|
|
34
|
-
* @returns `true` if the environment name is {@link Environment.Staging}, otherwise `false`.
|
|
35
|
-
*/
|
|
36
|
-
get isStaging(): boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Compares the current host environment name against the specified value.
|
|
39
|
-
* @param environmentName The environment name to validate against.
|
|
40
|
-
* @returns `true` if the specified name is the same as the current environment, otherwise `false`.
|
|
41
|
-
*/
|
|
42
|
-
isEnvironment(environmentName: string): boolean;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Defines the options of a {@link HostEnvironment} instance.
|
|
46
|
-
*/
|
|
47
|
-
export type HostEnvironmentOptions = Partial<{
|
|
48
|
-
/**
|
|
49
|
-
* The name of the application.
|
|
50
|
-
*/
|
|
51
|
-
applicationName: string;
|
|
52
|
-
/**
|
|
53
|
-
* The path to the directory that contains the application content files.
|
|
54
|
-
*/
|
|
55
|
-
contentRootPath: string;
|
|
56
|
-
/**
|
|
57
|
-
* The name of the environment.
|
|
58
|
-
*/
|
|
59
|
-
environmentName: string;
|
|
60
|
-
}>;
|
|
61
|
-
//# sourceMappingURL=HostEnvironment.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HostEnvironment.d.ts","sourceRoot":"","sources":["../../src/Client/Hosting/HostEnvironment.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,eAAe;IAE3B;;OAEG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IAEjC;;OAEG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IAEjC;;OAEG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IAEjC;;;OAGG;gBACS,OAAO,GAAE,sBAA2B;IAMhD;;;OAGG;IACH,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED;;;OAGG;IACH,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED;;;OAGG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;;;OAIG;IACH,aAAa,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO;CAG/C;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC;IAE5C;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;CACxB,CAAC,CAAC"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Environment } from "./Environment.js";
|
|
2
|
-
/**
|
|
3
|
-
* Provides information about the hosting environment an application is running in.
|
|
4
|
-
*/
|
|
5
|
-
export class HostEnvironment {
|
|
6
|
-
/**
|
|
7
|
-
* The name of the application.
|
|
8
|
-
*/
|
|
9
|
-
applicationName;
|
|
10
|
-
/**
|
|
11
|
-
* The path to the directory that contains the application content files.
|
|
12
|
-
*/
|
|
13
|
-
contentRootPath;
|
|
14
|
-
/**
|
|
15
|
-
* The name of the environment.
|
|
16
|
-
*/
|
|
17
|
-
environmentName;
|
|
18
|
-
/**
|
|
19
|
-
* Creates a new host environment.
|
|
20
|
-
* @param options An object providing values to initialize this instance.
|
|
21
|
-
*/
|
|
22
|
-
constructor(options = {}) {
|
|
23
|
-
this.applicationName = options.applicationName ?? document.head.querySelector('meta[name="application-name"]')?.content ?? location.hostname;
|
|
24
|
-
this.contentRootPath = options.contentRootPath ?? document.head.querySelector("base")?.getAttribute("href") ?? "/";
|
|
25
|
-
this.environmentName = options.environmentName ?? Environment.Production;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Checks if the current environment name is {@link Environment.Development}.
|
|
29
|
-
* @returns `true` if the environment name is {@link Environment.Development}, otherwise `false`.
|
|
30
|
-
*/
|
|
31
|
-
get isDevelopment() {
|
|
32
|
-
return this.isEnvironment(Environment.Development);
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Checks if the current environment name is {@link Environment.Production}.
|
|
36
|
-
* @returns `true` if the environment name is {@link Environment.Production}, otherwise `false`.
|
|
37
|
-
*/
|
|
38
|
-
get isProduction() {
|
|
39
|
-
return this.isEnvironment(Environment.Production);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Checks if the current environment name is {@link Environment.Staging}.
|
|
43
|
-
* @returns `true` if the environment name is {@link Environment.Staging}, otherwise `false`.
|
|
44
|
-
*/
|
|
45
|
-
get isStaging() {
|
|
46
|
-
return this.isEnvironment(Environment.Staging);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Compares the current host environment name against the specified value.
|
|
50
|
-
* @param environmentName The environment name to validate against.
|
|
51
|
-
* @returns `true` if the specified name is the same as the current environment, otherwise `false`.
|
|
52
|
-
*/
|
|
53
|
-
isEnvironment(environmentName) {
|
|
54
|
-
return this.environmentName == environmentName;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Provides HTTP methods.
|
|
3
|
-
*/
|
|
4
|
-
export declare const HttpMethod: Readonly<{
|
|
5
|
-
/**
|
|
6
|
-
* The `CONNECT` HTTP method.
|
|
7
|
-
*/
|
|
8
|
-
Connect: "CONNECT";
|
|
9
|
-
/**
|
|
10
|
-
* The `DELETE` HTTP method.
|
|
11
|
-
*/
|
|
12
|
-
Delete: "DELETE";
|
|
13
|
-
/**
|
|
14
|
-
* The `GET` HTTP method.
|
|
15
|
-
*/
|
|
16
|
-
Get: "GET";
|
|
17
|
-
/**
|
|
18
|
-
* The `HEAD` HTTP method.
|
|
19
|
-
*/
|
|
20
|
-
Head: "HEAD";
|
|
21
|
-
/**
|
|
22
|
-
* The `OPTIONS` HTTP method.
|
|
23
|
-
*/
|
|
24
|
-
Options: "OPTIONS";
|
|
25
|
-
/**
|
|
26
|
-
* The `PATCH` HTTP method.
|
|
27
|
-
*/
|
|
28
|
-
Patch: "PATCH";
|
|
29
|
-
/**
|
|
30
|
-
* The `POST` HTTP method.
|
|
31
|
-
*/
|
|
32
|
-
Post: "POST";
|
|
33
|
-
/**
|
|
34
|
-
* The `PUT` HTTP method.
|
|
35
|
-
*/
|
|
36
|
-
Put: "PUT";
|
|
37
|
-
/**
|
|
38
|
-
* The `TRACE` HTTP method.
|
|
39
|
-
*/
|
|
40
|
-
Trace: "TRACE";
|
|
41
|
-
}>;
|
|
42
|
-
/**
|
|
43
|
-
* Provides HTTP methods.
|
|
44
|
-
*/
|
|
45
|
-
export type HttpMethod = typeof HttpMethod[keyof typeof HttpMethod];
|
|
46
|
-
//# sourceMappingURL=HttpMethod.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HttpMethod.d.ts","sourceRoot":"","sources":["../../../src/Client/Net/Http/HttpMethod.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,UAAU;IAEtB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;EAEF,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Provides HTTP methods.
|
|
3
|
-
*/
|
|
4
|
-
export const HttpMethod = Object.freeze({
|
|
5
|
-
/**
|
|
6
|
-
* The `CONNECT` HTTP method.
|
|
7
|
-
*/
|
|
8
|
-
Connect: "CONNECT",
|
|
9
|
-
/**
|
|
10
|
-
* The `DELETE` HTTP method.
|
|
11
|
-
*/
|
|
12
|
-
Delete: "DELETE",
|
|
13
|
-
/**
|
|
14
|
-
* The `GET` HTTP method.
|
|
15
|
-
*/
|
|
16
|
-
Get: "GET",
|
|
17
|
-
/**
|
|
18
|
-
* The `HEAD` HTTP method.
|
|
19
|
-
*/
|
|
20
|
-
Head: "HEAD",
|
|
21
|
-
/**
|
|
22
|
-
* The `OPTIONS` HTTP method.
|
|
23
|
-
*/
|
|
24
|
-
Options: "OPTIONS",
|
|
25
|
-
/**
|
|
26
|
-
* The `PATCH` HTTP method.
|
|
27
|
-
*/
|
|
28
|
-
Patch: "PATCH",
|
|
29
|
-
/**
|
|
30
|
-
* The `POST` HTTP method.
|
|
31
|
-
*/
|
|
32
|
-
Post: "POST",
|
|
33
|
-
/**
|
|
34
|
-
* The `PUT` HTTP method.
|
|
35
|
-
*/
|
|
36
|
-
Put: "PUT",
|
|
37
|
-
/**
|
|
38
|
-
* The `TRACE` HTTP method.
|
|
39
|
-
*/
|
|
40
|
-
Trace: "TRACE"
|
|
41
|
-
});
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Provides common HTTP status codes.
|
|
3
|
-
*/
|
|
4
|
-
export declare const StatusCode: Readonly<{
|
|
5
|
-
/**
|
|
6
|
-
* The `OK` status code.
|
|
7
|
-
*/
|
|
8
|
-
OK: 200;
|
|
9
|
-
/**
|
|
10
|
-
* The `Created` status code.
|
|
11
|
-
*/
|
|
12
|
-
Created: 201;
|
|
13
|
-
/**
|
|
14
|
-
* The `No Content` status code.
|
|
15
|
-
*/
|
|
16
|
-
NoContent: 204;
|
|
17
|
-
/**
|
|
18
|
-
* The `Moved Permanently` status code.
|
|
19
|
-
*/
|
|
20
|
-
MovedPermanently: 301;
|
|
21
|
-
/**
|
|
22
|
-
* The `Found` status code.
|
|
23
|
-
*/
|
|
24
|
-
Found: 302;
|
|
25
|
-
/**
|
|
26
|
-
* The `Not Modified` status code.
|
|
27
|
-
*/
|
|
28
|
-
NotModified: 304;
|
|
29
|
-
/**
|
|
30
|
-
* The `Temporary Redirect` status code.
|
|
31
|
-
*/
|
|
32
|
-
TemporaryRedirect: 307;
|
|
33
|
-
/**
|
|
34
|
-
* The `Permanent Redirect` status code.
|
|
35
|
-
*/
|
|
36
|
-
PermanentRedirect: 308;
|
|
37
|
-
/**
|
|
38
|
-
* The `Bad Request` status code.
|
|
39
|
-
*/
|
|
40
|
-
BadRequest: 400;
|
|
41
|
-
/**
|
|
42
|
-
* The `Unauthorized` status code.
|
|
43
|
-
*/
|
|
44
|
-
Unauthorized: 401;
|
|
45
|
-
/**
|
|
46
|
-
* The `Payment Required` status code.
|
|
47
|
-
*/
|
|
48
|
-
PaymentRequired: 402;
|
|
49
|
-
/**
|
|
50
|
-
* The `Forbidden` status code.
|
|
51
|
-
*/
|
|
52
|
-
Forbidden: 403;
|
|
53
|
-
/**
|
|
54
|
-
* The `Not Found` status code.
|
|
55
|
-
*/
|
|
56
|
-
NotFound: 404;
|
|
57
|
-
/**
|
|
58
|
-
* The `Method Not Allowed` status code.
|
|
59
|
-
*/
|
|
60
|
-
MethodNotAllowed: 405;
|
|
61
|
-
/**
|
|
62
|
-
* The `Not Acceptable` status code.
|
|
63
|
-
*/
|
|
64
|
-
NotAcceptable: 406;
|
|
65
|
-
/**
|
|
66
|
-
* The `Request Timeout` status code.
|
|
67
|
-
*/
|
|
68
|
-
RequestTimeout: 408;
|
|
69
|
-
/**
|
|
70
|
-
* The `Conflict` status code.
|
|
71
|
-
*/
|
|
72
|
-
Conflict: 409;
|
|
73
|
-
/**
|
|
74
|
-
* The `Payload Too Large` status code.
|
|
75
|
-
*/
|
|
76
|
-
PayloadTooLarge: 413;
|
|
77
|
-
/**
|
|
78
|
-
* The `Unsupported Media Type` status code.
|
|
79
|
-
*/
|
|
80
|
-
UnsupportedMediaType: 415;
|
|
81
|
-
/**
|
|
82
|
-
* The `Authentication Timeout` status code.
|
|
83
|
-
*/
|
|
84
|
-
AuthenticationTimeout: 419;
|
|
85
|
-
/**
|
|
86
|
-
* The `Unprocessable Content` status code.
|
|
87
|
-
*/
|
|
88
|
-
UnprocessableContent: 422;
|
|
89
|
-
/**
|
|
90
|
-
* The `Too Many Requests` status code.
|
|
91
|
-
*/
|
|
92
|
-
TooManyRequests: 429;
|
|
93
|
-
/**
|
|
94
|
-
* The `Internal Server Error` status code.
|
|
95
|
-
*/
|
|
96
|
-
InternalServerError: 500;
|
|
97
|
-
/**
|
|
98
|
-
* The `Not Implemented` status code.
|
|
99
|
-
*/
|
|
100
|
-
NotImplemented: 501;
|
|
101
|
-
/**
|
|
102
|
-
* The `Bad Gateway` status code.
|
|
103
|
-
*/
|
|
104
|
-
BadGateway: 502;
|
|
105
|
-
/**
|
|
106
|
-
* The `Service Unavailable` status code.
|
|
107
|
-
*/
|
|
108
|
-
ServiceUnavailable: 503;
|
|
109
|
-
/**
|
|
110
|
-
* The `Gateway Timeout` status code.
|
|
111
|
-
*/
|
|
112
|
-
GatewayTimeout: 504;
|
|
113
|
-
/**
|
|
114
|
-
* The `Bandwidth Limit Exceeded` status
|
|
115
|
-
*/
|
|
116
|
-
BandwidthLimitExceeded: 509;
|
|
117
|
-
}>;
|
|
118
|
-
/**
|
|
119
|
-
* Provides common HTTP status codes.
|
|
120
|
-
*/
|
|
121
|
-
export type StatusCode = typeof StatusCode[keyof typeof StatusCode];
|
|
122
|
-
//# sourceMappingURL=StatusCode.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"StatusCode.d.ts","sourceRoot":"","sources":["../../../src/Client/Net/Http/StatusCode.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,UAAU;IAEtB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;EAEF,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC"}
|