@cedx/base 0.6.0 → 0.8.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 (134) hide show
  1. package/ReadMe.md +1 -1
  2. package/lib/Data/Pagination.d.ts +30 -13
  3. package/lib/Data/Pagination.d.ts.map +1 -1
  4. package/lib/Data/Pagination.js +39 -12
  5. package/lib/Data/Sort.d.ts +25 -23
  6. package/lib/Data/Sort.d.ts.map +1 -1
  7. package/lib/Data/Sort.js +37 -33
  8. package/lib/{Date.d.ts → DateExtensions.d.ts} +1 -1
  9. package/lib/DateExtensions.d.ts.map +1 -0
  10. package/lib/{Html/File.d.ts → FileExtensions.d.ts} +4 -11
  11. package/lib/FileExtensions.d.ts.map +1 -0
  12. package/lib/{Html/File.js → FileExtensions.js} +4 -13
  13. package/lib/Hosting/Environment.d.ts +22 -0
  14. package/lib/Hosting/Environment.d.ts.map +1 -0
  15. package/lib/Hosting/Environment.js +17 -0
  16. package/lib/Hosting/HostEnvironment.d.ts +61 -0
  17. package/lib/Hosting/HostEnvironment.d.ts.map +1 -0
  18. package/lib/Hosting/HostEnvironment.js +56 -0
  19. package/lib/Net/Http/HttpMethod.d.ts +46 -0
  20. package/lib/Net/Http/HttpMethod.d.ts.map +1 -0
  21. package/lib/Net/Http/HttpMethod.js +41 -0
  22. package/lib/Net/Http/StatusCode.d.ts +122 -0
  23. package/lib/Net/Http/StatusCode.d.ts.map +1 -0
  24. package/lib/Net/Http/StatusCode.js +117 -0
  25. package/lib/Net/Mime/DispositionType.d.ts +18 -0
  26. package/lib/Net/Mime/DispositionType.d.ts.map +1 -0
  27. package/lib/Net/Mime/DispositionType.js +13 -0
  28. package/lib/Net/Mime/MediaType.d.ts +151 -0
  29. package/lib/Net/Mime/MediaType.d.ts.map +1 -0
  30. package/lib/Net/Mime/MediaType.js +150 -0
  31. package/lib/{Number.d.ts → NumberExtensions.d.ts} +1 -1
  32. package/lib/NumberExtensions.d.ts.map +1 -0
  33. package/lib/{String.d.ts → StringExtensions.d.ts} +1 -1
  34. package/lib/StringExtensions.d.ts.map +1 -0
  35. package/lib/{Html → UI}/AppTheme.d.ts +3 -3
  36. package/lib/UI/AppTheme.d.ts.map +1 -0
  37. package/lib/{Html → UI}/AppTheme.js +3 -3
  38. package/lib/UI/{Component.d.ts → Components/ComponentBase.d.ts} +5 -5
  39. package/lib/UI/Components/ComponentBase.d.ts.map +1 -0
  40. package/lib/UI/Components/ComponentBase.js +29 -0
  41. package/lib/UI/{LoadingIndicator.d.ts → Components/LoadingIndicator.d.ts} +1 -2
  42. package/lib/UI/Components/LoadingIndicator.d.ts.map +1 -0
  43. package/lib/UI/Components/MenuActivator.d.ts.map +1 -0
  44. package/lib/UI/Components/OfflineIndicator.d.ts.map +1 -0
  45. package/lib/UI/Components/ThemeDropdown.d.ts +67 -0
  46. package/lib/UI/Components/ThemeDropdown.d.ts.map +1 -0
  47. package/lib/UI/Components/ThemeDropdown.js +140 -0
  48. package/lib/UI/Context.d.ts.map +1 -0
  49. package/lib/UI/FormExtensions.d.ts +33 -0
  50. package/lib/UI/FormExtensions.d.ts.map +1 -0
  51. package/lib/UI/FormExtensions.js +50 -0
  52. package/lib/UI/MenuAlignment.d.ts +18 -0
  53. package/lib/UI/MenuAlignment.d.ts.map +1 -0
  54. package/lib/UI/MenuAlignment.js +13 -0
  55. package/lib/{Html → UI}/ViewportScroller.d.ts +1 -1
  56. package/lib/UI/ViewportScroller.d.ts.map +1 -0
  57. package/lib/{Html → UI}/ViewportScroller.js +6 -6
  58. package/package.json +5 -10
  59. package/src/Client/Data/Pagination.ts +59 -13
  60. package/src/Client/Data/Sort.ts +40 -35
  61. package/src/Client/Data/tsconfig.json +1 -1
  62. package/src/Client/{Html/File.ts → FileExtensions.ts} +4 -14
  63. package/src/Client/Hosting/Environment.ts +25 -0
  64. package/src/Client/Hosting/HostEnvironment.ts +86 -0
  65. package/src/Client/{Abstractions → Hosting}/tsconfig.json +3 -3
  66. package/src/Client/Net/Http/HttpMethod.ts +55 -0
  67. package/src/Client/Net/Http/StatusCode.ts +150 -0
  68. package/src/Client/Net/Mime/DispositionType.ts +20 -0
  69. package/src/Client/Net/Mime/MediaType.ts +185 -0
  70. package/src/Client/{DependencyInjection → Net}/tsconfig.json +3 -3
  71. package/src/Client/{Html → UI}/AppTheme.ts +3 -3
  72. package/src/Client/UI/Components/ComponentBase.ts +34 -0
  73. package/src/Client/UI/{LoadingIndicator.ts → Components/LoadingIndicator.ts} +1 -3
  74. package/src/Client/UI/Components/ThemeDropdown.ts +163 -0
  75. package/src/Client/UI/FormExtensions.ts +55 -0
  76. package/src/Client/UI/MenuAlignment.ts +20 -0
  77. package/src/Client/{Html → UI}/ViewportScroller.ts +6 -6
  78. package/src/Client/UI/tsconfig.json +2 -6
  79. package/src/Client/tsconfig.json +2 -4
  80. package/lib/Abstractions/ILoadingIndicator.d.ts +0 -17
  81. package/lib/Abstractions/ILoadingIndicator.d.ts.map +0 -1
  82. package/lib/Abstractions/ILoadingIndicator.js +0 -1
  83. package/lib/Date.d.ts.map +0 -1
  84. package/lib/DependencyInjection/Container.d.ts +0 -43
  85. package/lib/DependencyInjection/Container.d.ts.map +0 -1
  86. package/lib/DependencyInjection/Container.js +0 -65
  87. package/lib/Html/AppTheme.d.ts.map +0 -1
  88. package/lib/Html/Context.d.ts.map +0 -1
  89. package/lib/Html/File.d.ts.map +0 -1
  90. package/lib/Html/ViewportScroller.d.ts.map +0 -1
  91. package/lib/Http/HttpClient.d.ts +0 -68
  92. package/lib/Http/HttpClient.d.ts.map +0 -1
  93. package/lib/Http/HttpClient.js +0 -102
  94. package/lib/Http/HttpError.d.ts +0 -33
  95. package/lib/Http/HttpError.d.ts.map +0 -1
  96. package/lib/Http/HttpError.js +0 -66
  97. package/lib/Http/StatusCodes.d.ts +0 -114
  98. package/lib/Http/StatusCodes.d.ts.map +0 -1
  99. package/lib/Http/StatusCodes.js +0 -109
  100. package/lib/Number.d.ts.map +0 -1
  101. package/lib/String.d.ts.map +0 -1
  102. package/lib/UI/Component.d.ts.map +0 -1
  103. package/lib/UI/Component.js +0 -29
  104. package/lib/UI/LoadingIndicator.d.ts.map +0 -1
  105. package/lib/UI/MenuActivator.d.ts.map +0 -1
  106. package/lib/UI/OfflineIndicator.d.ts.map +0 -1
  107. package/lib/UI/ThemeDropdown.d.ts +0 -40
  108. package/lib/UI/ThemeDropdown.d.ts.map +0 -1
  109. package/lib/UI/ThemeDropdown.js +0 -80
  110. package/src/Client/Abstractions/ILoadingIndicator.ts +0 -16
  111. package/src/Client/DependencyInjection/Container.ts +0 -75
  112. package/src/Client/Html/tsconfig.json +0 -16
  113. package/src/Client/Http/HttpClient.ts +0 -127
  114. package/src/Client/Http/HttpError.ts +0 -75
  115. package/src/Client/Http/StatusCodes.ts +0 -140
  116. package/src/Client/Http/tsconfig.json +0 -16
  117. package/src/Client/UI/Component.ts +0 -34
  118. package/src/Client/UI/ThemeDropdown.ts +0 -104
  119. /package/lib/{Date.js → DateExtensions.js} +0 -0
  120. /package/lib/{Number.js → NumberExtensions.js} +0 -0
  121. /package/lib/{String.js → StringExtensions.js} +0 -0
  122. /package/lib/UI/{LoadingIndicator.js → Components/LoadingIndicator.js} +0 -0
  123. /package/lib/UI/{MenuActivator.d.ts → Components/MenuActivator.d.ts} +0 -0
  124. /package/lib/UI/{MenuActivator.js → Components/MenuActivator.js} +0 -0
  125. /package/lib/UI/{OfflineIndicator.d.ts → Components/OfflineIndicator.d.ts} +0 -0
  126. /package/lib/UI/{OfflineIndicator.js → Components/OfflineIndicator.js} +0 -0
  127. /package/lib/{Html → UI}/Context.d.ts +0 -0
  128. /package/lib/{Html → UI}/Context.js +0 -0
  129. /package/src/Client/{Date.ts → DateExtensions.ts} +0 -0
  130. /package/src/Client/{Number.ts → NumberExtensions.ts} +0 -0
  131. /package/src/Client/{String.ts → StringExtensions.ts} +0 -0
  132. /package/src/Client/UI/{MenuActivator.ts → Components/MenuActivator.ts} +0 -0
  133. /package/src/Client/UI/{OfflineIndicator.ts → Components/OfflineIndicator.ts} +0 -0
  134. /package/src/Client/{Html → UI}/Context.ts +0 -0
