@cedx/base 0.18.0 → 0.20.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.
Files changed (82) hide show
  1. package/ReadMe.md +1 -1
  2. package/lib/{DateExtensions.d.ts → Date.d.ts} +9 -9
  3. package/lib/Date.d.ts.map +1 -0
  4. package/lib/{DateExtensions.js → Date.js} +12 -10
  5. package/lib/{FileExtensions.d.ts → File.d.ts} +1 -1
  6. package/lib/File.d.ts.map +1 -0
  7. package/lib/{NumberExtensions.d.ts → Number.d.ts} +1 -1
  8. package/lib/Number.d.ts.map +1 -0
  9. package/lib/{StringExtensions.d.ts → String.d.ts} +1 -19
  10. package/lib/String.d.ts.map +1 -0
  11. package/lib/{StringExtensions.js → String.js} +0 -40
  12. package/lib/UI/Components/LoadingIndicator.d.ts +16 -0
  13. package/lib/UI/Components/LoadingIndicator.d.ts.map +1 -1
  14. package/lib/UI/Components/LoadingIndicator.js +41 -2
  15. package/lib/UI/Components/MessageBox.d.ts +7 -7
  16. package/lib/UI/Components/MessageBox.d.ts.map +1 -1
  17. package/lib/UI/Components/MessageBox.js +4 -5
  18. package/lib/UI/Components/OfflineIndicator.d.ts +16 -0
  19. package/lib/UI/Components/OfflineIndicator.d.ts.map +1 -1
  20. package/lib/UI/Components/OfflineIndicator.js +39 -1
  21. package/lib/UI/Components/Toast.d.ts +3 -3
  22. package/lib/UI/Components/Toast.d.ts.map +1 -1
  23. package/lib/UI/Components/Toast.js +2 -2
  24. package/lib/UI/Components/Toaster.d.ts +2 -2
  25. package/lib/UI/Components/Toaster.d.ts.map +1 -1
  26. package/lib/UI/Components/Toaster.js +3 -4
  27. package/lib/UI/{FormExtensions.d.ts → Form.d.ts} +1 -1
  28. package/lib/UI/Form.d.ts.map +1 -0
  29. package/lib/UI/Tag.d.ts +15 -0
  30. package/lib/UI/Tag.d.ts.map +1 -0
  31. package/lib/UI/Tag.js +42 -0
  32. package/package.json +2 -2
  33. package/src/Client/{DateExtensions.ts → Date.ts} +13 -10
  34. package/src/Client/{StringExtensions.ts → String.ts} +0 -40
  35. package/src/Client/UI/Components/LoadingIndicator.ts +42 -2
  36. package/src/Client/UI/Components/MessageBox.ts +10 -11
  37. package/src/Client/UI/Components/OfflineIndicator.ts +40 -1
  38. package/src/Client/UI/Components/Toast.ts +4 -4
  39. package/src/Client/UI/Components/Toaster.ts +4 -5
  40. package/src/Client/UI/Tag.ts +50 -0
  41. package/src/Client/tsconfig.json +0 -2
  42. package/lib/DateExtensions.d.ts.map +0 -1
  43. package/lib/FileExtensions.d.ts.map +0 -1
  44. package/lib/Hosting/Environment.d.ts +0 -22
  45. package/lib/Hosting/Environment.d.ts.map +0 -1
  46. package/lib/Hosting/Environment.js +0 -17
  47. package/lib/Hosting/HostEnvironment.d.ts +0 -61
  48. package/lib/Hosting/HostEnvironment.d.ts.map +0 -1
  49. package/lib/Hosting/HostEnvironment.js +0 -56
  50. package/lib/Net/Http/HttpMethod.d.ts +0 -46
  51. package/lib/Net/Http/HttpMethod.d.ts.map +0 -1
  52. package/lib/Net/Http/HttpMethod.js +0 -41
  53. package/lib/Net/Http/StatusCode.d.ts +0 -122
  54. package/lib/Net/Http/StatusCode.d.ts.map +0 -1
  55. package/lib/Net/Http/StatusCode.js +0 -117
  56. package/lib/Net/Mime/DispositionType.d.ts +0 -18
  57. package/lib/Net/Mime/DispositionType.d.ts.map +0 -1
  58. package/lib/Net/Mime/DispositionType.js +0 -13
  59. package/lib/Net/Mime/MediaType.d.ts +0 -151
  60. package/lib/Net/Mime/MediaType.d.ts.map +0 -1
  61. package/lib/Net/Mime/MediaType.js +0 -150
  62. package/lib/NumberExtensions.d.ts.map +0 -1
  63. package/lib/StringExtensions.d.ts.map +0 -1
  64. package/lib/UI/ElementExtensions.d.ts +0 -13
  65. package/lib/UI/ElementExtensions.d.ts.map +0 -1
  66. package/lib/UI/ElementExtensions.js +0 -18
  67. package/lib/UI/FormExtensions.d.ts.map +0 -1
  68. package/src/Client/Hosting/Environment.ts +0 -25
  69. package/src/Client/Hosting/HostEnvironment.ts +0 -86
  70. package/src/Client/Hosting/tsconfig.json +0 -13
  71. package/src/Client/Net/Http/HttpMethod.ts +0 -55
  72. package/src/Client/Net/Http/StatusCode.ts +0 -150
  73. package/src/Client/Net/Mime/DispositionType.ts +0 -20
  74. package/src/Client/Net/Mime/MediaType.ts +0 -185
  75. package/src/Client/Net/tsconfig.json +0 -13
  76. package/src/Client/UI/ElementExtensions.ts +0 -19
  77. /package/lib/{FileExtensions.js → File.js} +0 -0
  78. /package/lib/{NumberExtensions.js → Number.js} +0 -0
  79. /package/lib/UI/{FormExtensions.js → Form.js} +0 -0
  80. /package/src/Client/{FileExtensions.ts → File.ts} +0 -0
  81. /package/src/Client/{NumberExtensions.ts → Number.ts} +0 -0
  82. /package/src/Client/UI/{FormExtensions.ts → Form.ts} +0 -0
