@cedx/base 0.15.3 → 0.16.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 +4 -4
- package/lib/UI/Alignment.d.ts +22 -0
- package/lib/UI/Alignment.d.ts.map +1 -0
- package/lib/UI/Alignment.js +17 -0
- package/lib/UI/Components/DialogButton.d.ts +57 -0
- package/lib/UI/Components/DialogButton.d.ts.map +1 -0
- package/lib/UI/Components/DialogButton.js +151 -0
- package/lib/UI/Components/KeyboardAccelerator.js +1 -1
- package/lib/UI/Components/ThemeDropdown.d.ts +3 -3
- package/lib/UI/Components/ThemeDropdown.d.ts.map +1 -1
- package/lib/UI/Components/ThemeDropdown.js +4 -8
- package/lib/UI/Components/Toast.d.ts +2 -2
- package/lib/UI/Components/Toast.d.ts.map +1 -1
- package/lib/UI/Components/Toast.js +24 -16
- package/lib/UI/Components/Toaster.d.ts +2 -2
- package/lib/UI/Components/Toaster.d.ts.map +1 -1
- package/lib/UI/Components/Toaster.js +6 -2
- package/lib/UI/DialogResult.d.ts +42 -0
- package/lib/UI/DialogResult.d.ts.map +1 -0
- package/lib/UI/DialogResult.js +37 -0
- package/package.json +2 -3
- package/src/Client/UI/Alignment.ts +25 -0
- package/src/Client/UI/Components/DialogButton.ts +159 -0
- package/src/Client/UI/Components/KeyboardAccelerator.ts +1 -1
- package/src/Client/UI/Components/ThemeDropdown.ts +8 -10
- package/src/Client/UI/Components/Toast.ts +26 -29
- package/src/Client/UI/Components/Toaster.ts +6 -4
- package/src/Client/UI/DialogResult.ts +50 -0
- package/lib/UI/Components/ComponentBase.d.ts +0 -24
- package/lib/UI/Components/ComponentBase.d.ts.map +0 -1
- package/lib/UI/Components/ComponentBase.js +0 -29
- package/lib/UI/MenuAlignment.d.ts +0 -18
- package/lib/UI/MenuAlignment.d.ts.map +0 -1
- package/lib/UI/MenuAlignment.js +0 -13
- package/src/Client/UI/Components/ComponentBase.ts +0 -34
- package/src/Client/UI/MenuAlignment.ts +0 -20
package/ReadMe.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# Belin
|
|
2
|
-
   
