@cedx/base 0.13.0 → 0.13.1
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
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Belin.io Base
|
|
2
|
-
   
|
|
3
3
|
|
|
4
4
|
Base library by [Cédric Belin](https://belin.io), full stack developer,
|
|
5
5
|
implemented in [C#](https://learn.microsoft.com/en-us/dotnet/csharp) and [TypeScript](https://www.typescriptlang.org).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Context } from "@cedx/base/UI/Context.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Represents a notification.
|
|
4
4
|
*/
|
|
5
5
|
export declare class Toast extends HTMLElement {
|
|
6
6
|
#private;
|
|
@@ -14,7 +14,7 @@ export declare class Toast extends HTMLElement {
|
|
|
14
14
|
get animation(): boolean;
|
|
15
15
|
set animation(value: boolean);
|
|
16
16
|
/**
|
|
17
|
-
* Value indicating whether to automatically hide the
|
|
17
|
+
* Value indicating whether to automatically hide the toast.
|
|
18
18
|
*/
|
|
19
19
|
get autoHide(): boolean;
|
|
20
20
|
set autoHide(value: boolean);
|
|
@@ -34,7 +34,7 @@ export declare class Toast extends HTMLElement {
|
|
|
34
34
|
get culture(): Intl.Locale;
|
|
35
35
|
set culture(value: Intl.Locale);
|
|
36
36
|
/**
|
|
37
|
-
* The delay, in milliseconds, to hide the
|
|
37
|
+
* The delay, in milliseconds, to hide the toast.
|
|
38
38
|
*/
|
|
39
39
|
get delay(): number;
|
|
40
40
|
set delay(value: number);
|
|
@@ -71,4 +71,15 @@ export declare class Toast extends HTMLElement {
|
|
|
71
71
|
*/
|
|
72
72
|
show(): void;
|
|
73
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Declaration merging.
|
|
76
|
+
*/
|
|
77
|
+
declare global {
|
|
78
|
+
/**
|
|
79
|
+
* The map of HTML tag names.
|
|
80
|
+
*/
|
|
81
|
+
interface HTMLElementTagNameMap {
|
|
82
|
+
"toaster-item": Toast;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
74
85
|
//# sourceMappingURL=Toast.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../src/Client/UI/Components/Toast.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAiB,MAAM,0BAA0B,CAAC;AAGjE;;GAEG;AACH,qBAAa,KAAM,SAAQ,WAAW;;IAErC;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,kBAAkB,WAA6C;IAuC/E;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IACD,IAAI,SAAS,CAAC,KAAK,EAAE,OAAO,EAG3B;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,OAAO,CAEtB;IACD,IAAI,QAAQ,CAAC,KAAK,EAAE,OAAO,EAG1B;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;IACD,IAAI,OAAO,CAAC,KAAK,EAAE,MAAM,EAExB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAGrB;IACD,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,EAEzB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,IAAI,CAAC,MAAM,CAGzB;IACD,IAAI,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAE7B;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAGlB;IACD,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAEtB;IAED;;OAEG;IACH,IAAI,WAAW,IAAI,MAAM,CAExB;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,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OAEG;IACH,oBAAoB,IAAI,IAAI;IAK5B;;OAEG;IACH,IAAI,IAAI,IAAI;IAIZ;;OAEG;IACH,IAAI,IAAI,IAAI;CA+DZ;AAED;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,qBAAqB;QAC9B,cAAc,EAAE,KAAK,CAAC;KACtB;CACD"}
|
|
@@ -2,7 +2,7 @@ import { Duration } from "@cedx/base/Duration.js";
|
|
|
2
2
|
import { Context, getIcon, toCss } from "@cedx/base/UI/Context.js";
|
|
3
3
|
import { Toast as BootstrapToast } from "bootstrap";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Represents a notification.
|
|
6
6
|
*/
|
|
7
7
|
export class Toast extends HTMLElement {
|
|
8
8
|
/**
|
|
@@ -52,7 +52,7 @@ export class Toast extends HTMLElement {
|
|
|
52
52
|
this.removeAttribute("animation");
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
-
* Value indicating whether to automatically hide the
|
|
55
|
+
* Value indicating whether to automatically hide the toast.
|
|
56
56
|
*/
|
|
57
57
|
get autoHide() {
|
|
58
58
|
return this.hasAttribute("autohide");
|
|
@@ -93,7 +93,7 @@ export class Toast extends HTMLElement {
|
|
|
93
93
|
this.setAttribute("culture", value.toString());
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
|
-
* The delay, in milliseconds, to hide the
|
|
96
|
+
* The delay, in milliseconds, to hide the toast.
|
|
97
97
|
*/
|
|
98
98
|
get delay() {
|
|
99
99
|
const value = Number(this.getAttribute("delay"));
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import {Context, getIcon, toCss} from "@cedx/base/UI/Context.js";
|
|
|
3
3
|
import {Toast as BootstrapToast} from "bootstrap";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Represents a notification.
|
|
7
7
|
*/
|
|
8
8
|
export class Toast extends HTMLElement {
|
|
9
9
|
|
|
@@ -61,7 +61,7 @@ export class Toast extends HTMLElement {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
* Value indicating whether to automatically hide the
|
|
64
|
+
* Value indicating whether to automatically hide the toast.
|
|
65
65
|
*/
|
|
66
66
|
get autoHide(): boolean {
|
|
67
67
|
return this.hasAttribute("autohide");
|
|
@@ -104,7 +104,7 @@ export class Toast extends HTMLElement {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
|
-
* The delay, in milliseconds, to hide the
|
|
107
|
+
* The delay, in milliseconds, to hide the toast.
|
|
108
108
|
*/
|
|
109
109
|
get delay(): number {
|
|
110
110
|
const value = Number(this.getAttribute("delay"));
|
|
@@ -140,18 +140,10 @@ export class Toast extends HTMLElement {
|
|
|
140
140
|
*/
|
|
141
141
|
attributeChangedCallback(attribute: string, oldValue: string|null, newValue: string|null): void {
|
|
142
142
|
if (newValue != oldValue) switch (attribute) {
|
|
143
|
-
case "caption":
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
case "
|
|
147
|
-
this.#updateContext(Object.values(Context).includes(newValue as Context) ? newValue as Context : Context.Info);
|
|
148
|
-
break;
|
|
149
|
-
case "culture":
|
|
150
|
-
this.#formatter = new Intl.RelativeTimeFormat((newValue ?? "").trim() || navigator.language, {style: "long"});
|
|
151
|
-
break;
|
|
152
|
-
case "icon":
|
|
153
|
-
this.#updateIcon(newValue ?? "")
|
|
154
|
-
break;
|
|
143
|
+
case "caption": this.#updateCaption(newValue ?? ""); break;
|
|
144
|
+
case "context": this.#updateContext(Object.values(Context).includes(newValue as Context) ? newValue as Context : Context.Info); break;
|
|
145
|
+
case "culture": this.#formatter = new Intl.RelativeTimeFormat((newValue ?? "").trim() || navigator.language, {style: "long"}); break;
|
|
146
|
+
case "icon": this.#updateIcon(newValue ?? ""); break;
|
|
155
147
|
// No default
|
|
156
148
|
}
|
|
157
149
|
}
|
|
@@ -250,3 +242,16 @@ export class Toast extends HTMLElement {
|
|
|
250
242
|
this.#header.querySelector(".icon")!.textContent = value.trim() || getIcon(Context.Info);
|
|
251
243
|
}
|
|
252
244
|
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Declaration merging.
|
|
248
|
+
*/
|
|
249
|
+
declare global {
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* The map of HTML tag names.
|
|
253
|
+
*/
|
|
254
|
+
interface HTMLElementTagNameMap {
|
|
255
|
+
"toaster-item": Toast;
|
|
256
|
+
}
|
|
257
|
+
}
|