package/ReadMe.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Cédric Belin's Base
2
- ![.NET](https://badgen.net/badge/.net/%3E%3D9.0/green) ![Version](https://badgen.net/badge/project/v0.18.0/blue) ![Licence](https://badgen.net/badge/licence/MIT/blue)
2
+ ![.NET](https://badgen.net/badge/.net/%3E%3D9.0/green) ![Version](https://badgen.net/badge/project/v0.20.0/blue) ![Licence](https://badgen.net/badge/licence/MIT/blue)
3
3
 
4
4
  Base library by [Cédric Belin](https://cedric-belin.fr), full stack developer,
5
5
  implemented in [C#](https://learn.microsoft.com/en-us/dotnet/csharp) and [TypeScript](https://www.typescriptlang.org).
@@ -11,17 +11,17 @@ export declare function atMidnight(date: Date): Date;
11
11
  */
12
12
  export declare function daysInMonth(date: Date): number;
13
13
  /**
14
- * Gets the date of Easter for a given year.
15
- * @param year The year.
16
- * @returns The date of Easter for the specified year.
14
+ * Gets the date of Easter for the year corresponding to the specified date.
15
+ * @param date The date.
16
+ * @returns The date of Easter for the year corresponding to the specified date.
17
17
  */
18
- export declare function getEaster(year?: number): Date;
18
+ export declare function getEaster(date: Date): Date;
19
19
  /**
20
- * Gets the list of holidays for a given year.
21
- * @param year The year.
22
- * @returns The list of holidays for the specified year.
20
+ * Gets the list of holidays for the year corresponding to the specified date.
21
+ * @param date The date.
22
+ * @returns The list of holidays for the year corresponding to the specified date.
23
23
  */
24
- export declare function getHolidays(year?: number): Date[];
24
+ export declare function getHolidays(date: Date): Date[];
25
25
  /**
26
26
  * Gets the quarter corresponding to the specified date.
27
27
  * @param date The date.
@@ -69,4 +69,4 @@ export declare function toYmdHms(date: Date, options?: {
69
69
  excludeTime?: boolean;
70
70
  separator?: string;
71
71
  }): string;
72
- //# sourceMappingURL=DateExtensions.d.ts.map
72
+ //# sourceMappingURL=Date.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Date.d.ts","sourceRoot":"","sources":["../src/Client/Date.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,EAAE,IAAI,GAAG,IAAI,CAc1C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,CAqB9C;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"}
@@ -16,11 +16,12 @@ export function daysInMonth(date) {
16
16
  return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
17
17
  }
18
18
  /**
19
- * Gets the date of Easter for a given year.
20
- * @param year The year.
21
- * @returns The date of Easter for the specified year.
19
+ * Gets the date of Easter for the year corresponding to the specified date.
20
+ * @param date The date.
21
+ * @returns The date of Easter for the year corresponding to the specified date.
22
22
  */
23
- export function getEaster(year = new Date().getFullYear()) {
23
+ export function getEaster(date) {
24
+ const year = date.getFullYear();
24
25
  /* eslint-disable id-length */
25
26
  const n = year % 19;
26
27
  const c = Math.trunc(year / 100);
@@ -33,12 +34,13 @@ export function getEaster(year = new Date().getFullYear()) {
33
34
  return new Date(year, Math.trunc(result / 31) - 1, (result % 31) + 1);
34
35
  }
35
36
  /**
36
- * Gets the list of holidays for a given year.
37
- * @param year The year.
38
- * @returns The list of holidays for the specified year.
37
+ * Gets the list of holidays for the year corresponding to the specified date.
38
+ * @param date The date.
39
+ * @returns The list of holidays for the year corresponding to the specified date.
39
40
  */
40
- export function getHolidays(year = new Date().getFullYear()) {
41
+ export function getHolidays(date) {
41
42
  const holidays = [];
43
+ const year = date.getFullYear();
42
44
  // Fixed holidays.
43
45
  holidays.push(new Date(year, 0, 1)); // New year.
44
46
  holidays.push(new Date(year, 4, 1)); // Labor day.
@@ -49,7 +51,7 @@ export function getHolidays(year = new Date().getFullYear()) {
49
51
  holidays.push(new Date(year, 10, 11)); // Armistice (1918).
50
52
  holidays.push(new Date(year, 11, 25)); // Christmas.
51
53
  // Holidays depending on Easter.
52
- const easter = getEaster(year);
54
+ const easter = getEaster(date);
53
55
  holidays.push(new Date(easter.getTime() + Duration.Day)); // Easter monday.
54
56
  holidays.push(new Date(easter.getTime() + (39 * Duration.Day))); // Ascension thursday.
55
57
  holidays.push(new Date(easter.getTime() + (50 * Duration.Day))); // Pentecost monday.
@@ -89,7 +91,7 @@ export function inLeapYear(date) {
89
91
  */
90
92
  export function isHoliday(date) {
91
93
  const timestamp = atMidnight(date).getTime();
92
- return getHolidays(date.getFullYear()).some(holiday => holiday.getTime() == timestamp);
94
+ return getHolidays(date).some(holiday => holiday.getTime() == timestamp);
93
95
  }
94
96
  /**
95
97
  * Returns a value indicating whether the specified date is a working day.
@@ -22,4 +22,4 @@ export declare function print(file: File): void;
22
22
  * @returns The data URL corresponding to the given file.
23
23
  */
24
24
  export declare function toDataUrl(file: File): Promise<URL>;
25
- //# sourceMappingURL=FileExtensions.d.ts.map
25
+ //# sourceMappingURL=File.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"File.d.ts","sourceRoot":"","sources":["../src/Client/File.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"}
@@ -5,4 +5,4 @@
5
5
  * @returns The value rounded to the given precision.
6
6
  */
7
7
  export declare function round(value: number, precision?: number): number;
8
- //# sourceMappingURL=NumberExtensions.d.ts.map
8
+ //# sourceMappingURL=Number.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Number.d.ts","sourceRoot":"","sources":["../src/Client/Number.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,SAAI,GAAG,MAAM,CAG1D"}
@@ -30,18 +30,6 @@ export declare function split(value: string, splitLength?: number): string[];
30
30
  * @returns The processed string.
31
31
  */
32
32
  export declare function stripTags(value: string): string;
33
- /**
34
- * Removes whitespace from both ends of the items of the specified array.
35
- * @param array The array to process.
36
- * @returns The input array.
37
- */
38
- export declare function trimArray<T>(array: T[]): T[];
39
- /**
40
- * Removes whitespace from both ends of the properties of the specified object.
41
- * @param object The object to process.
42
- * @returns The input object.
43
- */
44
- export declare function trimObject<T>(object: Record<string, T>): Record<string, T>;
45
33
  /**
46
34
  * Truncates the specified string to the given number of characters.
47
35
  * @param value The string to be truncated.
@@ -50,10 +38,4 @@ export declare function trimObject<T>(object: Record<string, T>): Record<string,
50
38
  * @returns The truncated string.
51
39
  */
52
40
  export declare function truncate(value: string, length: number, ellipsis?: string): string;
53
- /**
54
- * Replaces invalid XML characters in a string with their valid XML equivalent.
55
- * @param value The string to process.
56
- * @returns The processed string.
57
- */
58
- export declare function xmlEscape(value: string): string;
59
- //# sourceMappingURL=StringExtensions.d.ts.map
41
+ //# sourceMappingURL=String.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"String.d.ts","sourceRoot":"","sources":["../src/Client/String.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,GAAE,IAAI,CAAC,MAAM,GAAC,MAA2B,GAAG,MAAM,CAEjG;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,SAAI,GAAG,MAAM,EAAE,CAE9D;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,SAAQ,GAAG,MAAM,CAEhF"}
@@ -1,13 +1,3 @@
1
- /**
2
- * The mapping between special characters and the corresponding XML entities.
3
- */
4
- const xmlEntities = new Map([
5
- ["&", "&amp;"],
6
- ["<", "&lt;"],
7
- [">", "&gt;"],
8
- ['"', "&quot;"],
9
- ["'", "&#39;"]
10
- ]);
11
1
  /**
12
2
  * Converts the first character to uppercase.
13
3
  * @param value The string to process.
@@ -50,28 +40,6 @@ export function split(value, splitLength = 1) {
50
40
  export function stripTags(value) {
51
41
  return value.replace(/<[^>]+>/g, "");
52
42
  }
53
- /**
54
- * Removes whitespace from both ends of the items of the specified array.
55
- * @param array The array to process.
56
- * @returns The input array.
57
- */
58
- export function trimArray(array) {
59
- for (const [index, value] of array.entries())
60
- if (typeof value == "string")
61
- Reflect.set(array, index, value.trim());
62
- return array;
63
- }
64
- /**
65
- * Removes whitespace from both ends of the properties of the specified object.
66
- * @param object The object to process.
67
- * @returns The input object.
68
- */
69
- export function trimObject(object) {
70
- for (const [key, value] of Object.entries(object))
71
- if (typeof value == "string")
72
- Reflect.set(object, key, value.trim());
73
- return object;
74
- }
75
43
  /**
76
44
  * Truncates the specified string to the given number of characters.
77
45
  * @param value The string to be truncated.
@@ -82,11 +50,3 @@ export function trimObject(object) {
82
50
  export function truncate(value, length, ellipsis = "...") {
83
51
  return value.length > length ? value.slice(0, length) + ellipsis : value;
84
52
  }
85
- /**
86
- * Replaces invalid XML characters in a string with their valid XML equivalent.
87
- * @param value The string to process.
88
- * @returns The processed string.
89
- */
90
- export function xmlEscape(value) {
91
- return value.replace(/[&<>"']/g, character => xmlEntities.get(character) ?? character);
92
- }
@@ -3,6 +3,22 @@
3
3
  */
4
4
  export declare class LoadingIndicator extends HTMLElement {
5
5
  #private;
6
+ /**
7
+ * The list of observed attributes.
8
+ */
9
+ static readonly observedAttributes: string[];
10
+ /**
11
+ * Value indicating whether to apply a transition.
12
+ */
13
+ get animation(): boolean;
14
+ set animation(value: boolean);
15
+ /**
16
+ * Method invoked when an attribute has been changed.
17
+ * @param attribute The attribute name.
18
+ * @param oldValue The previous attribute value.
19
+ * @param newValue The new attribute value.
20
+ */
21
+ attributeChangedCallback(attribute: string, oldValue: string | null, newValue: string | null): void;
6
22
  /**
7
23
  * Hides the loading indicator.
8
24
  * @param options Value indicating whether to force the loading indicator to hide.
@@ -1 +1 @@
1
- {"version":3,"file":"LoadingIndicator.d.ts","sourceRoot":"","sources":["../../../src/Client/UI/Components/LoadingIndicator.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;;IAchD;;;OAGG;IACH,IAAI,CAAC,OAAO,GAAE;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAM,GAAG,IAAI;IAQ3C;;OAEG;IACH,IAAI,IAAI,IAAI;CAIZ;AAED;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,qBAAqB;QAC9B,mBAAmB,EAAE,gBAAgB,CAAC;KACtC;CACD"}
1
+ {"version":3,"file":"LoadingIndicator.d.ts","sourceRoot":"","sources":["../../../src/Client/UI/Components/LoadingIndicator.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;;IAEhD;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,kBAAkB,WAAiB;IAcnD;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IACD,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,EAE3B;IAED;;;;;OAKG;IACH,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAC,IAAI,GAAG,IAAI;IAO/F;;;OAGG;IACH,IAAI,CAAC,OAAO,GAAE;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAM,GAAG,IAAI;IAU3C;;OAEG;IACH,IAAI,IAAI,IAAI;CAcZ;AAED;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,qBAAqB;QAC9B,mBAAmB,EAAE,gBAAgB,CAAC;KACtC;CACD"}
@@ -2,6 +2,10 @@
2
2
  * A component that shows up when an HTTP request starts, and hides when all concurrent HTTP requests are completed.
3
3
  */
4
4
  export class LoadingIndicator extends HTMLElement {
5
+ /**
6
+ * The list of observed attributes.
7
+ */
8
+ static observedAttributes = ["animation"];
5
9
  /**
6
10
  * The number of concurrent HTTP requests.
7
11
  */
@@ -12,6 +16,30 @@ export class LoadingIndicator extends HTMLElement {
12
16
  static {
13
17
  customElements.define("loading-indicator", this);
14
18
  }
19
+ /**
20
+ * Value indicating whether to apply a transition.
21
+ */
22
+ get animation() {
23
+ return this.hasAttribute("animation");
24
+ }
25
+ set animation(value) {
26
+ this.toggleAttribute("animation", value);
27
+ }
28
+ /**
29
+ * Method invoked when an attribute has been changed.
30
+ * @param attribute The attribute name.
31
+ * @param oldValue The previous attribute value.
32
+ * @param newValue The new attribute value.
33
+ */
34
+ attributeChangedCallback(attribute, oldValue, newValue) {
35
+ if (newValue != oldValue)
36
+ switch (attribute) {
37
+ case "animation":
38
+ this.#updateAnimation(newValue != null);
39
+ break;
40
+ // No default
41
+ }
42
+ }
15
43
  /**
16
44
  * Hides the loading indicator.
17
45
  * @param options Value indicating whether to force the loading indicator to hide.
@@ -20,7 +48,9 @@ export class LoadingIndicator extends HTMLElement {
20
48
  this.#requestCount--;
21
49
  if (this.#requestCount <= 0 || options.force) {
22
50
  this.#requestCount = 0;
23
- this.hidden = true;
51
+ this.classList.add("hide");
52
+ this.classList.remove("show");
53
+ document.body.classList.remove("loading");
24
54
  }
25
55
  }
26
56
  /**
@@ -28,6 +58,15 @@ export class LoadingIndicator extends HTMLElement {
28
58
  */
29
59
  show() {
30
60
  this.#requestCount++;
31
- this.hidden = false;
61
+ this.classList.remove("hide");
62
+ this.classList.add("show");
63
+ document.body.classList.add("loading");
64
+ }
65
+ /**
66
+ * Updates the value indicating whether to apply a transition.
67
+ * @param value The new value.
68
+ */
69
+ #updateAnimation(value) {
70
+ this.classList.toggle("fade", value);
32
71
  }
33
72
  }
@@ -6,13 +6,13 @@ import type { IDialogButton } from "./DialogButton.js";
6
6
  */
7
7
  export interface IMessage {
8
8
  /**
9
- * Value indicating whether to apply a fade transition.
9
+ * Value indicating whether to apply a transition.
10
10
  */
11
11
  animation?: boolean;
12
12
  /**
13
13
  * The child content displayed in the body.
14
14
  */
15
- body: DocumentFragment | string;
15
+ body: DocumentFragment;
16
16
  /**
17
17
  * The title displayed in the header.
18
18
  */
@@ -28,7 +28,7 @@ export interface IMessage {
28
28
  /**
29
29
  * The child content displayed in the footer.
30
30
  */
31
- footer?: DocumentFragment | string;
31
+ footer?: DocumentFragment;
32
32
  /**
33
33
  * The icon displayed next to the body.
34
34
  */
@@ -52,7 +52,7 @@ export declare class MessageBox extends HTMLElement {
52
52
  */
53
53
  constructor();
54
54
  /**
55
- * Value indicating whether to apply a fade transition.
55
+ * Value indicating whether to apply a transition.
56
56
  */
57
57
  get animation(): boolean;
58
58
  set animation(value: boolean);
@@ -113,7 +113,7 @@ export declare class MessageBox extends HTMLElement {
113
113
  * @param body The child content displayed in the body.
114
114
  * @returns The dialog box result.
115
115
  */
116
- alert(context: Context, caption: string, body: DocumentFragment | string): Promise<DialogResult>;
116
+ alert(context: Context, caption: string, body: DocumentFragment): Promise<DialogResult>;
117
117
  /**
118
118
  * Closes this message box.
119
119
  * @param result The dialog box result.
@@ -126,7 +126,7 @@ export declare class MessageBox extends HTMLElement {
126
126
  * @param body The child content displayed in the body.
127
127
  * @returns The dialog box result.
128
128
  */
129
- confirm(context: Context, caption: string, body: DocumentFragment | string): Promise<DialogResult>;
129
+ confirm(context: Context, caption: string, body: DocumentFragment): Promise<DialogResult>;
130
130
  /**
131
131
  * Method invoked when this component is connected.
132
132
  */
@@ -149,7 +149,7 @@ export declare class MessageBox extends HTMLElement {
149
149
  * @param buttons The buttons displayed in the footer.
150
150
  * @returns The dialog box result.
151
151
  */
152
- show(context: Context, caption: string, body: DocumentFragment | string, buttons?: IDialogButton[]): Promise<DialogResult>;
152
+ show(context: Context, caption: string, body: DocumentFragment, buttons?: IDialogButton[]): Promise<DialogResult>;
153
153
  }
154
154
  /**
155
155
  * Declaration merging.
@@ -1 +1 @@
1
- {"version":3,"file":"MessageBox.d.ts","sourceRoot":"","sources":["../../../src/Client/UI/Components/MessageBox.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAiB,MAAM,eAAe,CAAC;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAGhD,OAAO,KAAK,EAAe,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,QAAQ;IAExB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,IAAI,EAAE,gBAAgB,GAAC,MAAM,CAAC;IAE9B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,MAAM,CAAC,EAAE,gBAAgB,GAAC,MAAM,CAAC;IAEjC;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAC,IAAI,CAAC;IAEnB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,WAAW;;IAE1C;;OAEG;IACH,MAAM,CAAC,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B,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAC,IAAI,GAAG,IAAI;IAa/F;;;;;;OAMG;IACG,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC;IAM7F;;;OAGG;IACH,KAAK,CAAC,MAAM,GAAE,YAAgC,GAAG,IAAI;IAKrD;;;;;;OAMG;IACG,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC;IAO/F;;OAEG;IACH,iBAAiB,IAAI,IAAI;IAKzB;;OAEG;IACH,oBAAoB,IAAI,IAAI;IAI5B;;;;OAIG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;IAE/C;;;;;;;OAOG;IACH,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,YAAY,CAAC;CAwHjH;AAED;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,qBAAqB;QAC9B,aAAa,EAAE,UAAU,CAAC;KAC1B;CACD"}
@@ -1,7 +1,6 @@
1
1
  import { Modal } from "bootstrap";
2
2
  import { Context, getIcon, toCss } from "../Context.js";
3
3
  import { DialogResult } from "../DialogResult.js";
4
- import { createDocumentFragment } from "../ElementExtensions.js";
5
4
  import { Variant } from "../Variant.js";
6
5
  /**
7
6
  * Displays a message window, also known as dialog box, which presents a message to the user.
@@ -44,7 +43,7 @@ export class MessageBox extends HTMLElement {
44
43
  customElements.define("message-box", this);
45
44
  }
46
45
  /**
47
- * Value indicating whether to apply a fade transition.
46
+ * Value indicating whether to apply a transition.
48
47
  */
49
48
  get animation() {
50
49
  return this.hasAttribute("animation");
@@ -219,18 +218,18 @@ export class MessageBox extends HTMLElement {
219
218
  * @param buttons The buttons displayed in the footer.
220
219
  * @returns The dialog box result.
221
220
  */
222
- show(message = null, caption = "", body = "", buttons = []) {
221
+ show(message = null, caption = "", body = document.createDocumentFragment(), buttons = []) {
223
222
  if (typeof message == "string") {
224
223
  const footer = document.createDocumentFragment();
225
224
  footer.append(...buttons.map(button => this.#createButton(button)));
226
225
  message = { context: message, caption, body, footer };
227
226
  }
228
227
  if (typeof message == "object" && message) {
229
- this.body = typeof message.body == "string" ? createDocumentFragment(message.body) : message.body;
228
+ this.body = message.body;
230
229
  this.caption = message.caption;
231
230
  this.context = message.context ?? Context.Info;
232
231
  this.icon = message.icon ?? getIcon(this.context);
233
- const footer = typeof message.footer == "string" ? createDocumentFragment(message.footer) : (message.footer ?? document.createDocumentFragment());
232
+ const footer = message.footer ?? document.createDocumentFragment();
234
233
  for (const button of footer.querySelectorAll("button"))
235
234
  button.addEventListener("click", this.#close);
236
235
  this.footer = footer;
@@ -3,6 +3,22 @@
3
3
  */
4
4
  export declare class OfflineIndicator extends HTMLElement {
5
5
  #private;
6
+ /**
7
+ * The list of observed attributes.
8
+ */
9
+ static readonly observedAttributes: string[];
10
+ /**
11
+ * Value indicating whether to apply a transition.
12
+ */
13
+ get animation(): boolean;
14
+ set animation(value: boolean);
15
+ /**
16
+ * Method invoked when an attribute has been changed.
17
+ * @param attribute The attribute name.
18
+ * @param oldValue The previous attribute value.
19
+ * @param newValue The new attribute value.
20
+ */
21
+ attributeChangedCallback(attribute: string, oldValue: string | null, newValue: string | null): void;
6
22
  /**
7
23
  * Method invoked when this component is connected.
8
24
  */
@@ -1 +1 @@
1
- {"version":3,"file":"OfflineIndicator.d.ts","sourceRoot":"","sources":["../../../src/Client/UI/Components/OfflineIndicator.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;;IAShD;;OAEG;IACH,iBAAiB,IAAI,IAAI;IAKzB;;OAEG;IACH,oBAAoB,IAAI,IAAI;CAQ5B;AAED;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,qBAAqB;QAC9B,mBAAmB,EAAE,gBAAgB,CAAC;KACtC;CACD"}
1
+ {"version":3,"file":"OfflineIndicator.d.ts","sourceRoot":"","sources":["../../../src/Client/UI/Components/OfflineIndicator.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,WAAW;;IAEhD;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,kBAAkB,WAAiB;IASnD;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IACD,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,EAE3B;IAED;;;;;OAKG;IACH,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAC,IAAI,GAAG,IAAI;IAO/F;;OAEG;IACH,iBAAiB,IAAI,IAAI;IAKzB;;OAEG;IACH,oBAAoB,IAAI,IAAI;CAmB5B;AAED;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,qBAAqB;QAC9B,mBAAmB,EAAE,gBAAgB,CAAC;KACtC;CACD"}
@@ -2,12 +2,40 @@
2
2
  * A component that shows up when the network is unavailable, and hides when connectivity is restored.
3
3
  */
4
4
  export class OfflineIndicator extends HTMLElement {
5
+ /**
6
+ * The list of observed attributes.
7
+ */
8
+ static observedAttributes = ["animation"];
5
9
  /**
6
10
  * Registers the component.
7
11
  */
8
12
  static {
9
13
  customElements.define("offline-indicator", this);
10
14
  }
15
+ /**
16
+ * Value indicating whether to apply a transition.
17
+ */
18
+ get animation() {
19
+ return this.hasAttribute("animation");
20
+ }
21
+ set animation(value) {
22
+ this.toggleAttribute("animation", value);
23
+ }
24
+ /**
25
+ * Method invoked when an attribute has been changed.
26
+ * @param attribute The attribute name.
27
+ * @param oldValue The previous attribute value.
28
+ * @param newValue The new attribute value.
29
+ */
30
+ attributeChangedCallback(attribute, oldValue, newValue) {
31
+ if (newValue != oldValue)
32
+ switch (attribute) {
33
+ case "animation":
34
+ this.#updateAnimation(newValue != null);
35
+ break;
36
+ // No default
37
+ }
38
+ }
11
39
  /**
12
40
  * Method invoked when this component is connected.
13
41
  */
@@ -23,8 +51,18 @@ export class OfflineIndicator extends HTMLElement {
23
51
  for (const event of ["online", "offline"])
24
52
  removeEventListener(event, this.#update);
25
53
  }
54
+ /**
55
+ * Updates the value indicating whether to apply a transition.
56
+ * @param value The new value.
57
+ */
58
+ #updateAnimation(value) {
59
+ this.classList.toggle("fade", value);
60
+ }
26
61
  /**
27
62
  * Updates this component.
28
63
  */
29
- #update = () => this.hidden = navigator.onLine;
64
+ #update = () => {
65
+ this.classList.toggle("hide", navigator.onLine);
66
+ this.classList.toggle("show", !navigator.onLine);
67
+ };
30
68
  }
@@ -4,7 +4,7 @@ import { Context } from "../Context.js";
4
4
  */
5
5
  export interface IToast {
6
6
  /**
7
- * Value indicating whether to apply a fade transition.
7
+ * Value indicating whether to apply a transition.
8
8
  */
9
9
  animation?: boolean;
10
10
  /**
@@ -14,7 +14,7 @@ export interface IToast {
14
14
  /**
15
15
  * The child content displayed in the body.
16
16
  */
17
- body: DocumentFragment | string;
17
+ body: DocumentFragment;
18
18
  /**
19
19
  * The title displayed in the header.
20
20
  */
@@ -46,7 +46,7 @@ export declare class Toast extends HTMLElement {
46
46
  */
47
47
  static readonly observedAttributes: string[];
48
48
  /**
49
- * Value indicating whether to apply a fade transition.
49
+ * Value indicating whether to apply a transition.
50
50
  */
51
51
  get animation(): boolean;
52
52
  set animation(value: boolean);
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../src/Client/UI/Components/Toast.ts"],"names":[],"mappings":"AACA,OAAO,EAAC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G,IAAI;IAa/F;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,iBAAiB,IAAI,IAAI;IASzB;;OAEG;IACH,oBAAoB,IAAI,IAAI;IAK5B;;OAEG;IACH,IAAI,IAAI,IAAI;CAwFZ;AAED;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,qBAAqB;QAC9B,cAAc,EAAE,KAAK,CAAC;KACtB;CACD"}
@@ -35,7 +35,7 @@ export class Toast extends HTMLElement {
35
35
  customElements.define("toaster-item", this);
36
36
  }
37
37
  /**
38
- * Value indicating whether to apply a fade transition.
38
+ * Value indicating whether to apply a transition.
39
39
  */
40
40
  get animation() {
41
41
  return this.hasAttribute("animation");
@@ -206,7 +206,7 @@ export class Toast extends HTMLElement {
206
206
  return this.#formatter.format(Math.ceil(-elapsed), Toast.#timeUnits[index]);
207
207
  }
208
208
  /**
209
- * Updates the value indicating whether to apply a fade transition.
209
+ * Updates the value indicating whether to apply a transition.
210
210
  * @param value The new value.
211
211
  */
212
212
  #updateAnimation(value) {
@@ -15,7 +15,7 @@ export declare class Toaster extends HTMLElement {
15
15
  */
16
16
  constructor();
17
17
  /**
18
- * Value indicating whether to apply a fade transition.
18
+ * Value indicating whether to apply a transition.
19
19
  */
20
20
  get animation(): boolean;
21
21
  set animation(value: boolean);
@@ -62,7 +62,7 @@ export declare class Toaster extends HTMLElement {
62
62
  * @param caption The title displayed in the toast header.
63
63
  * @param body The child content displayed in the toast body.
64
64
  */
65
- show(context: Context, caption: string, body: DocumentFragment | string): void;
65
+ show(context: Context, caption: string, body: DocumentFragment): void;
66
66
  /**
67
67
  * Shows a toast.
68
68
  * @param toast The toast to show.
@@ -1 +1 @@
1
- {"version":3,"file":"Toaster.d.ts","sourceRoot":"","sources":["../../../src/Client/UI/Components/Toaster.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AAEtC,OAAO,EAAC,QAAQ,EAA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AAK,EAAE,QAAQ,EAE3B;IAED;;;;;OAKG;IACH,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAC,IAAI,GAAG,IAAI;IAO/F;;;;;OAKG;IACH,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,GAAG,IAAI;IAErE;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CAsCzB;AAED;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,qBAAqB;QAC9B,mBAAmB,EAAE,OAAO,CAAC;KAC7B;CACD"}
@@ -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
  /**
5
4
  * Manages the notifications.
@@ -28,7 +27,7 @@ export class Toaster extends HTMLElement {
28
27
  customElements.define("toaster-container", this);
29
28
  }
30
29
  /**
31
- * Value indicating whether to apply a fade transition.
30
+ * Value indicating whether to apply a transition.
32
31
  */
33
32
  get animation() {
34
33
  return this.hasAttribute("animation");
@@ -119,7 +118,7 @@ export class Toaster extends HTMLElement {
119
118
  * @param caption The title displayed in the toast header.
120
119
  * @param body The child content displayed in the toast body.
121
120
  */
122
- show(toast, caption = "", body = "") {
121
+ show(toast, caption = "", body = document.createDocumentFragment()) {
123
122
  if (typeof toast == "string")
124
123
  toast = { context: toast, caption, body };
125
124
  const item = document.createElement("toaster-item");
@@ -128,7 +127,7 @@ export class Toaster extends HTMLElement {
128
127
  item.appendChild(childContent);
129
128
  item.animation = toast.animation ?? this.animation;
130
129
  item.autoHide = toast.autoHide ?? this.autoHide;
131
- item.body = typeof toast.body == "string" ? createDocumentFragment(toast.body) : toast.body;
130
+ item.body = toast.body;
132
131
  item.caption = toast.caption;
133
132
  item.context = toast.context ?? this.context;
134
133
  item.culture = toast.culture ?? this.culture;
@@ -30,4 +30,4 @@ export declare function resetValidity(element: Element): void;
30
30
  * @param element The element to process.
31
31
  */
32
32
  export declare function trimControl(element: Element): void;
33
- //# sourceMappingURL=FormExtensions.d.ts.map
33
+ //# sourceMappingURL=Form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../src/Client/UI/Form.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAC,iBAAiB,GAAC,mBAAmB,CAAC;AAEjF;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,WAAW,EAAE,CAEpE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,eAAe,GAAG,WAAW,GAAC,IAAI,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,WAAW,CAEtE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAGpD;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAIlD"}