@cedx/ui 0.1.0 → 0.2.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 +2 -2
- package/lib/AppTheme.d.ts +3 -3
- package/lib/AppTheme.d.ts.map +1 -1
- package/lib/AppTheme.js +3 -3
- package/lib/Components/ThemeDropdown.d.ts +5 -5
- package/lib/Components/ThemeDropdown.d.ts.map +1 -1
- package/lib/Components/ThemeDropdown.js +15 -15
- package/package.json +5 -6
- package/src/Client/AppTheme.ts +3 -3
- package/src/Client/Components/ThemeDropdown.ts +15 -15
package/ReadMe.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Belin UI
|
|
2
|
-
Component library by [Cédric Belin](https://cedric-belin.fr), full stack developer,
|
|
3
|
-
|
|
2
|
+
Component library by [Cédric Belin](https://cedric-belin.fr), full stack developer, implemented in
|
|
3
|
+
[C#](https://learn.microsoft.com/en-us/dotnet/csharp), [PowerShell](https://learn.microsoft.com/en-us/powershell) and [TypeScript](https://www.typescriptlang.org).
|
|
4
4
|
|
|
5
5
|
> This library is dedicated to personal/side projects.
|
|
6
6
|
> **Use at your own risk!** No support will be provided.
|
package/lib/AppTheme.d.ts
CHANGED
|
@@ -26,9 +26,9 @@ export type AppTheme = typeof AppTheme[keyof typeof AppTheme];
|
|
|
26
26
|
*/
|
|
27
27
|
export declare function icon(theme: AppTheme): string;
|
|
28
28
|
/**
|
|
29
|
-
* Gets the
|
|
29
|
+
* Gets the text corresponding to the specified theme.
|
|
30
30
|
* @param theme The application theme.
|
|
31
|
-
* @returns The
|
|
31
|
+
* @returns The text corresponding to the specified theme.
|
|
32
32
|
*/
|
|
33
|
-
export declare function
|
|
33
|
+
export declare function text(theme: AppTheme): string;
|
|
34
34
|
//# sourceMappingURL=AppTheme.d.ts.map
|
package/lib/AppTheme.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppTheme.d.ts","sourceRoot":"","sources":["../src/Client/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,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAM5C;AAED;;;;GAIG;AACH,wBAAgB,
|
|
1
|
+
{"version":3,"file":"AppTheme.d.ts","sourceRoot":"","sources":["../src/Client/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,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAM5C;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAM5C"}
|
package/lib/AppTheme.js
CHANGED
|
@@ -28,11 +28,11 @@ export function icon(theme) {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* Gets the
|
|
31
|
+
* Gets the text corresponding to the specified theme.
|
|
32
32
|
* @param theme The application theme.
|
|
33
|
-
* @returns The
|
|
33
|
+
* @returns The text corresponding to the specified theme.
|
|
34
34
|
*/
|
|
35
|
-
export function
|
|
35
|
+
export function text(theme) {
|
|
36
36
|
switch (theme) {
|
|
37
37
|
case AppTheme.Dark: return "Sombre";
|
|
38
38
|
case AppTheme.Light: return "Clair";
|
|
@@ -33,16 +33,16 @@ export declare class ThemeDropdown extends HTMLElement {
|
|
|
33
33
|
*/
|
|
34
34
|
get cookieDomain(): string;
|
|
35
35
|
set cookieDomain(value: string);
|
|
36
|
-
/**
|
|
37
|
-
* The label of the dropdown menu.
|
|
38
|
-
*/
|
|
39
|
-
get label(): string;
|
|
40
|
-
set label(value: string);
|
|
41
36
|
/**
|
|
42
37
|
* The key of the storage entry providing the saved application theme.
|
|
43
38
|
*/
|
|
44
39
|
get storageKey(): string;
|
|
45
40
|
set storageKey(value: string);
|
|
41
|
+
/**
|
|
42
|
+
* The text of the dropdown menu.
|
|
43
|
+
*/
|
|
44
|
+
get text(): string;
|
|
45
|
+
set text(value: string);
|
|
46
46
|
/**
|
|
47
47
|
* Method invoked when an attribute has been changed.
|
|
48
48
|
* @param attribute The attribute name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeDropdown.d.ts","sourceRoot":"","sources":["../../src/Client/Components/ThemeDropdown.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAC,QAAQ,EAAO,MAAM,gBAAgB,CAAC;AAE9C;;GAEG;AACH,qBAAa,aAAc,SAAQ,WAAW;;IAE7C;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"ThemeDropdown.d.ts","sourceRoot":"","sources":["../../src/Client/Components/ThemeDropdown.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAC,QAAQ,EAAO,MAAM,gBAAgB,CAAC;AAE9C;;GAEG;AACH,qBAAa,aAAc,SAAQ,WAAW;;IAE7C;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,kBAAkB,WAAqC;IAiBvE;;OAEG;;IAaH;;OAEG;IACH,IAAI,SAAS,IAAI,SAAS,CAGzB;IACD,IAAI,SAAS,CAAC,KAAK,EAAE,SAAS,EAE7B;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,QAAQ,CAGvB;IACD,IAAI,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAE3B;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,OAAO,CAEpB;IACD,IAAI,MAAM,CAAC,KAAK,EAAE,OAAO,EAExB;IAED;;OAEG;IACH,IAAI,YAAY,IAAI,MAAM,CAEzB;IACD,IAAI,YAAY,CAAC,KAAK,EAAE,MAAM,EAE7B;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAGvB;IACD,IAAI,UAAU,CAAC,KAAK,EAAE,MAAM,EAE3B;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAGjB;IACD,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAErB;IAED;;;;;OAKG;IACH,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAC,IAAI,GAAG,IAAI;IAS/F;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;;OAGG;IACG,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAaxC;;OAEG;IACH,oBAAoB,IAAI,IAAI;IAK5B;;OAEG;IACH,IAAI,IAAI,IAAI;IAIZ;;OAEG;IACH,IAAI,IAAI,IAAI;CAwDZ;AAED;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,qBAAqB;QAC9B,gBAAgB,EAAE,aAAa,CAAC;KAChC;CACD"}
|
|
@@ -8,7 +8,7 @@ export class ThemeDropdown extends HTMLElement {
|
|
|
8
8
|
/**
|
|
9
9
|
* The list of observed attributes.
|
|
10
10
|
*/
|
|
11
|
-
static observedAttributes = ["alignment", "apptheme", "
|
|
11
|
+
static observedAttributes = ["alignment", "apptheme", "text"];
|
|
12
12
|
/**
|
|
13
13
|
* The abort controller used to remove the event listeners.
|
|
14
14
|
*/
|
|
@@ -73,16 +73,6 @@ export class ThemeDropdown extends HTMLElement {
|
|
|
73
73
|
set cookieDomain(value) {
|
|
74
74
|
this.setAttribute("cookiedomain", value);
|
|
75
75
|
}
|
|
76
|
-
/**
|
|
77
|
-
* The label of the dropdown menu.
|
|
78
|
-
*/
|
|
79
|
-
get label() {
|
|
80
|
-
const value = this.getAttribute("label") ?? "";
|
|
81
|
-
return value.trim() || "Thème";
|
|
82
|
-
}
|
|
83
|
-
set label(value) {
|
|
84
|
-
this.setAttribute("label", value);
|
|
85
|
-
}
|
|
86
76
|
/**
|
|
87
77
|
* The key of the storage entry providing the saved application theme.
|
|
88
78
|
*/
|
|
@@ -93,6 +83,16 @@ export class ThemeDropdown extends HTMLElement {
|
|
|
93
83
|
set storageKey(value) {
|
|
94
84
|
this.setAttribute("storagekey", value);
|
|
95
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* The text of the dropdown menu.
|
|
88
|
+
*/
|
|
89
|
+
get text() {
|
|
90
|
+
const value = this.getAttribute("text") ?? "";
|
|
91
|
+
return value.trim() || "Thème";
|
|
92
|
+
}
|
|
93
|
+
set text(value) {
|
|
94
|
+
this.setAttribute("text", value);
|
|
95
|
+
}
|
|
96
96
|
/**
|
|
97
97
|
* Method invoked when an attribute has been changed.
|
|
98
98
|
* @param attribute The attribute name.
|
|
@@ -108,8 +108,8 @@ export class ThemeDropdown extends HTMLElement {
|
|
|
108
108
|
case "apptheme":
|
|
109
109
|
this.#updateAppTheme(Object.values(AppTheme).includes(newValue) ? newValue : AppTheme.System);
|
|
110
110
|
break;
|
|
111
|
-
case "
|
|
112
|
-
this.#
|
|
111
|
+
case "text":
|
|
112
|
+
this.#updateText(newValue ?? "");
|
|
113
113
|
break;
|
|
114
114
|
// No default
|
|
115
115
|
}
|
|
@@ -198,10 +198,10 @@ export class ThemeDropdown extends HTMLElement {
|
|
|
198
198
|
this.#applyToDocument();
|
|
199
199
|
}
|
|
200
200
|
/**
|
|
201
|
-
* Updates the
|
|
201
|
+
* Updates the text of the dropdown menu.
|
|
202
202
|
* @param value The new value.
|
|
203
203
|
*/
|
|
204
|
-
#
|
|
204
|
+
#updateText(value) {
|
|
205
205
|
this.querySelector(".dropdown-toggle > span").textContent = value.trim() || "Thème";
|
|
206
206
|
}
|
|
207
207
|
}
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"name": "@cedx/ui",
|
|
8
8
|
"repository": "cedx/ui",
|
|
9
9
|
"type": "module",
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "0.2.0",
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@eslint/js": "^10.0.1",
|
|
13
13
|
"@types/bootstrap": "^5.2.10",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"bootstrap": "^5.3.8",
|
|
19
19
|
"chai": "^6.2.2",
|
|
20
20
|
"esbuild": "^0.28.0",
|
|
21
|
-
"globals": "^17.
|
|
22
|
-
"htmx.org": "^2.0.
|
|
21
|
+
"globals": "^17.6.0",
|
|
22
|
+
"htmx.org": "^2.0.10",
|
|
23
23
|
"mocha": "^11.7.5",
|
|
24
24
|
"playwright": "^1.59.1",
|
|
25
25
|
"playwright-chromium": "^1.59.1",
|
|
26
26
|
"serve-handler": "^6.1.7",
|
|
27
|
-
"typescript": "^6.0.
|
|
28
|
-
"typescript-eslint": "^8.
|
|
27
|
+
"typescript": "^6.0.3",
|
|
28
|
+
"typescript-eslint": "^8.59.2"
|
|
29
29
|
},
|
|
30
30
|
"engines": {
|
|
31
31
|
"node": ">=24.0.0"
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
],
|
|
43
43
|
"keywords": [
|
|
44
44
|
"belin",
|
|
45
|
-
"blazor",
|
|
46
45
|
"components",
|
|
47
46
|
"html",
|
|
48
47
|
"library",
|
package/src/Client/AppTheme.ts
CHANGED
|
@@ -38,11 +38,11 @@ export function icon(theme: AppTheme): string {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
* Gets the
|
|
41
|
+
* Gets the text corresponding to the specified theme.
|
|
42
42
|
* @param theme The application theme.
|
|
43
|
-
* @returns The
|
|
43
|
+
* @returns The text corresponding to the specified theme.
|
|
44
44
|
*/
|
|
45
|
-
export function
|
|
45
|
+
export function text(theme: AppTheme): string {
|
|
46
46
|
switch (theme) {
|
|
47
47
|
case AppTheme.Dark: return "Sombre";
|
|
48
48
|
case AppTheme.Light: return "Clair";
|
|
@@ -10,7 +10,7 @@ export class ThemeDropdown extends HTMLElement {
|
|
|
10
10
|
/**
|
|
11
11
|
* The list of observed attributes.
|
|
12
12
|
*/
|
|
13
|
-
static readonly observedAttributes = ["alignment", "apptheme", "
|
|
13
|
+
static readonly observedAttributes = ["alignment", "apptheme", "text"];
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* The abort controller used to remove the event listeners.
|
|
@@ -84,17 +84,6 @@ export class ThemeDropdown extends HTMLElement {
|
|
|
84
84
|
this.setAttribute("cookiedomain", value);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
/**
|
|
88
|
-
* The label of the dropdown menu.
|
|
89
|
-
*/
|
|
90
|
-
get label(): string {
|
|
91
|
-
const value = this.getAttribute("label") ?? "";
|
|
92
|
-
return value.trim() || "Thème";
|
|
93
|
-
}
|
|
94
|
-
set label(value: string) {
|
|
95
|
-
this.setAttribute("label", value);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
87
|
/**
|
|
99
88
|
* The key of the storage entry providing the saved application theme.
|
|
100
89
|
*/
|
|
@@ -106,6 +95,17 @@ export class ThemeDropdown extends HTMLElement {
|
|
|
106
95
|
this.setAttribute("storagekey", value);
|
|
107
96
|
}
|
|
108
97
|
|
|
98
|
+
/**
|
|
99
|
+
* The text of the dropdown menu.
|
|
100
|
+
*/
|
|
101
|
+
get text(): string {
|
|
102
|
+
const value = this.getAttribute("text") ?? "";
|
|
103
|
+
return value.trim() || "Thème";
|
|
104
|
+
}
|
|
105
|
+
set text(value: string) {
|
|
106
|
+
this.setAttribute("text", value);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
109
|
/**
|
|
110
110
|
* Method invoked when an attribute has been changed.
|
|
111
111
|
* @param attribute The attribute name.
|
|
@@ -116,7 +116,7 @@ export class ThemeDropdown extends HTMLElement {
|
|
|
116
116
|
if (newValue != oldValue) switch (attribute) {
|
|
117
117
|
case "alignment": this.#updateAlignment(Object.values(Alignment).includes(newValue as Alignment) ? newValue as Alignment : Alignment.End); break;
|
|
118
118
|
case "apptheme": this.#updateAppTheme(Object.values(AppTheme).includes(newValue as AppTheme) ? newValue as AppTheme : AppTheme.System); break;
|
|
119
|
-
case "
|
|
119
|
+
case "text": this.#updateText(newValue ?? ""); break;
|
|
120
120
|
// No default
|
|
121
121
|
}
|
|
122
122
|
}
|
|
@@ -213,10 +213,10 @@ export class ThemeDropdown extends HTMLElement {
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
/**
|
|
216
|
-
* Updates the
|
|
216
|
+
* Updates the text of the dropdown menu.
|
|
217
217
|
* @param value The new value.
|
|
218
218
|
*/
|
|
219
|
-
#
|
|
219
|
+
#updateText(value: string): void {
|
|
220
220
|
this.querySelector(".dropdown-toggle > span")!.textContent = value.trim() || "Thème";
|
|
221
221
|
}
|
|
222
222
|
}
|