|
|
3
3
|
|
|
4
|
-
Base library by [Cédric Belin](https://belin.
|
|
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).
|
|
6
6
|
|
|
7
7
|
> This library is dedicated to personal/side projects.
|
|
@@ -17,4 +17,4 @@ implemented in [C#](https://learn.microsoft.com/en-us/dotnet/csharp) and [TypeSc
|
|
|
17
17
|
- [Submit an issue](https://github.com/cedx/base/issues)
|
|
18
18
|
|
|
19
19
|
## Licence
|
|
20
|
-
[Belin
|
|
20
|
+
[Cédric Belin's Base](https://github.com/cedx/base) is distributed under the MIT License.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the alignment of a component.
|
|
3
|
+
*/
|
|
4
|
+
export declare const Alignment: Readonly<{
|
|
5
|
+
/**
|
|
6
|
+
* The element is aligned at the start.
|
|
7
|
+
*/
|
|
8
|
+
Start: "Start";
|
|
9
|
+
/**
|
|
10
|
+
* The element is aligned in the center.
|
|
11
|
+
*/
|
|
12
|
+
Center: "Center";
|
|
13
|
+
/**
|
|
14
|
+
* The element is aligned at the end.
|
|
15
|
+
*/
|
|
16
|
+
End: "End";
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* Defines the alignment of a component.
|
|
20
|
+
*/
|
|
21
|
+
export type Alignment = typeof Alignment[keyof typeof Alignment];
|
|
22
|
+
//# sourceMappingURL=Alignment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Alignment.d.ts","sourceRoot":"","sources":["../../src/Client/UI/Alignment.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,SAAS;IAErB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;EAEF,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the alignment of a component.
|
|
3
|
+
*/
|
|
4
|
+
export const Alignment = Object.freeze({
|
|
5
|
+
/**
|
|
6
|
+
* The element is aligned at the start.
|
|
7
|
+
*/
|
|
8
|
+
Start: "Start",
|
|
9
|
+
/**
|
|
10
|
+
* The element is aligned in the center.
|
|
11
|
+
*/
|
|
12
|
+
Center: "Center",
|
|
13
|
+
/**
|
|
14
|
+
* The element is aligned at the end.
|
|
15
|
+
*/
|
|
16
|
+
End: "End"
|
|
17
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Context } from "../Context.js";
|
|
2
|
+
import { DialogResult } from "../DialogResult.js";
|
|
3
|
+
import { Variant } from "../Variant.js";
|
|
4
|
+
/**
|
|
5
|
+
* Represents a dialog box button.
|
|
6
|
+
*/
|
|
7
|
+
export declare class DialogButton extends HTMLElement {
|
|
8
|
+
#private;
|
|
9
|
+
/**
|
|
10
|
+
* The list of observed attributes.
|
|
11
|
+
*/
|
|
12
|
+
static readonly observedAttributes: string[];
|
|
13
|
+
/**
|
|
14
|
+
* A contextual modifier.
|
|
15
|
+
*/
|
|
16
|
+
get context(): Context | null;
|
|
17
|
+
set context(value: Context | null);
|
|
18
|
+
/**
|
|
19
|
+
* The button icon.
|
|
20
|
+
*/
|
|
21
|
+
get icon(): string | null;
|
|
22
|
+
set icon(value: string | null);
|
|
23
|
+
/**
|
|
24
|
+
* The button label.
|
|
25
|
+
*/
|
|
26
|
+
get label(): string;
|
|
27
|
+
set label(value: string);
|
|
28
|
+
/**
|
|
29
|
+
* The button value.
|
|
30
|
+
*/
|
|
31
|
+
get value(): DialogResult;
|
|
32
|
+
set value(value: DialogResult);
|
|
33
|
+
/**
|
|
34
|
+
* A tone variant.
|
|
35
|
+
*/
|
|
36
|
+
get variant(): Variant | null;
|
|
37
|
+
set variant(value: Variant | null);
|
|
38
|
+
/**
|
|
39
|
+
* Method invoked when an attribute has been changed.
|
|
40
|
+
* @param attribute The attribute name.
|
|
41
|
+
* @param oldValue The previous attribute value.
|
|
42
|
+
* @param newValue The new attribute value.
|
|
43
|
+
*/
|
|
44
|
+
attributeChangedCallback(attribute: string, oldValue: string | null, newValue: string | null): void;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Declaration merging.
|
|
48
|
+
*/
|
|
49
|
+
declare global {
|
|
50
|
+
/**
|
|
51
|
+
* The map of HTML tag names.
|
|
52
|
+
*/
|
|
53
|
+
interface HTMLElementTagNameMap {
|
|
54
|
+
"dialog-button": DialogButton;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=DialogButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogButton.d.ts","sourceRoot":"","sources":["../../../src/Client/UI/Components/DialogButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAsB,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAC,OAAO,EAAsB,MAAM,eAAe,CAAC;AAE3D;;GAEG;AACH,qBAAa,YAAa,SAAQ,WAAW;;IAE5C;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,kBAAkB,WAAoD;IAStF;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,GAAC,IAAI,CAG1B;IACD,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,GAAC,IAAI,EAG9B;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,GAAC,IAAI,CAGtB;IACD,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,GAAC,IAAI,EAG1B;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;IACD,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAEtB;IAED;;OAEG;IACH,IAAI,KAAK,IAAI,YAAY,CAGxB;IACD,IAAI,KAAK,CAAC,KAAK,EAAE,YAAY,EAE5B;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,GAAC,IAAI,CAG1B;IACD,IAAI,OAAO,CAAC,KAAK,EAAE,OAAO,GAAC,IAAI,EAG9B;IAED;;;;;OAKG;IACH,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAC,IAAI,GAAG,IAAI;CA6D/F;AAED;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,qBAAqB;QAC9B,eAAe,EAAE,YAAY,CAAC;KAC9B;CACD"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { Context, toCss as contextCss } from "../Context.js";
|
|
2
|
+
import { DialogResult } from "../DialogResult.js";
|
|
3
|
+
import { Variant, toCss as variantCss } from "../Variant.js";
|
|
4
|
+
/**
|
|
5
|
+
* Represents a dialog box button.
|
|
6
|
+
*/
|
|
7
|
+
export class DialogButton extends HTMLElement {
|
|
8
|
+
/**
|
|
9
|
+
* The list of observed attributes.
|
|
10
|
+
*/
|
|
11
|
+
static observedAttributes = ["context", "icon", "label", "value", "variant"];
|
|
12
|
+
/**
|
|
13
|
+
* Registers the component.
|
|
14
|
+
*/
|
|
15
|
+
static {
|
|
16
|
+
customElements.define("dialog-button", this);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A contextual modifier.
|
|
20
|
+
*/
|
|
21
|
+
get context() {
|
|
22
|
+
const value = this.getAttribute("context");
|
|
23
|
+
return Object.values(Context).includes(value) ? value : null;
|
|
24
|
+
}
|
|
25
|
+
set context(value) {
|
|
26
|
+
if (value)
|
|
27
|
+
this.setAttribute("context", value);
|
|
28
|
+
else
|
|
29
|
+
this.removeAttribute("context");
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The button icon.
|
|
33
|
+
*/
|
|
34
|
+
get icon() {
|
|
35
|
+
const value = this.getAttribute("icon") ?? "";
|
|
36
|
+
return value.trim() || null;
|
|
37
|
+
}
|
|
38
|
+
set icon(value) {
|
|
39
|
+
if (value)
|
|
40
|
+
this.setAttribute("icon", value);
|
|
41
|
+
else
|
|
42
|
+
this.removeAttribute("icon");
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The button label.
|
|
46
|
+
*/
|
|
47
|
+
get label() {
|
|
48
|
+
return (this.getAttribute("label") ?? "").trim();
|
|
49
|
+
}
|
|
50
|
+
set label(value) {
|
|
51
|
+
this.setAttribute("label", value);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The button value.
|
|
55
|
+
*/
|
|
56
|
+
get value() {
|
|
57
|
+
const value = this.getAttribute("value");
|
|
58
|
+
return Object.values(DialogResult).includes(value) ? value : DialogResult.None;
|
|
59
|
+
}
|
|
60
|
+
set value(value) {
|
|
61
|
+
this.setAttribute("value", value);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A tone variant.
|
|
65
|
+
*/
|
|
66
|
+
get variant() {
|
|
67
|
+
const value = this.getAttribute("variant");
|
|
68
|
+
return Object.values(Variant).includes(value) ? value : null;
|
|
69
|
+
}
|
|
70
|
+
set variant(value) {
|
|
71
|
+
if (value)
|
|
72
|
+
this.setAttribute("variant", value);
|
|
73
|
+
else
|
|
74
|
+
this.removeAttribute("variant");
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Method invoked when an attribute has been changed.
|
|
78
|
+
* @param attribute The attribute name.
|
|
79
|
+
* @param oldValue The previous attribute value.
|
|
80
|
+
* @param newValue The new attribute value.
|
|
81
|
+
*/
|
|
82
|
+
attributeChangedCallback(attribute, oldValue, newValue) {
|
|
83
|
+
if (newValue != oldValue)
|
|
84
|
+
switch (attribute) {
|
|
85
|
+
case "context":
|
|
86
|
+
this.#updateContext(Object.values(Context).includes(newValue) ? newValue : null);
|
|
87
|
+
break;
|
|
88
|
+
case "icon":
|
|
89
|
+
this.#updateIcon(newValue);
|
|
90
|
+
break;
|
|
91
|
+
case "label":
|
|
92
|
+
this.#updateLabel(newValue ?? "");
|
|
93
|
+
break;
|
|
94
|
+
case "value":
|
|
95
|
+
this.#updateValue(Object.values(DialogResult).includes(newValue) ? newValue : DialogResult.None);
|
|
96
|
+
break;
|
|
97
|
+
case "variant":
|
|
98
|
+
this.#updateVariant(Object.values(Variant).includes(newValue) ? newValue : null);
|
|
99
|
+
break;
|
|
100
|
+
// No default
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Updates the contextual modifier.
|
|
105
|
+
* @param value The new value.
|
|
106
|
+
*/
|
|
107
|
+
#updateContext(value) {
|
|
108
|
+
const { classList } = this.querySelector("button");
|
|
109
|
+
classList.remove(...Object.values(Context).map(context => `btn-${contextCss(context)}`));
|
|
110
|
+
if (value)
|
|
111
|
+
classList.add(`btn-${contextCss(value)}`);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Updates the button icon.
|
|
115
|
+
* @param value The new value.
|
|
116
|
+
*/
|
|
117
|
+
#updateIcon(value) {
|
|
118
|
+
const element = this.querySelector(".icon");
|
|
119
|
+
const icon = (value ?? "").trim();
|
|
120
|
+
element.textContent = icon;
|
|
121
|
+
element.hidden = !icon;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Updates the button label.
|
|
125
|
+
* @param value The new value.
|
|
126
|
+
*/
|
|
127
|
+
#updateLabel(value) {
|
|
128
|
+
const element = this.querySelector("span");
|
|
129
|
+
const label = value.trim();
|
|
130
|
+
element.textContent = label;
|
|
131
|
+
element.hidden = !label;
|
|
132
|
+
this.querySelector(".icon").classList.toggle("me-1", !element.hidden);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Updates the button value.
|
|
136
|
+
* @param value The new value.
|
|
137
|
+
*/
|
|
138
|
+
#updateValue(value) {
|
|
139
|
+
this.querySelector("button").value = value;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Updates the tone variant.
|
|
143
|
+
* @param value The new value.
|
|
144
|
+
*/
|
|
145
|
+
#updateVariant(value) {
|
|
146
|
+
const { classList } = this.querySelector("button");
|
|
147
|
+
classList.remove(...Object.values(Variant).map(variant => `btn-${variantCss(variant)}`));
|
|
148
|
+
if (value)
|
|
149
|
+
classList.add(`btn-${variantCss(value)}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
@@ -31,7 +31,7 @@ export class KeyboardAccelerator extends HTMLElement {
|
|
|
31
31
|
.reduce((modifiers, value) => modifiers | (KeyboardAccelerator.#modifiers.get(value) ?? 0), KeyboardModifiers.None);
|
|
32
32
|
}
|
|
33
33
|
set modifiers(value) {
|
|
34
|
-
this.setAttribute("modifiers", KeyboardAccelerator.#modifiers.entries()
|
|
34
|
+
this.setAttribute("modifiers", !value ? "None" : KeyboardAccelerator.#modifiers.entries()
|
|
35
35
|
.filter(([, flag]) => (value & flag) != 0)
|
|
36
36
|
.map(([key]) => key)
|
|
37
37
|
.toArray().join(", "));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Alignment } from "../Alignment.js";
|
|
1
2
|
import { AppTheme } from "../AppTheme.js";
|
|
2
|
-
import { MenuAlignment } from "../MenuAlignment.js";
|
|
3
3
|
/**
|
|
4
4
|
* A dropdown menu for switching the application theme.
|
|
5
5
|
*/
|
|
@@ -16,8 +16,8 @@ export declare class ThemeDropdown extends HTMLElement {
|
|
|
16
16
|
/**
|
|
17
17
|
* The alignment of the dropdown menu.
|
|
18
18
|
*/
|
|
19
|
-
get alignment():
|
|
20
|
-
set alignment(value:
|
|
19
|
+
get alignment(): Alignment;
|
|
20
|
+
set alignment(value: Alignment);
|
|
21
21
|
/**
|
|
22
22
|
* The current application theme.
|
|
23
23
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeDropdown.d.ts","sourceRoot":"","sources":["../../../src/Client/UI/Components/ThemeDropdown.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"ThemeDropdown.d.ts","sourceRoot":"","sources":["../../../src/Client/UI/Components/ThemeDropdown.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAC,QAAQ,EAAU,MAAM,gBAAgB,CAAC;AAEjD;;GAEG;AACH,qBAAa,aAAc,SAAQ,WAAW;;IAE7C;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,kBAAkB,WAAsC;IAYxE;;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,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;IAe/F;;OAEG;IACH,KAAK,IAAI,IAAI;IAIb;;OAEG;IACH,iBAAiB,IAAI,IAAI;IAQzB;;OAEG;IACH,oBAAoB,IAAI,IAAI;IAK5B;;OAEG;IACH,IAAI,IAAI,IAAI;IAIZ;;OAEG;IACH,IAAI,IAAI,IAAI;CAgDZ;AAED;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,qBAAqB;QAC9B,gBAAgB,EAAE,aAAa,CAAC;KAChC;CACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dropdown } from "bootstrap";
|
|
2
|
+
import { Alignment } from "../Alignment.js";
|
|
2
3
|
import { AppTheme, getIcon } from "../AppTheme.js";
|
|
3
|
-
import { MenuAlignment } from "../MenuAlignment.js";
|
|
4
4
|
/**
|
|
5
5
|
* A dropdown menu for switching the application theme.
|
|
6
6
|
*/
|
|
@@ -36,7 +36,7 @@ export class ThemeDropdown extends HTMLElement {
|
|
|
36
36
|
*/
|
|
37
37
|
get alignment() {
|
|
38
38
|
const value = this.getAttribute("alignment");
|
|
39
|
-
return Object.values(
|
|
39
|
+
return Object.values(Alignment).includes(value) ? value : Alignment.End;
|
|
40
40
|
}
|
|
41
41
|
set alignment(value) {
|
|
42
42
|
this.setAttribute("alignment", value);
|
|
@@ -81,7 +81,7 @@ export class ThemeDropdown extends HTMLElement {
|
|
|
81
81
|
if (newValue != oldValue)
|
|
82
82
|
switch (attribute) {
|
|
83
83
|
case "alignment":
|
|
84
|
-
this.#updateAlignment(Object.values(
|
|
84
|
+
this.#updateAlignment(Object.values(Alignment).includes(newValue) ? newValue : Alignment.End);
|
|
85
85
|
break;
|
|
86
86
|
case "apptheme":
|
|
87
87
|
this.#updateAppTheme(Object.values(AppTheme).includes(newValue) ? newValue : AppTheme.System);
|
|
@@ -149,11 +149,7 @@ export class ThemeDropdown extends HTMLElement {
|
|
|
149
149
|
* @param value The new value.
|
|
150
150
|
*/
|
|
151
151
|
#updateAlignment(value) {
|
|
152
|
-
|
|
153
|
-
if (value == MenuAlignment.End)
|
|
154
|
-
classList.add("dropdown-menu-end");
|
|
155
|
-
else
|
|
156
|
-
classList.remove("dropdown-menu-end");
|
|
152
|
+
this.querySelector(".dropdown-menu").classList.toggle("dropdown-menu-end", value == Alignment.End);
|
|
157
153
|
}
|
|
158
154
|
/**
|
|
159
155
|
* Updates the application theme.
|
|
@@ -49,8 +49,8 @@ export declare class Toast extends HTMLElement {
|
|
|
49
49
|
/**
|
|
50
50
|
* The icon displayed next to the caption.
|
|
51
51
|
*/
|
|
52
|
-
get icon(): string;
|
|
53
|
-
set icon(value: string);
|
|
52
|
+
get icon(): string | null;
|
|
53
|
+
set icon(value: string | null);
|
|
54
54
|
/**
|
|
55
55
|
* Value indicating whether to initially show this toast.
|
|
56
56
|
*/
|
|
@@ -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,eAAe,CAAC;AAEtD;;GAEG;AACH,qBAAa,KAAM,SAAQ,WAAW;;IAErC;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../src/Client/UI/Components/Toast.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAiB,MAAM,eAAe,CAAC;AAEtD;;GAEG;AACH,qBAAa,KAAM,SAAQ,WAAW;;IAErC;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,kBAAkB,WAAkE;IAkCpG;;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,YAAY,CAAC,KAAK,EAAE,gBAAgB,EAEvC;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,GAAC,IAAI,CAGtB;IACD,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,GAAC,IAAI,EAG1B;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,OAAO,CAElB;IACD,IAAI,IAAI,CAAC,KAAK,EAAE,OAAO,EAGtB;IAED;;;;;OAKG;IACH,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAC,IAAI,GAAG,IAAI;IAY/F;;OAEG;IACH,iBAAiB,IAAI,IAAI;IASzB;;OAEG;IACH,oBAAoB,IAAI,IAAI;IAK5B;;OAEG;IACH,IAAI,IAAI,IAAI;IAIZ;;OAEG;IACH,IAAI,IAAI,IAAI;CA+EZ;AAED;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,qBAAqB;QAC9B,cAAc,EAAE,KAAK,CAAC;KACtB;CACD"}
|
|
@@ -7,7 +7,7 @@ export class Toast extends HTMLElement {
|
|
|
7
7
|
/**
|
|
8
8
|
* The list of observed attributes.
|
|
9
9
|
*/
|
|
10
|
-
static observedAttributes = ["caption", "context", "culture", "icon", "open"];
|
|
10
|
+
static observedAttributes = ["animation", "caption", "context", "culture", "icon", "open"];
|
|
11
11
|
/**
|
|
12
12
|
* The time units.
|
|
13
13
|
*/
|
|
@@ -114,10 +114,13 @@ export class Toast extends HTMLElement {
|
|
|
114
114
|
*/
|
|
115
115
|
get icon() {
|
|
116
116
|
const value = this.getAttribute("icon") ?? "";
|
|
117
|
-
return value.trim() ||
|
|
117
|
+
return value.trim() || null;
|
|
118
118
|
}
|
|
119
119
|
set icon(value) {
|
|
120
|
-
|
|
120
|
+
if (value)
|
|
121
|
+
this.setAttribute("icon", value);
|
|
122
|
+
else
|
|
123
|
+
this.removeAttribute("icon");
|
|
121
124
|
}
|
|
122
125
|
/**
|
|
123
126
|
* Value indicating whether to initially show this toast.
|
|
@@ -140,6 +143,9 @@ export class Toast extends HTMLElement {
|
|
|
140
143
|
attributeChangedCallback(attribute, oldValue, newValue) {
|
|
141
144
|
if (newValue != oldValue)
|
|
142
145
|
switch (attribute) {
|
|
146
|
+
case "animation":
|
|
147
|
+
this.#updateAnimation(newValue != null);
|
|
148
|
+
break;
|
|
143
149
|
case "caption":
|
|
144
150
|
this.#updateCaption(newValue ?? "");
|
|
145
151
|
break;
|
|
@@ -150,10 +156,11 @@ export class Toast extends HTMLElement {
|
|
|
150
156
|
this.#formatter = new Intl.RelativeTimeFormat((newValue ?? "").trim() || navigator.language, { style: "long" });
|
|
151
157
|
break;
|
|
152
158
|
case "icon":
|
|
153
|
-
this.#updateIcon(newValue
|
|
159
|
+
this.#updateIcon(newValue);
|
|
154
160
|
break;
|
|
155
161
|
case "open":
|
|
156
|
-
this.#updateVisibility();
|
|
162
|
+
this.#updateVisibility(newValue != null);
|
|
163
|
+
break;
|
|
157
164
|
// No default
|
|
158
165
|
}
|
|
159
166
|
}
|
|
@@ -203,6 +210,13 @@ export class Toast extends HTMLElement {
|
|
|
203
210
|
}
|
|
204
211
|
return this.#formatter.format(Math.ceil(-elapsed), Toast.#timeUnits[index]);
|
|
205
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Updates the toast animation.
|
|
215
|
+
* @param value The new value.
|
|
216
|
+
*/
|
|
217
|
+
#updateAnimation(value) {
|
|
218
|
+
this.firstElementChild.classList.toggle("fade", value);
|
|
219
|
+
}
|
|
206
220
|
/**
|
|
207
221
|
* Updates the title displayed in the header.
|
|
208
222
|
* @param value The new value.
|
|
@@ -211,7 +225,7 @@ export class Toast extends HTMLElement {
|
|
|
211
225
|
this.querySelector(".toast-header b").textContent = value.trim();
|
|
212
226
|
}
|
|
213
227
|
/**
|
|
214
|
-
* Updates the
|
|
228
|
+
* Updates the contextual modifier.
|
|
215
229
|
* @param value The new value.
|
|
216
230
|
*/
|
|
217
231
|
#updateContext(value) {
|
|
@@ -235,19 +249,13 @@ export class Toast extends HTMLElement {
|
|
|
235
249
|
* @param value The new value.
|
|
236
250
|
*/
|
|
237
251
|
#updateIcon(value) {
|
|
238
|
-
this.querySelector(".toast-header .icon").textContent = value.trim() || getIcon(this.context);
|
|
252
|
+
this.querySelector(".toast-header .icon").textContent = (value ?? "").trim() || getIcon(this.context);
|
|
239
253
|
}
|
|
240
254
|
/**
|
|
241
255
|
* Updates the toast visibility.
|
|
256
|
+
* @param value The new value.
|
|
242
257
|
*/
|
|
243
|
-
#updateVisibility() {
|
|
244
|
-
|
|
245
|
-
if (!this.open)
|
|
246
|
-
classList.remove("show");
|
|
247
|
-
else {
|
|
248
|
-
if (this.animation)
|
|
249
|
-
classList.add("fade");
|
|
250
|
-
classList.add("show");
|
|
251
|
-
}
|
|
258
|
+
#updateVisibility(value) {
|
|
259
|
+
this.firstElementChild.classList.toggle("show", value);
|
|
252
260
|
}
|
|
253
261
|
}
|
|
@@ -74,8 +74,8 @@ export declare class Toaster extends HTMLElement {
|
|
|
74
74
|
/**
|
|
75
75
|
* The default icon displayed next to the captions.
|
|
76
76
|
*/
|
|
77
|
-
get icon(): string;
|
|
78
|
-
set icon(value: string);
|
|
77
|
+
get icon(): string | null;
|
|
78
|
+
set icon(value: string | null);
|
|
79
79
|
/**
|
|
80
80
|
* The toaster placement.
|
|
81
81
|
*/
|
|
@@ -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,EAAQ,MAAM,gBAAgB,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,MAAM;IAEtB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,YAAY,EAAE,gBAAgB,GAAC,MAAM,CAAC;IAEtC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IAEtB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,qBAAa,OAAQ,SAAQ,WAAW;;IAEvC;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,kBAAkB,WAAgB;IAclD;;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,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,IAAI,IAAI,MAAM,
|
|
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,EAAQ,MAAM,gBAAgB,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,MAAM;IAEtB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,YAAY,EAAE,gBAAgB,GAAC,MAAM,CAAC;IAEtC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC;IAEtB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,qBAAa,OAAQ,SAAQ,WAAW;;IAEvC;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,kBAAkB,WAAgB;IAclD;;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,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,IAAI,IAAI,MAAM,GAAC,IAAI,CAGtB;IACD,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,GAAC,IAAI,EAG1B;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,QAAQ,CAGvB;IACD,IAAI,QAAQ,CAAC,KAAK,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;IAS/F;;;;;OAKG;IACH,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,gBAAgB,GAAC,MAAM,GAAG,IAAI;IAItF;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;CA2BzB;AAED;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IAEd;;OAEG;IACH,UAAU,qBAAqB;QAC9B,mBAAmB,EAAE,OAAO,CAAC;KAC7B;CACD"}
|
|
@@ -77,10 +77,14 @@ export class Toaster extends HTMLElement {
|
|
|
77
77
|
* The default icon displayed next to the captions.
|
|
78
78
|
*/
|
|
79
79
|
get icon() {
|
|
80
|
-
|
|
80
|
+
const value = this.getAttribute("icon") ?? "";
|
|
81
|
+
return value.trim() || null;
|
|
81
82
|
}
|
|
82
83
|
set icon(value) {
|
|
83
|
-
|
|
84
|
+
if (value)
|
|
85
|
+
this.setAttribute("icon", value);
|
|
86
|
+
else
|
|
87
|
+
this.removeAttribute("icon");
|
|
84
88
|
}
|
|
85
89
|
/**
|
|
86
90
|
* The toaster placement.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Specifies the return value of a dialog box.
|
|
3
|
+
*/
|
|
4
|
+
export declare const DialogResult: Readonly<{
|
|
5
|
+
/**
|
|
6
|
+
* The dialog box does not return any value.
|
|
7
|
+
*/
|
|
8
|
+
None: "None";
|
|
9
|
+
/**
|
|
10
|
+
* The return value of the dialog box is "OK".
|
|
11
|
+
*/
|
|
12
|
+
OK: "OK";
|
|
13
|
+
/**
|
|
14
|
+
* The return value of the dialog box is "Cancel".
|
|
15
|
+
*/
|
|
16
|
+
Cancel: "Cancel";
|
|
17
|
+
/**
|
|
18
|
+
* The return value of the dialog box is "Abort".
|
|
19
|
+
*/
|
|
20
|
+
Abort: "Abort";
|
|
21
|
+
/**
|
|
22
|
+
* The return value of the dialog box is "Retry".
|
|
23
|
+
*/
|
|
24
|
+
Retry: "Retry";
|
|
25
|
+
/**
|
|
26
|
+
* The return value of the dialog box is "Ignore".
|
|
27
|
+
*/
|
|
28
|
+
Ignore: "Ignore";
|
|
29
|
+
/**
|
|
30
|
+
* The return value of the dialog box is "Yes".
|
|
31
|
+
*/
|
|
32
|
+
Yes: "Yes";
|
|
33
|
+
/**
|
|
34
|
+
* The return value of the dialog box is "No".
|
|
35
|
+
*/
|
|
36
|
+
No: "No";
|
|
37
|
+
}>;
|
|
38
|
+
/**
|
|
39
|
+
* Specifies the return value of a dialog box.
|
|
40
|
+
*/
|
|
41
|
+
export type DialogResult = typeof DialogResult[keyof typeof DialogResult];
|
|
42
|
+
//# sourceMappingURL=DialogResult.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DialogResult.d.ts","sourceRoot":"","sources":["../../src/Client/UI/DialogResult.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,YAAY;IAExB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;EAEF,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Specifies the return value of a dialog box.
|
|
3
|
+
*/
|
|
4
|
+
export const DialogResult = Object.freeze({
|
|
5
|
+
/**
|
|
6
|
+
* The dialog box does not return any value.
|
|
7
|
+
*/
|
|
8
|
+
None: "None",
|
|
9
|
+
/**
|
|
10
|
+
* The return value of the dialog box is "OK".
|
|
11
|
+
*/
|
|
12
|
+
OK: "OK",
|
|
13
|
+
/**
|
|
14
|
+
* The return value of the dialog box is "Cancel".
|
|
15
|
+
*/
|
|
16
|
+
Cancel: "Cancel",
|
|
17
|
+
/**
|
|
18
|
+
* The return value of the dialog box is "Abort".
|
|
19
|
+
*/
|
|
20
|
+
Abort: "Abort",
|
|
21
|
+
/**
|
|
22
|
+
* The return value of the dialog box is "Retry".
|
|
23
|
+
*/
|
|
24
|
+
Retry: "Retry",
|
|
25
|
+
/**
|
|
26
|
+
* The return value of the dialog box is "Ignore".
|
|
27
|
+
*/
|
|
28
|
+
Ignore: "Ignore",
|
|
29
|
+
/**
|
|
30
|
+
* The return value of the dialog box is "Yes".
|
|
31
|
+
*/
|
|
32
|
+
Yes: "Yes",
|
|
33
|
+
/**
|
|
34
|
+
* The return value of the dialog box is "No".
|
|
35
|
+
*/
|
|
36
|
+
No: "No"
|
|
37
|
+
});
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"name": "@cedx/base",
|
|
8
8
|
"repository": "cedx/base",
|
|
9
9
|
"type": "module",
|
|
10
|
-
"version": "0.
|
|
10
|
+
"version": "0.16.0",
|
|
11
11
|
"devDependencies": {
|
|
12
12
|
"@playwright/browser-chromium": "^1.55.0",
|
|
13
13
|
"@types/bootstrap": "^5.2.10",
|
|
@@ -45,8 +45,7 @@
|
|
|
45
45
|
"library"
|
|
46
46
|
],
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"bootstrap": ">=5.3.0"
|
|
49
|
-
"lit": ">=3.3.0"
|
|
48
|
+
"bootstrap": ">=5.3.0"
|
|
50
49
|
},
|
|
51
50
|
"publishConfig": {
|
|
52
51
|
"access": "public"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines the alignment of a component.
|
|
3
|
+
*/
|
|
4
|
+
export const Alignment = Object.freeze({
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The element is aligned at the start.
|
|
8
|
+
*/
|
|
9
|
+
Start: "Start",
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The element is aligned in the center.
|
|
13
|
+
*/
|
|
14
|
+
Center: "Center",
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The element is aligned at the end.
|
|
18
|
+
*/
|
|
19
|
+
End: "End"
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Defines the alignment of a component.
|
|
24
|
+
*/
|
|
25
|
+
export type Alignment = typeof Alignment[keyof typeof Alignment];
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import {Context, toCss as contextCss} from "../Context.js";
|
|
2
|
+
import {DialogResult} from "../DialogResult.js";
|
|
3
|
+
import {Variant, toCss as variantCss} from "../Variant.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Represents a dialog box button.
|
|
7
|
+
*/
|
|
8
|
+
export class DialogButton extends HTMLElement {
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The list of observed attributes.
|
|
12
|
+
*/
|
|
13
|
+
static readonly observedAttributes = ["context", "icon", "label", "value", "variant"];
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Registers the component.
|
|
17
|
+
*/
|
|
18
|
+
static {
|
|
19
|
+
customElements.define("dialog-button", this);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A contextual modifier.
|
|
24
|
+
*/
|
|
25
|
+
get context(): Context|null {
|
|
26
|
+
const value = this.getAttribute("context") as Context;
|
|
27
|
+
return Object.values(Context).includes(value) ? value : null;
|
|
28
|
+
}
|
|
29
|
+
set context(value: Context|null) {
|
|
30
|
+
if (value) this.setAttribute("context", value);
|
|
31
|
+
else this.removeAttribute("context");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The button icon.
|
|
36
|
+
*/
|
|
37
|
+
get icon(): string|null {
|
|
38
|
+
const value = this.getAttribute("icon") ?? "";
|
|
39
|
+
return value.trim() || null;
|
|
40
|
+
}
|
|
41
|
+
set icon(value: string|null) {
|
|
42
|
+
if (value) this.setAttribute("icon", value);
|
|
43
|
+
else this.removeAttribute("icon");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The button label.
|
|
48
|
+
*/
|
|
49
|
+
get label(): string {
|
|
50
|
+
return (this.getAttribute("label") ?? "").trim();
|
|
51
|
+
}
|
|
52
|
+
set label(value: string) {
|
|
53
|
+
this.setAttribute("label", value);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The button value.
|
|
58
|
+
*/
|
|
59
|
+
get value(): DialogResult {
|
|
60
|
+
const value = this.getAttribute("value") as DialogResult;
|
|
61
|
+
return Object.values(DialogResult).includes(value) ? value : DialogResult.None;
|
|
62
|
+
}
|
|
63
|
+
set value(value: DialogResult) {
|
|
64
|
+
this.setAttribute("value", value);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* A tone variant.
|
|
69
|
+
*/
|
|
70
|
+
get variant(): Variant|null {
|
|
71
|
+
const value = this.getAttribute("variant") as Variant;
|
|
72
|
+
return Object.values(Variant).includes(value) ? value : null;
|
|
73
|
+
}
|
|
74
|
+
set variant(value: Variant|null) {
|
|
75
|
+
if (value) this.setAttribute("variant", value);
|
|
76
|
+
else this.removeAttribute("variant");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Method invoked when an attribute has been changed.
|
|
81
|
+
* @param attribute The attribute name.
|
|
82
|
+
* @param oldValue The previous attribute value.
|
|
83
|
+
* @param newValue The new attribute value.
|
|
84
|
+
*/
|
|
85
|
+
attributeChangedCallback(attribute: string, oldValue: string|null, newValue: string|null): void {
|
|
86
|
+
if (newValue != oldValue) switch (attribute) {
|
|
87
|
+
case "context": this.#updateContext(Object.values(Context).includes(newValue as Context) ? newValue as Context : null); break;
|
|
88
|
+
case "icon": this.#updateIcon(newValue); break;
|
|
89
|
+
case "label": this.#updateLabel(newValue ?? ""); break;
|
|
90
|
+
case "value": this.#updateValue(Object.values(DialogResult).includes(newValue as DialogResult) ? newValue as DialogResult : DialogResult.None); break;
|
|
91
|
+
case "variant": this.#updateVariant(Object.values(Variant).includes(newValue as Variant) ? newValue as Variant : null); break;
|
|
92
|
+
// No default
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Updates the contextual modifier.
|
|
98
|
+
* @param value The new value.
|
|
99
|
+
*/
|
|
100
|
+
#updateContext(value: Context|null): void {
|
|
101
|
+
const {classList} = this.querySelector("button")!;
|
|
102
|
+
classList.remove(...Object.values(Context).map(context => `btn-${contextCss(context)}`));
|
|
103
|
+
if (value) classList.add(`btn-${contextCss(value)}`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Updates the button icon.
|
|
108
|
+
* @param value The new value.
|
|
109
|
+
*/
|
|
110
|
+
#updateIcon(value: string|null): void {
|
|
111
|
+
const element = this.querySelector<HTMLElement>(".icon")!;
|
|
112
|
+
const icon = (value ?? "").trim();
|
|
113
|
+
element.textContent = icon;
|
|
114
|
+
element.hidden = !icon;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Updates the button label.
|
|
119
|
+
* @param value The new value.
|
|
120
|
+
*/
|
|
121
|
+
#updateLabel(value: string): void {
|
|
122
|
+
const element = this.querySelector("span")!;
|
|
123
|
+
const label = value.trim();
|
|
124
|
+
element.textContent = label;
|
|
125
|
+
element.hidden = !label;
|
|
126
|
+
this.querySelector(".icon")!.classList.toggle("me-1", !element.hidden);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Updates the button value.
|
|
131
|
+
* @param value The new value.
|
|
132
|
+
*/
|
|
133
|
+
#updateValue(value: DialogResult): void {
|
|
134
|
+
this.querySelector("button")!.value = value;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Updates the tone variant.
|
|
139
|
+
* @param value The new value.
|
|
140
|
+
*/
|
|
141
|
+
#updateVariant(value: Variant|null): void {
|
|
142
|
+
const {classList} = this.querySelector("button")!;
|
|
143
|
+
classList.remove(...Object.values(Variant).map(variant => `btn-${variantCss(variant)}`));
|
|
144
|
+
if (value) classList.add(`btn-${variantCss(value)}`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Declaration merging.
|
|
150
|
+
*/
|
|
151
|
+
declare global {
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* The map of HTML tag names.
|
|
155
|
+
*/
|
|
156
|
+
interface HTMLElementTagNameMap {
|
|
157
|
+
"dialog-button": DialogButton;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
@@ -36,7 +36,7 @@ export class KeyboardAccelerator extends HTMLElement {
|
|
|
36
36
|
.reduce<number>((modifiers, value) => modifiers | (KeyboardAccelerator.#modifiers.get(value) ?? 0), KeyboardModifiers.None);
|
|
37
37
|
}
|
|
38
38
|
set modifiers(value: number) {
|
|
39
|
-
this.setAttribute("modifiers", KeyboardAccelerator.#modifiers.entries()
|
|
39
|
+
this.setAttribute("modifiers", !value ? "None" : KeyboardAccelerator.#modifiers.entries()
|
|
40
40
|
.filter(([, flag]) => (value & flag) != 0)
|
|
41
41
|
.map(([key]) => key)
|
|
42
42
|
.toArray().join(", "));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Dropdown} from "bootstrap";
|
|
2
|
+
import {Alignment} from "../Alignment.js";
|
|
2
3
|
import {AppTheme, getIcon} from "../AppTheme.js";
|
|
3
|
-
import {MenuAlignment} from "../MenuAlignment.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* A dropdown menu for switching the application theme.
|
|
@@ -40,11 +40,11 @@ export class ThemeDropdown extends HTMLElement {
|
|
|
40
40
|
/**
|
|
41
41
|
* The alignment of the dropdown menu.
|
|
42
42
|
*/
|
|
43
|
-
get alignment():
|
|
44
|
-
const value = this.getAttribute("alignment") as
|
|
45
|
-
return Object.values(
|
|
43
|
+
get alignment(): Alignment {
|
|
44
|
+
const value = this.getAttribute("alignment") as Alignment;
|
|
45
|
+
return Object.values(Alignment).includes(value) ? value : Alignment.End;
|
|
46
46
|
}
|
|
47
|
-
set alignment(value:
|
|
47
|
+
set alignment(value: Alignment) {
|
|
48
48
|
this.setAttribute("alignment", value);
|
|
49
49
|
}
|
|
50
50
|
|
|
@@ -90,7 +90,7 @@ export class ThemeDropdown extends HTMLElement {
|
|
|
90
90
|
attributeChangedCallback(attribute: string, oldValue: string|null, newValue: string|null): void {
|
|
91
91
|
if (newValue != oldValue) switch (attribute) {
|
|
92
92
|
case "alignment":
|
|
93
|
-
this.#updateAlignment(Object.values(
|
|
93
|
+
this.#updateAlignment(Object.values(Alignment).includes(newValue as Alignment) ? newValue as Alignment : Alignment.End);
|
|
94
94
|
break;
|
|
95
95
|
case "apptheme":
|
|
96
96
|
this.#updateAppTheme(Object.values(AppTheme).includes(newValue as AppTheme) ? newValue as AppTheme : AppTheme.System);
|
|
@@ -165,10 +165,8 @@ export class ThemeDropdown extends HTMLElement {
|
|
|
165
165
|
* Updates the alignment of the dropdown menu.
|
|
166
166
|
* @param value The new value.
|
|
167
167
|
*/
|
|
168
|
-
#updateAlignment(value:
|
|
169
|
-
|
|
170
|
-
if (value == MenuAlignment.End) classList.add("dropdown-menu-end");
|
|
171
|
-
else classList.remove("dropdown-menu-end");
|
|
168
|
+
#updateAlignment(value: Alignment): void {
|
|
169
|
+
this.querySelector(".dropdown-menu")!.classList.toggle("dropdown-menu-end", value == Alignment.End);
|
|
172
170
|
}
|
|
173
171
|
|
|
174
172
|
/**
|
|
@@ -9,7 +9,7 @@ export class Toast extends HTMLElement {
|
|
|
9
9
|
/**
|
|
10
10
|
* The list of observed attributes.
|
|
11
11
|
*/
|
|
12
|
-
static readonly observedAttributes = ["caption", "context", "culture", "icon", "open"];
|
|
12
|
+
static readonly observedAttributes = ["animation", "caption", "context", "culture", "icon", "open"];
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* The time units.
|
|
@@ -125,12 +125,13 @@ export class Toast extends HTMLElement {
|
|
|
125
125
|
/**
|
|
126
126
|
* The icon displayed next to the caption.
|
|
127
127
|
*/
|
|
128
|
-
get icon(): string {
|
|
128
|
+
get icon(): string|null {
|
|
129
129
|
const value = this.getAttribute("icon") ?? "";
|
|
130
|
-
return value.trim() ||
|
|
130
|
+
return value.trim() || null;
|
|
131
131
|
}
|
|
132
|
-
set icon(value: string) {
|
|
133
|
-
this.setAttribute("icon", value);
|
|
132
|
+
set icon(value: string|null) {
|
|
133
|
+
if (value) this.setAttribute("icon", value);
|
|
134
|
+
else this.removeAttribute("icon");
|
|
134
135
|
}
|
|
135
136
|
|
|
136
137
|
/**
|
|
@@ -152,20 +153,12 @@ export class Toast extends HTMLElement {
|
|
|
152
153
|
*/
|
|
153
154
|
attributeChangedCallback(attribute: string, oldValue: string|null, newValue: string|null): void {
|
|
154
155
|
if (newValue != oldValue) switch (attribute) {
|
|
155
|
-
case "
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
case "
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
case "culture":
|
|
162
|
-
this.#formatter = new Intl.RelativeTimeFormat((newValue ?? "").trim() || navigator.language, {style: "long"});
|
|
163
|
-
break;
|
|
164
|
-
case "icon":
|
|
165
|
-
this.#updateIcon(newValue ?? "");
|
|
166
|
-
break;
|
|
167
|
-
case "open":
|
|
168
|
-
this.#updateVisibility();
|
|
156
|
+
case "animation": this.#updateAnimation(newValue != null); break;
|
|
157
|
+
case "caption": this.#updateCaption(newValue ?? ""); break;
|
|
158
|
+
case "context": this.#updateContext(Object.values(Context).includes(newValue as Context) ? newValue as Context : Context.Info); break;
|
|
159
|
+
case "culture": this.#formatter = new Intl.RelativeTimeFormat((newValue ?? "").trim() || navigator.language, {style: "long"}); break;
|
|
160
|
+
case "icon": this.#updateIcon(newValue); break;
|
|
161
|
+
case "open": this.#updateVisibility(newValue != null); break;
|
|
169
162
|
// No default
|
|
170
163
|
}
|
|
171
164
|
}
|
|
@@ -224,6 +217,14 @@ export class Toast extends HTMLElement {
|
|
|
224
217
|
return this.#formatter.format(Math.ceil(-elapsed), Toast.#timeUnits[index]);
|
|
225
218
|
}
|
|
226
219
|
|
|
220
|
+
/**
|
|
221
|
+
* Updates the toast animation.
|
|
222
|
+
* @param value The new value.
|
|
223
|
+
*/
|
|
224
|
+
#updateAnimation(value: boolean): void {
|
|
225
|
+
this.firstElementChild!.classList.toggle("fade", value);
|
|
226
|
+
}
|
|
227
|
+
|
|
227
228
|
/**
|
|
228
229
|
* Updates the title displayed in the header.
|
|
229
230
|
* @param value The new value.
|
|
@@ -233,7 +234,7 @@ export class Toast extends HTMLElement {
|
|
|
233
234
|
}
|
|
234
235
|
|
|
235
236
|
/**
|
|
236
|
-
* Updates the
|
|
237
|
+
* Updates the contextual modifier.
|
|
237
238
|
* @param value The new value.
|
|
238
239
|
*/
|
|
239
240
|
#updateContext(value: Context): void {
|
|
@@ -260,20 +261,16 @@ export class Toast extends HTMLElement {
|
|
|
260
261
|
* Updates the icon displayed next to the caption.
|
|
261
262
|
* @param value The new value.
|
|
262
263
|
*/
|
|
263
|
-
#updateIcon(value: string): void {
|
|
264
|
-
this.querySelector(".toast-header .icon")!.textContent = value.trim() || getIcon(this.context);
|
|
264
|
+
#updateIcon(value: string|null): void {
|
|
265
|
+
this.querySelector(".toast-header .icon")!.textContent = (value ?? "").trim() || getIcon(this.context);
|
|
265
266
|
}
|
|
266
267
|
|
|
267
268
|
/**
|
|
268
269
|
* Updates the toast visibility.
|
|
270
|
+
* @param value The new value.
|
|
269
271
|
*/
|
|
270
|
-
#updateVisibility(): void {
|
|
271
|
-
|
|
272
|
-
if (!this.open) classList.remove("show");
|
|
273
|
-
else {
|
|
274
|
-
if (this.animation) classList.add("fade");
|
|
275
|
-
classList.add("show");
|
|
276
|
-
}
|
|
272
|
+
#updateVisibility(value: boolean): void {
|
|
273
|
+
this.firstElementChild!.classList.toggle("show", value);
|
|
277
274
|
}
|
|
278
275
|
}
|
|
279
276
|
|
|
@@ -128,11 +128,13 @@ export class Toaster extends HTMLElement {
|
|
|
128
128
|
/**
|
|
129
129
|
* The default icon displayed next to the captions.
|
|
130
130
|
*/
|
|
131
|
-
get icon(): string {
|
|
132
|
-
|
|
131
|
+
get icon(): string|null {
|
|
132
|
+
const value = this.getAttribute("icon") ?? "";
|
|
133
|
+
return value.trim() || null;
|
|
133
134
|
}
|
|
134
|
-
set icon(value: string) {
|
|
135
|
-
this.setAttribute("icon", value);
|
|
135
|
+
set icon(value: string|null) {
|
|
136
|
+
if (value) this.setAttribute("icon", value);
|
|
137
|
+
else this.removeAttribute("icon");
|
|
136
138
|
}
|
|
137
139
|
|
|
138
140
|
/**
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Specifies the return value of a dialog box.
|
|
3
|
+
*/
|
|
4
|
+
export const DialogResult = Object.freeze({
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The dialog box does not return any value.
|
|
8
|
+
*/
|
|
9
|
+
None: "None",
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The return value of the dialog box is "OK".
|
|
13
|
+
*/
|
|
14
|
+
OK: "OK",
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The return value of the dialog box is "Cancel".
|
|
18
|
+
*/
|
|
19
|
+
Cancel: "Cancel",
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The return value of the dialog box is "Abort".
|
|
23
|
+
*/
|
|
24
|
+
Abort: "Abort",
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The return value of the dialog box is "Retry".
|
|
28
|
+
*/
|
|
29
|
+
Retry: "Retry",
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The return value of the dialog box is "Ignore".
|
|
33
|
+
*/
|
|
34
|
+
Ignore: "Ignore",
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The return value of the dialog box is "Yes".
|
|
38
|
+
*/
|
|
39
|
+
Yes: "Yes",
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The return value of the dialog box is "No".
|
|
43
|
+
*/
|
|
44
|
+
No: "No"
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Specifies the return value of a dialog box.
|
|
49
|
+
*/
|
|
50
|
+
export type DialogResult = typeof DialogResult[keyof typeof DialogResult];
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { LitElement, type CSSResultGroup } from "lit";
|
|
2
|
-
/**
|
|
3
|
-
* Optional base class for UI components. Alternatively, components may extend {@link LitElement} directly.
|
|
4
|
-
*/
|
|
5
|
-
export declare abstract class ComponentBase extends LitElement {
|
|
6
|
-
#private;
|
|
7
|
-
/**
|
|
8
|
-
* The component styles.
|
|
9
|
-
*/
|
|
10
|
-
static styles: CSSResultGroup;
|
|
11
|
-
/**
|
|
12
|
-
* Creates a new component.
|
|
13
|
-
* @param options Value indicating whether a shadow DOM tree should be attached to this component.
|
|
14
|
-
*/
|
|
15
|
-
constructor(options?: {
|
|
16
|
-
attachShadow?: boolean;
|
|
17
|
-
});
|
|
18
|
-
/**
|
|
19
|
-
* Returns the node into which this component should render.
|
|
20
|
-
* @returns The node into which this component should render.
|
|
21
|
-
*/
|
|
22
|
-
protected createRenderRoot(): DocumentFragment | HTMLElement;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=ComponentBase.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,29 +0,0 @@
|
|
|
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,18 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/lib/UI/MenuAlignment.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import {LitElement, type CSSResultGroup} from "lit";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Optional base class for UI components. Alternatively, components may extend {@link LitElement} directly.
|
|
5
|
-
*/
|
|
6
|
-
export abstract class ComponentBase extends LitElement {
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* The component styles.
|
|
10
|
-
*/
|
|
11
|
-
static override styles: CSSResultGroup = [document.adoptedStyleSheets];
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Value indicating whether a shadow DOM tree should be attached to this component.
|
|
15
|
-
*/
|
|
16
|
-
readonly #attachShadow: boolean;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Creates a new component.
|
|
20
|
-
* @param options Value indicating whether a shadow DOM tree should be attached to this component.
|
|
21
|
-
*/
|
|
22
|
-
constructor(options: {attachShadow?: boolean} = {}) {
|
|
23
|
-
super();
|
|
24
|
-
this.#attachShadow = options.attachShadow ?? false;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Returns the node into which this component should render.
|
|
29
|
-
* @returns The node into which this component should render.
|
|
30
|
-
*/
|
|
31
|
-
protected override createRenderRoot(): DocumentFragment|HTMLElement {
|
|
32
|
-
return this.#attachShadow ? super.createRenderRoot() : this;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines the alignment of a dropdown menu.
|
|
3
|
-
*/
|
|
4
|
-
export const MenuAlignment = Object.freeze({
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* The dropdown menu is left aligned.
|
|
8
|
-
*/
|
|
9
|
-
Start: "Start",
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* The dropdown menu is right aligned.
|
|
13
|
-
*/
|
|
14
|
-
End: "End"
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Defines the alignment of a dropdown menu.
|
|
19
|
-
*/
|
|
20
|
-
export type MenuAlignment = typeof MenuAlignment[keyof typeof MenuAlignment];
|