@bodil/dom 0.1.5 → 0.1.6
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/package.json
CHANGED
|
@@ -9,14 +9,14 @@ import { html, nothing } from "lit";
|
|
|
9
9
|
test("@attribute", async () => {
|
|
10
10
|
@customElement("attribute-test-class")
|
|
11
11
|
class AttributeTestClass extends Component {
|
|
12
|
-
@attribute
|
|
12
|
+
@attribute accessor wibble: string | undefined = "Joe";
|
|
13
13
|
@attribute({ type: Number, reflect: true }) accessor wobble: number | undefined = 1;
|
|
14
14
|
@attribute({ type: Boolean, reflect: true }) accessor noMeansNo: boolean | undefined =
|
|
15
15
|
false;
|
|
16
16
|
@attribute({ name: "wolp", reactive: false, reflect: true }) accessor welp:
|
|
17
17
|
| string
|
|
18
18
|
| undefined = "Joe";
|
|
19
|
-
@attribute accessor hide: string | undefined = "no";
|
|
19
|
+
@attribute({ reflect: false }) accessor hide: string | undefined = "no";
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const t = document.createElement("attribute-test-class") as AttributeTestClass;
|
|
@@ -85,18 +85,18 @@ test("@attribute getter/setter", async () => {
|
|
|
85
85
|
@customElement("attribute-getter-test-class")
|
|
86
86
|
class AttributeGetterTestClass extends Component {
|
|
87
87
|
#value = "Mike";
|
|
88
|
-
@attributeGetter
|
|
88
|
+
@attributeGetter get value(): string {
|
|
89
89
|
return this.#value;
|
|
90
90
|
}
|
|
91
|
-
@attributeSetter
|
|
91
|
+
@attributeSetter set value(value: string) {
|
|
92
92
|
this.#value = value;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
#synced = "Mike";
|
|
96
|
-
@attributeGetter get synced(): string {
|
|
96
|
+
@attributeGetter({ reflect: false }) get synced(): string {
|
|
97
97
|
return this.#synced;
|
|
98
98
|
}
|
|
99
|
-
@attributeSetter set synced(value: string) {
|
|
99
|
+
@attributeSetter({ reflect: false }) set synced(value: string) {
|
|
100
100
|
this.#synced = value;
|
|
101
101
|
}
|
|
102
102
|
}
|
|
@@ -211,7 +211,7 @@ export function attribute<C extends Component, T extends string | number | boole
|
|
|
211
211
|
type: String,
|
|
212
212
|
property: context.name,
|
|
213
213
|
reactive: context.kind === "accessor",
|
|
214
|
-
reflect:
|
|
214
|
+
reflect: true,
|
|
215
215
|
name: toKebabCase(context.name),
|
|
216
216
|
},
|
|
217
217
|
...((valueOrOptions as AttributeOptions) ?? {}),
|