@@ -0,0 +1,150 @@
1
+ /**
2
+ * Provides the strings used to specify the media type.
3
+ */
4
+ export const MediaType = Object.freeze({
5
+ /**
6
+ * Specifies the kind of application data.
7
+ */
8
+ Application: Object.freeze({
9
+ /**
10
+ * Specifies that the application data consists of url-encoded key-value pairs.
11
+ */
12
+ FormUrlEncoded: "application/x-www-form-urlencoded",
13
+ /**
14
+ * Specifies that the application data is in gzip format.
15
+ */
16
+ GZip: "application/gzip",
17
+ /**
18
+ * Specifies that the application data is in JSON format.
19
+ */
20
+ Json: "application/json",
21
+ /**
22
+ * Specifies that the application data is in Web Application Manifest.
23
+ */
24
+ Manifest: "application/manifest+json",
25
+ /**
26
+ * Specifies that the application data is not interpreted.
27
+ */
28
+ Octet: "application/octet-stream",
29
+ /**
30
+ * Specifies that the application data is in Portable Document Format (PDF).
31
+ */
32
+ Pdf: "application/pdf",
33
+ /**
34
+ * Specifies that the application data is a SOAP document.
35
+ */
36
+ Soap: "application/soap+xml",
37
+ /**
38
+ * Specifies that the application data is in WASM format.
39
+ */
40
+ Wasm: "application/wasm",
41
+ /**
42
+ * Specifies that the application data is in XML format.
43
+ */
44
+ Xml: "application/xml",
45
+ /**
46
+ * Specifies that the application data is compressed.
47
+ */
48
+ Zip: "application/zip"
49
+ }),
50
+ /**
51
+ * Specifies the kind of font data.
52
+ */
53
+ Font: Object.freeze({
54
+ /**
55
+ * Specifies that the font data is in TrueType font (TTF) format.
56
+ */
57
+ Ttf: "font/ttf",
58
+ /**
59
+ * Specifies that the font data is in WOFF format.
60
+ */
61
+ Woff: "font/woff",
62
+ /**
63
+ * Specifies that the font data is in WOFF2 format.
64
+ */
65
+ Woff2: "font/woff2"
66
+ }),
67
+ /**
68
+ * Specifies the kind of image data.
69
+ */
70
+ Image: Object.freeze({
71
+ /**
72
+ * Specifies that the image data is in AVIF format.
73
+ */
74
+ Avif: "image/avif",
75
+ /**
76
+ * Specifies that the image data is in GIF format.
77
+ */
78
+ Gif: "image/gif",
79
+ /**
80
+ * Specifies that the image data is in ICO format.
81
+ */
82
+ Icon: "image/x-icon",
83
+ /**
84
+ * Specifies that the image data is in JPEG format.
85
+ */
86
+ Jpeg: "image/jpeg",
87
+ /**
88
+ * Specifies that the image data is in PNG format.
89
+ */
90
+ Png: "image/png",
91
+ /**
92
+ * Specifies that the image data is in SVG format.
93
+ */
94
+ Svg: "image/svg+xml",
95
+ /**
96
+ * Specifies that the image data is in WEBP format.
97
+ */
98
+ WebP: "image/webp"
99
+ }),
100
+ /**
101
+ * Specifies the kind of multipart data.
102
+ */
103
+ Multipart: Object.freeze({
104
+ /**
105
+ * Specifies that the multipart data is in form data format.
106
+ */
107
+ FormData: "multipart/form-data",
108
+ /**
109
+ * Specifies that the multipart data is in mixed format.
110
+ */
111
+ Mixed: "multipart/mixed"
112
+ }),
113
+ /**
114
+ * Specifies the kind of text data.
115
+ */
116
+ Text: Object.freeze({
117
+ /**
118
+ * Specifies that the text data is in CSS format.
119
+ */
120
+ Css: "text/css",
121
+ /**
122
+ * Specifies that the text data is in CSV format.
123
+ */
124
+ Csv: "text/csv",
125
+ /**
126
+ * Specifies that the text data is in event stream format.
127
+ */
128
+ EventStream: "text/event-stream",
129
+ /**
130
+ * Specifies that the text data is in HTML format.
131
+ */
132
+ Html: "text/html",
133
+ /**
134
+ * Specifies that the text data is in JavaScript format.
135
+ */
136
+ JavaScript: "text/javascript",
137
+ /**
138
+ * Specifies that the text data is in Markdown format.
139
+ */
140
+ Markdown: "text/markdown",
141
+ /**
142
+ * Specifies that the text data is in plain text format.
143
+ */
144
+ Plain: "text/plain",
145
+ /**
146
+ * Specifies that the text data is in XML format.
147
+ */
148
+ Xml: "text/xml"
149
+ })
150
+ });
@@ -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=Number.d.ts.map
8
+ //# sourceMappingURL=NumberExtensions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NumberExtensions.d.ts","sourceRoot":"","sources":["../src/Client/NumberExtensions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,SAAI,GAAG,MAAM,CAG1D"}
@@ -56,4 +56,4 @@ export declare function truncate(value: string, length: number, ellipsis?: strin
56
56
  * @returns The processed string.
57
57
  */
58
58
  export declare function xmlEscape(value: string): string;
59
- //# sourceMappingURL=String.d.ts.map
59
+ //# sourceMappingURL=StringExtensions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StringExtensions.d.ts","sourceRoot":"","sources":["../src/Client/StringExtensions.ts"],"names":[],"mappings":"AAWA;;;;;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;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAG5C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAG1E;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,SAAQ,GAAG,MAAM,CAEhF;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C"}
@@ -3,15 +3,15 @@
3
3
  */
4
4
  export declare const AppTheme: Readonly<{
5
5
  /**
6
- * The system predefined theme mode.
6
+ * The system theme.
7
7
  */
8
8
  System: "System";
9
9
  /**
10
- * The light predefined theme mode.
10
+ * The light theme.
11
11
  */
12
12
  Light: "Light";
13
13
  /**
14
- * The dark predefined theme mode.
14
+ * The dark theme.
15
15
  */
16
16
  Dark: "Dark";
17
17
  }>;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AppTheme.d.ts","sourceRoot":"","sources":["../../src/Client/UI/AppTheme.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,QAAQ;IAEpB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;EAEF,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;AAE9D;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAM/C;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAMhD"}
@@ -3,15 +3,15 @@
3
3
  */
4
4
  export const AppTheme = Object.freeze({
5
5
  /**
6
- * The system predefined theme mode.
6
+ * The system theme.
7
7
  */
8
8
  System: "System",
9
9
  /**
10
- * The light predefined theme mode.
10
+ * The light theme.
11
11
  */
12
12
  Light: "Light",
13
13
  /**
14
- * The dark predefined theme mode.
14
+ * The dark theme.
15
15
  */
16
16
  Dark: "Dark"
17
17
  });
@@ -1,8 +1,8 @@
1
1
  import { LitElement, type CSSResultGroup } from "lit";
2
2
  /**
3
- * The optional base class for UI components. Alternatively, components may extend {@link LitElement} directly.
3
+ * Optional base class for UI components. Alternatively, components may extend {@link LitElement} directly.
4
4
  */
5
- export declare abstract class Component extends LitElement {
5
+ export declare abstract class ComponentBase extends LitElement {
6
6
  #private;
7
7
  /**
8
8
  * The component styles.
@@ -10,10 +10,10 @@ export declare abstract class Component extends LitElement {
10
10
  static styles: CSSResultGroup;
11
11
  /**
12
12
  * Creates a new component.
13
- * @param options Value indicating whether this component uses a shadow root.
13
+ * @param options Value indicating whether a shadow DOM tree should be attached to this component.
14
14
  */
15
15
  constructor(options?: {
16
- shadowRoot?: boolean;
16
+ attachShadow?: boolean;
17
17
  });
18
18
  /**
19
19
  * Returns the node into which this component should render.
@@ -21,4 +21,4 @@ export declare abstract class Component extends LitElement {
21
21
  */
22
22
  protected createRenderRoot(): DocumentFragment | HTMLElement;
23
23
  }
24
- //# sourceMappingURL=Component.d.ts.map
24
+ //# sourceMappingURL=ComponentBase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentBase.d.ts","sourceRoot":"","sources":["../../../src/Client/UI/Components/ComponentBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,KAAK,cAAc,EAAC,MAAM,KAAK,CAAC;AAEpD;;GAEG;AACH,8BAAsB,aAAc,SAAQ,UAAU;;IAErD;;OAEG;IACH,OAAgB,MAAM,EAAE,cAAc,CAAiC;IAOvE;;;OAGG;gBACS,OAAO,GAAE;QAAC,YAAY,CAAC,EAAE,OAAO,CAAA;KAAM;IAKlD;;;OAGG;cACgB,gBAAgB,IAAI,gBAAgB,GAAC,WAAW;CAGnE"}
@@ -0,0 +1,29 @@
1
+ import { LitElement } from "lit";
2
+ /**
3
+ * Optional base class for UI components. Alternatively, components may extend {@link LitElement} directly.
4
+ */
5
+ export class ComponentBase extends LitElement {
6
+ /**
7
+ * The component styles.
8
+ */
9
+ static styles = [document.adoptedStyleSheets];
10
+ /**
11
+ * Value indicating whether a shadow DOM tree should be attached to this component.
12
+ */
13
+ #attachShadow;
14
+ /**
15
+ * Creates a new component.
16
+ * @param options Value indicating whether a shadow DOM tree should be attached to this component.
17
+ */
18
+ constructor(options = {}) {
19
+ super();
20
+ this.#attachShadow = options.attachShadow ?? false;
21
+ }
22
+ /**
23
+ * Returns the node into which this component should render.
24
+ * @returns The node into which this component should render.
25
+ */
26
+ createRenderRoot() {
27
+ return this.#attachShadow ? super.createRenderRoot() : this;
28
+ }
29
+ }
@@ -1,8 +1,7 @@
1
- import type { ILoadingIndicator } from "#Abstractions/ILoadingIndicator.js";
2
1
  /**
3
2
  * A component that shows up when an HTTP request starts, and hides when all concurrent HTTP requests are completed.
4
3
  */
5
- export declare class LoadingIndicator extends HTMLElement implements ILoadingIndicator {
4
+ export declare class LoadingIndicator extends HTMLElement {
6
5
  #private;
7
6
  /**
8
7
  * Starts the loading indicator.
@@ -0,0 +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;;OAEG;IACH,KAAK,IAAI,IAAI;IAMb;;;OAGG;IACH,IAAI,CAAC,OAAO,GAAE;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAM,GAAG,IAAI;CAQ3C;AAED;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,qBAAqB;QAC9B,mBAAmB,EAAE,gBAAgB,CAAC;KACtC;CACD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MenuActivator.d.ts","sourceRoot":"","sources":["../../../src/Client/UI/Components/MenuActivator.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,aAAc,SAAQ,WAAW;IAS7C;;OAEG;IACH,iBAAiB,IAAI,IAAI;CAQzB;AAED;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,qBAAqB;QAC9B,gBAAgB,EAAE,aAAa,CAAC;KAChC;CACD"}
@@ -0,0 +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;IAEhD;;OAEG;;IAaH;;OAEG;IACH,iBAAiB,IAAI,IAAI;IAIzB;;OAEG;IACH,oBAAoB,IAAI,IAAI;IAI5B;;OAEG;IACH,WAAW,IAAI,IAAI;CAGnB;AAED;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,qBAAqB;QAC9B,mBAAmB,EAAE,gBAAgB,CAAC;KACtC;CACD"}
@@ -0,0 +1,67 @@
1
+ import { AppTheme } from "../AppTheme.js";
2
+ import { MenuAlignment } from "../MenuAlignment.js";
3
+ /**
4
+ * A dropdown menu for switching the application theme.
5
+ */
6
+ export declare class ThemeDropdown extends HTMLElement {
7
+ #private;
8
+ /**
9
+ * The list of observed attributes.
10
+ */
11
+ static readonly observedAttributes: string[];
12
+ /**
13
+ * Creates a new theme dropdown.
14
+ */
15
+ constructor();
16
+ /**
17
+ * The alignment of the dropdown menu.
18
+ */
19
+ get alignment(): MenuAlignment;
20
+ set alignment(value: MenuAlignment);
21
+ /**
22
+ * The current application theme.
23
+ */
24
+ get appTheme(): AppTheme;
25
+ set appTheme(value: AppTheme);
26
+ /**
27
+ * The label of the dropdown menu.
28
+ */
29
+ get label(): string;
30
+ set label(value: string);
31
+ /**
32
+ * The key of the storage entry providing the saved application theme.
33
+ */
34
+ get storageKey(): string;
35
+ set storageKey(value: string);
36
+ /**
37
+ * Method invoked when an attribute has been changed.
38
+ * @param attribute The attribute name.
39
+ * @param oldValue The previous attribute value.
40
+ * @param newValue The new attribute value.
41
+ */
42
+ attributeChangedCallback(attribute: string, oldValue: string | null, newValue: string | null): void;
43
+ /**
44
+ * Method invoked when this component is connected.
45
+ */
46
+ connectedCallback(): void;
47
+ /**
48
+ * Method invoked when this component is disconnected.
49
+ */
50
+ disconnectedCallback(): void;
51
+ /**
52
+ * Handles the events.
53
+ */
54
+ handleEvent(): void;
55
+ }
56
+ /**
57
+ * Declaration merging.
58
+ */
59
+ declare global {
60
+ /**
61
+ * The map of HTML tag names.
62
+ */
63
+ interface HTMLElementTagNameMap {
64
+ "theme-dropdown": ThemeDropdown;
65
+ }
66
+ }
67
+ //# sourceMappingURL=ThemeDropdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeDropdown.d.ts","sourceRoot":"","sources":["../../../src/Client/UI/Components/ThemeDropdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAU,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAElD;;GAEG;AACH,qBAAa,aAAc,SAAQ,WAAW;;IAE7C;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,kBAAkB,WAAsC;IAOxE;;OAEG;;IAaH;;OAEG;IACH,IAAI,SAAS,IAAI,aAAa,CAG7B;IACD,IAAI,SAAS,CAAC,KAAK,EAAE,aAAa,EAEjC;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,QAAQ,CAGvB;IACD,IAAI,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAG3B;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAGlB;IACD,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAEtB;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAGvB;IACD,IAAI,UAAU,CAAC,KAAK,EAAE,MAAM,EAE3B;IAED;;;;;OAKG;IACH,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAC,IAAI,GAAG,IAAI;IAwB/F;;OAEG;IACH,iBAAiB,IAAI,IAAI;IAMzB;;OAEG;IACH,oBAAoB,IAAI,IAAI;IAI5B;;OAEG;IACH,WAAW,IAAI,IAAI;CAsBnB;AAED;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,qBAAqB;QAC9B,gBAAgB,EAAE,aAAa,CAAC;KAChC;CACD"}
@@ -0,0 +1,140 @@
1
+ import { AppTheme, getIcon } from "../AppTheme.js";
2
+ import { MenuAlignment } from "../MenuAlignment.js";
3
+ /**
4
+ * A dropdown menu for switching the application theme.
5
+ */
6
+ export class ThemeDropdown extends HTMLElement {
7
+ /**
8
+ * The list of observed attributes.
9
+ */
10
+ static observedAttributes = ["alignment", "apptheme", "label"];
11
+ /**
12
+ * The media query used to check the application theme.
13
+ */
14
+ #mediaQuery = matchMedia("(prefers-color-scheme: dark)");
15
+ /**
16
+ * Creates a new theme dropdown.
17
+ */
18
+ constructor() {
19
+ super();
20
+ for (const button of this.querySelectorAll("button"))
21
+ button.addEventListener("click", this.#setTheme.bind(this));
22
+ }
23
+ /**
24
+ * Registers the component.
25
+ */
26
+ static {
27
+ customElements.define("theme-dropdown", this);
28
+ }
29
+ /**
30
+ * The alignment of the dropdown menu.
31
+ */
32
+ get alignment() {
33
+ const value = this.getAttribute("alignment");
34
+ return Object.values(MenuAlignment).includes(value) ? value : MenuAlignment.End;
35
+ }
36
+ set alignment(value) {
37
+ this.setAttribute("alignment", value);
38
+ }
39
+ /**
40
+ * The current application theme.
41
+ */
42
+ get appTheme() {
43
+ const value = this.getAttribute("apptheme");
44
+ return Object.values(AppTheme).includes(value) ? value : AppTheme.System;
45
+ }
46
+ set appTheme(value) {
47
+ this.setAttribute("apptheme", value);
48
+ localStorage.setItem(this.storageKey, this.appTheme);
49
+ }
50
+ /**
51
+ * The label of the dropdown menu.
52
+ */
53
+ get label() {
54
+ const value = this.getAttribute("label") ?? "";
55
+ return value.trim() || "Thème";
56
+ }
57
+ set label(value) {
58
+ this.setAttribute("label", value);
59
+ }
60
+ /**
61
+ * The key of the storage entry providing the saved application theme.
62
+ */
63
+ get storageKey() {
64
+ const value = this.getAttribute("storagekey") ?? "";
65
+ return value.trim() || "AppTheme";
66
+ }
67
+ set storageKey(value) {
68
+ this.setAttribute("storagekey", value);
69
+ }
70
+ /**
71
+ * Method invoked when an attribute has been changed.
72
+ * @param attribute The attribute name.
73
+ * @param oldValue The previous attribute value.
74
+ * @param newValue The new attribute value.
75
+ */
76
+ attributeChangedCallback(attribute, oldValue, newValue) {
77
+ if (newValue != oldValue)
78
+ switch (attribute) {
79
+ case "alignment": {
80
+ const alignment = Object.values(MenuAlignment).includes(newValue) ? newValue : MenuAlignment.End;
81
+ const { classList } = this.querySelector(".dropdown-menu");
82
+ if (alignment == MenuAlignment.End)
83
+ classList.add("dropdown-menu-end");
84
+ else
85
+ classList.remove("dropdown-menu-end");
86
+ break;
87
+ }
88
+ case "apptheme": {
89
+ const appTheme = Object.values(AppTheme).includes(newValue) ? newValue : AppTheme.System;
90
+ this.querySelector(".dropdown-toggle > .icon").textContent = getIcon(appTheme);
91
+ this.querySelector(`button[data-theme="${appTheme}"]`).appendChild(this.querySelector(".dropdown-item > .icon"));
92
+ this.#applyTheme();
93
+ break;
94
+ }
95
+ case "label": {
96
+ this.querySelector(".dropdown-toggle > span").textContent = (newValue ?? "").trim() || "Thème";
97
+ break;
98
+ }
99
+ // No default
100
+ }
101
+ }
102
+ /**
103
+ * Method invoked when this component is connected.
104
+ */
105
+ connectedCallback() {
106
+ this.#mediaQuery.addEventListener("change", this);
107
+ const appTheme = localStorage.getItem(this.storageKey);
108
+ if (appTheme)
109
+ this.setAttribute("apptheme", appTheme);
110
+ }
111
+ /**
112
+ * Method invoked when this component is disconnected.
113
+ */
114
+ disconnectedCallback() {
115
+ this.#mediaQuery.removeEventListener("change", this);
116
+ }
117
+ /**
118
+ * Handles the events.
119
+ */
120
+ handleEvent() {
121
+ this.#applyTheme();
122
+ }
123
+ /**
124
+ * Applies the application theme to the document.
125
+ */
126
+ #applyTheme() {
127
+ const { appTheme } = this;
128
+ const bsTheme = appTheme == AppTheme.System ? (this.#mediaQuery.matches ? AppTheme.Dark : AppTheme.Light) : appTheme;
129
+ document.documentElement.dataset.bsTheme = bsTheme.toLowerCase();
130
+ }
131
+ /**
132
+ * Changes the current application theme.
133
+ * @param event The dispatched event.
134
+ */
135
+ #setTheme(event) {
136
+ event.preventDefault();
137
+ const button = event.target.closest("button");
138
+ this.appTheme = button.dataset.theme;
139
+ }
140
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Context.d.ts","sourceRoot":"","sources":["../../src/Client/UI/Context.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,OAAO;IAEnB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;EAEF,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;AAE3D;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAOhD"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Represents a form control.
3
+ */
4
+ export type FormControl = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;
5
+ /**
6
+ * Gets all controls belonging to the specified form.
7
+ * @param form The form element.
8
+ * @returns The controls belonging to the specified form.
9
+ */
10
+ export declare function getFormControls(form: HTMLFormElement): FormControl[];
11
+ /**
12
+ * Returns the first invalid control from the specified form.
13
+ * @param form The form element.
14
+ * @returns The first invalid control, or `null` if all controls are valid.
15
+ */
16
+ export declare function invalidControl(form: HTMLFormElement): FormControl | null;
17
+ /**
18
+ * Returns a value indicating whether the specified element is a form control.
19
+ * @param element The element to check.
20
+ * @returns `true` if the specified element is a form control, otherwise `false`.
21
+ */
22
+ export declare function isFormControl(element: Element): element is FormControl;
23
+ /**
24
+ * Resets the validity of the specified element.
25
+ * @param element The element to process.
26
+ */
27
+ export declare function resetValidity(element: Element): void;
28
+ /**
29
+ * Removes whitespace from both ends of the value of the specified element.
30
+ * @param element The element to process.
31
+ */
32
+ export declare function trimControl(element: Element): void;
33
+ //# sourceMappingURL=FormExtensions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormExtensions.d.ts","sourceRoot":"","sources":["../../src/Client/UI/FormExtensions.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"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * The types of form controls that are not text inputs.
3
+ */
4
+ const nonTextualTypes = new Set(["button", "checkbox", "file", "hidden", "image", "password", "radio", "range", "reset", "submit"]);
5
+ /**
6
+ * Gets all controls belonging to the specified form.
7
+ * @param form The form element.
8
+ * @returns The controls belonging to the specified form.
9
+ */
10
+ export function getFormControls(form) {
11
+ return Array.from(form.elements).filter(isFormControl);
12
+ }
13
+ /**
14
+ * Returns the first invalid control from the specified form.
15
+ * @param form The form element.
16
+ * @returns The first invalid control, or `null` if all controls are valid.
17
+ */
18
+ export function invalidControl(form) {
19
+ return form.querySelector(":not(fieldset):invalid");
20
+ }
21
+ /**
22
+ * Returns a value indicating whether the specified element is a form control.
23
+ * @param element The element to check.
24
+ * @returns `true` if the specified element is a form control, otherwise `false`.
25
+ */
26
+ export function isFormControl(element) {
27
+ return element instanceof HTMLInputElement || element instanceof HTMLSelectElement || element instanceof HTMLTextAreaElement;
28
+ }
29
+ /**
30
+ * Resets the validity of the specified element.
31
+ * @param element The element to process.
32
+ */
33
+ export function resetValidity(element) {
34
+ if (element instanceof HTMLFormElement)
35
+ getFormControls(element).forEach(control => control.setCustomValidity(""));
36
+ else if (isFormControl(element))
37
+ element.setCustomValidity("");
38
+ }
39
+ /**
40
+ * Removes whitespace from both ends of the value of the specified element.
41
+ * @param element The element to process.
42
+ */
43
+ export function trimControl(element) {
44
+ if (element instanceof HTMLFormElement)
45
+ getFormControls(element).forEach(trimControl);
46
+ else if (element instanceof HTMLInputElement && !nonTextualTypes.has(element.type))
47
+ element.value = element.value.trim();
48
+ else if (element instanceof HTMLTextAreaElement)
49
+ element.value = element.value.trim();
50
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Defines the alignment of a dropdown menu.
3
+ */
4
+ export declare const MenuAlignment: Readonly<{
5
+ /**
6
+ * The dropdown menu is left aligned.
7
+ */
8
+ Start: "Start";
9
+ /**
10
+ * The dropdown menu is right aligned.
11
+ */
12
+ End: "End";
13
+ }>;
14
+ /**
15
+ * Defines the alignment of a dropdown menu.
16
+ */
17
+ export type MenuAlignment = typeof MenuAlignment[keyof typeof MenuAlignment];
18
+ //# sourceMappingURL=MenuAlignment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MenuAlignment.d.ts","sourceRoot":"","sources":["../../src/Client/UI/MenuAlignment.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,aAAa;IAEzB;;OAEG;;IAGH;;OAEG;;EAEF,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Defines the alignment of a dropdown menu.
3
+ */
4
+ export const MenuAlignment = Object.freeze({
5
+ /**
6
+ * The dropdown menu is left aligned.
7
+ */
8
+ Start: "Start",
9
+ /**
10
+ * The dropdown menu is right aligned.
11
+ */
12
+ End: "End"
13
+ });
@@ -23,7 +23,7 @@ export declare class ViewportScroller {
23
23
  get scrollOffset(): number;
24
24
  /**
25
25
  * Scrolls to the specified anchor.
26
- * @param anchor The identifier or name of an elment.
26
+ * @param anchor The identifier or name of an element.
27
27
  * @param options Value indicating whether scrolling is instant or animates smoothly.
28
28
  */
29
29
  scrollToAnchor(anchor: string, options?: ScrollOptions): void;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ViewportScroller.d.ts","sourceRoot":"","sources":["../../src/Client/UI/ViewportScroller.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC;IAEnC;;OAEG;IACH,QAAQ,EAAE,cAAc,CAAA;CACxB,CAAC,CAAC;AAEH;;GAEG;AACH,qBAAa,gBAAgB;;IAY5B;;;OAGG;gBACS,QAAQ,GAAE,MAAM,OAAqE;IAIjG;;OAEG;IACH,IAAI,YAAY,IAAI,MAAM,CAWzB;IAED;;;;OAIG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,IAAI;IAKjE;;;;OAIG;IACH,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,aAAkB,GAAG,IAAI;IAMpE;;;;;OAKG;IACH,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,aAAkB,GAAG,IAAI;IAIzE;;;OAGG;IACH,WAAW,CAAC,OAAO,GAAE,aAAkB,GAAG,IAAI;CAG9C"}