aptechka 0.50.2 → 0.50.3
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/lib/radio/index.cjs +1 -1
- package/lib/radio/index.d.ts +2 -0
- package/lib/radio/index.js +40 -33
- package/package.json +1 -1
package/lib/radio/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var E=
|
|
1
|
+
"use strict";var E=i=>{throw TypeError(i)};var v=(i,n,t)=>n.has(i)||E("Cannot "+t);var e=(i,n,t)=>(v(i,n,"read from private field"),t?t.call(i):n.get(i)),d=(i,n,t)=>n.has(i)?E("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(i):n.set(i,t),h=(i,n,t,s)=>(v(i,n,"write to private field"),s?s.call(i,t):n.set(i,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../events-KVanG9sR.cjs");require("../index-Cqw2NKev.cjs");var a,r,l,u,o,m;class b extends HTMLElement{constructor(){super(...arguments);d(this,a,[]);d(this,r);d(this,l,null);d(this,u,()=>{this.isConnected&&(document.documentElement.addEventListener("radioChange",e(this,m)),e(this,a).forEach(t=>{t.addEventListener("click",e(this,o)),t.hasAttribute("data-checked")&&this.setValue(t.getAttribute("data-value"))}))});d(this,o,t=>{const c=t.currentTarget.getAttribute("data-value");c&&this.setValue(c)});d(this,m,t=>{const s=t.target;s!==this&&s.name===this.name&&this.setValue(t.detail)})}get value(){return e(this,r)}get name(){return this.getAttribute("name")}get currentButtonElement(){return e(this,l)}addButton(t){e(this,a).push(t),t.addEventListener("click",e(this,o))}removeButton(t){const s=e(this,a).find(c=>c===t);s&&(s.removeEventListener("click",e(this,o)),h(this,a,e(this,a).filter(c=>c!==t)))}setValue(t){t&&t!==e(this,r)&&(h(this,r,t),e(this,a).forEach(s=>{s.getAttribute("data-value")===e(this,r)?(s.setAttribute("data-checked",""),h(this,l,s)):s.removeAttribute("data-checked")}),f.dispatchEvent(this,"radioChange",{detail:e(this,r),bubbles:!0}))}connectedCallback(){h(this,a,[...this.querySelectorAll("[data-radio-button]")]),document.readyState==="complete"?e(this,u).call(this):addEventListener("load",e(this,u))}disconnectedCallback(){e(this,a).forEach(t=>{t.removeEventListener("click",e(this,o))}),removeEventListener("load",e(this,u)),document.documentElement.removeEventListener("radioChange",e(this,m))}}a=new WeakMap,r=new WeakMap,l=new WeakMap,u=new WeakMap,o=new WeakMap,m=new WeakMap;customElements.get("e-radio")||customElements.define("e-radio",b);exports.RadioElement=b;
|
package/lib/radio/index.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ export declare class RadioElement<T extends string = string> extends HTMLElement
|
|
|
6
6
|
get value(): T | undefined;
|
|
7
7
|
get name(): string | null;
|
|
8
8
|
get currentButtonElement(): HTMLElement | null;
|
|
9
|
+
addButton(element: HTMLElement): void;
|
|
10
|
+
removeButton(element: HTMLElement): void;
|
|
9
11
|
setValue(value: T | undefined): void;
|
|
10
12
|
protected connectedCallback(): void;
|
|
11
13
|
protected disconnectedCallback(): void;
|
package/lib/radio/index.js
CHANGED
|
@@ -1,67 +1,74 @@
|
|
|
1
|
-
var E = (
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var E = (i) => {
|
|
2
|
+
throw TypeError(i);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
import { d as
|
|
4
|
+
var v = (i, a, t) => a.has(i) || E("Cannot " + t);
|
|
5
|
+
var e = (i, a, t) => (v(i, a, "read from private field"), t ? t.call(i) : a.get(i)), d = (i, a, t) => a.has(i) ? E("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(i) : a.set(i, t), u = (i, a, t, s) => (v(i, a, "write to private field"), s ? s.call(i, t) : a.set(i, t), t);
|
|
6
|
+
import { d as f } from "../events-CsVF98U6.js";
|
|
7
7
|
import "../index-euf5anj6.js";
|
|
8
|
-
var
|
|
9
|
-
class
|
|
8
|
+
var n, r, l, h, o, m;
|
|
9
|
+
class b extends HTMLElement {
|
|
10
10
|
constructor() {
|
|
11
11
|
super(...arguments);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
d(this, n, []);
|
|
13
|
+
d(this, r);
|
|
14
|
+
d(this, l, null);
|
|
15
|
+
d(this, h, () => {
|
|
16
16
|
this.isConnected && (document.documentElement.addEventListener(
|
|
17
17
|
"radioChange",
|
|
18
|
-
|
|
19
|
-
),
|
|
20
|
-
t.addEventListener("click",
|
|
18
|
+
e(this, m)
|
|
19
|
+
), e(this, n).forEach((t) => {
|
|
20
|
+
t.addEventListener("click", e(this, o)), t.hasAttribute("data-checked") && this.setValue(t.getAttribute("data-value"));
|
|
21
21
|
}));
|
|
22
22
|
});
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
23
|
+
d(this, o, (t) => {
|
|
24
|
+
const c = t.currentTarget.getAttribute("data-value");
|
|
25
|
+
c && this.setValue(c);
|
|
26
26
|
});
|
|
27
|
-
|
|
27
|
+
d(this, m, (t) => {
|
|
28
28
|
const s = t.target;
|
|
29
29
|
s !== this && s.name === this.name && this.setValue(t.detail);
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
get value() {
|
|
33
|
-
return
|
|
33
|
+
return e(this, r);
|
|
34
34
|
}
|
|
35
35
|
get name() {
|
|
36
36
|
return this.getAttribute("name");
|
|
37
37
|
}
|
|
38
38
|
get currentButtonElement() {
|
|
39
|
-
return
|
|
39
|
+
return e(this, l);
|
|
40
|
+
}
|
|
41
|
+
addButton(t) {
|
|
42
|
+
e(this, n).push(t), t.addEventListener("click", e(this, o));
|
|
43
|
+
}
|
|
44
|
+
removeButton(t) {
|
|
45
|
+
const s = e(this, n).find((c) => c === t);
|
|
46
|
+
s && (s.removeEventListener("click", e(this, o)), u(this, n, e(this, n).filter((c) => c !== t)));
|
|
40
47
|
}
|
|
41
48
|
setValue(t) {
|
|
42
|
-
t && t !==
|
|
43
|
-
s.getAttribute("data-value") ===
|
|
44
|
-
}),
|
|
45
|
-
detail:
|
|
49
|
+
t && t !== e(this, r) && (u(this, r, t), e(this, n).forEach((s) => {
|
|
50
|
+
s.getAttribute("data-value") === e(this, r) ? (s.setAttribute("data-checked", ""), u(this, l, s)) : s.removeAttribute("data-checked");
|
|
51
|
+
}), f(this, "radioChange", {
|
|
52
|
+
detail: e(this, r),
|
|
46
53
|
bubbles: !0
|
|
47
54
|
}));
|
|
48
55
|
}
|
|
49
56
|
connectedCallback() {
|
|
50
|
-
|
|
57
|
+
u(this, n, [
|
|
51
58
|
...this.querySelectorAll("[data-radio-button]")
|
|
52
|
-
]), document.readyState === "complete" ?
|
|
59
|
+
]), document.readyState === "complete" ? e(this, h).call(this) : addEventListener("load", e(this, h));
|
|
53
60
|
}
|
|
54
61
|
disconnectedCallback() {
|
|
55
|
-
|
|
56
|
-
t.removeEventListener("click",
|
|
57
|
-
}), removeEventListener("load",
|
|
62
|
+
e(this, n).forEach((t) => {
|
|
63
|
+
t.removeEventListener("click", e(this, o));
|
|
64
|
+
}), removeEventListener("load", e(this, h)), document.documentElement.removeEventListener(
|
|
58
65
|
"radioChange",
|
|
59
|
-
|
|
66
|
+
e(this, m)
|
|
60
67
|
);
|
|
61
68
|
}
|
|
62
69
|
}
|
|
63
|
-
|
|
64
|
-
customElements.get("e-radio") || customElements.define("e-radio",
|
|
70
|
+
n = new WeakMap(), r = new WeakMap(), l = new WeakMap(), h = new WeakMap(), o = new WeakMap(), m = new WeakMap();
|
|
71
|
+
customElements.get("e-radio") || customElements.define("e-radio", b);
|
|
65
72
|
export {
|
|
66
|
-
|
|
73
|
+
b as RadioElement
|
|
67
74
|
};
|