aptechka 0.47.12 → 0.48.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 CHANGED
@@ -1 +1 @@
1
- # Aptechka
1
+ # Инари
@@ -0,0 +1 @@
1
+ "use strict";var E=e=>{throw TypeError(e)};var b=(e,a,t)=>a.has(e)||E("Cannot "+t);var i=(e,a,t)=>(b(e,a,"read from private field"),t?t.call(e):a.get(e)),r=(e,a,t)=>a.has(e)?E("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(e):a.set(e,t),l=(e,a,t,s)=>(b(e,a,"write to private field"),s?s.call(e,t):a.set(e,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("../events-KVanG9sR.cjs");require("../index-Cqw2NKev.cjs");var d,n,o,c,u,h;class g extends HTMLElement{constructor(){super(...arguments);r(this,d,[]);r(this,n);r(this,o,null);r(this,c,()=>{this.isConnected&&(document.documentElement.addEventListener("radioChange",i(this,h)),i(this,d).forEach(t=>{t.addEventListener("click",i(this,u)),t.hasAttribute("data-checked")&&this.setValue(t.getAttribute("data-value"))}))});r(this,u,t=>{const m=t.currentTarget.getAttribute("data-value");m&&this.setValue(m)});r(this,h,t=>{const s=t.target;s!==this&&s.name===this.name&&this.setValue(t.detail)})}get value(){return i(this,n)}get name(){return this.getAttribute("name")}get currentButtonElement(){return i(this,o)}setValue(t){t&&t!==i(this,n)&&(l(this,n,t),i(this,d).forEach(s=>{s.getAttribute("data-value")===i(this,n)?(s.setAttribute("data-checked",""),l(this,o,s)):s.removeAttribute("data-checked")}),v.dispatchEvent(this,"radioChange",{detail:i(this,n),bubbles:!0}))}connectedCallback(){l(this,d,[...this.querySelectorAll("[data-radio-button]")]),document.readyState==="complete"?i(this,c).call(this):addEventListener("load",i(this,c))}disconnectedCallback(){i(this,d).forEach(t=>{t.removeEventListener("click",i(this,u))}),removeEventListener("load",i(this,c)),document.documentElement.removeEventListener("radioChange",i(this,h))}}d=new WeakMap,n=new WeakMap,o=new WeakMap,c=new WeakMap,u=new WeakMap,h=new WeakMap;customElements.get("e-radio")||customElements.define("e-radio",g);exports.RadioElement=g;
@@ -0,0 +1,19 @@
1
+ export interface RadioEvents {
2
+ radioChange: CustomEvent<string | undefined>;
3
+ }
4
+ export declare class RadioElement<T extends string = string> extends HTMLElement {
5
+ #private;
6
+ get value(): T | undefined;
7
+ get name(): string | null;
8
+ get currentButtonElement(): HTMLElement | null;
9
+ setValue(value: T | undefined): void;
10
+ protected connectedCallback(): void;
11
+ protected disconnectedCallback(): void;
12
+ }
13
+ declare global {
14
+ interface HTMLElementTagNameMap {
15
+ 'e-radio': RadioElement;
16
+ }
17
+ interface HTMLElementEventMap extends RadioEvents {
18
+ }
19
+ }
@@ -0,0 +1,67 @@
1
+ var E = (e) => {
2
+ throw TypeError(e);
3
+ };
4
+ var b = (e, a, t) => a.has(e) || E("Cannot " + t);
5
+ var i = (e, a, t) => (b(e, a, "read from private field"), t ? t.call(e) : a.get(e)), r = (e, a, t) => a.has(e) ? E("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(e) : a.set(e, t), l = (e, a, t, s) => (b(e, a, "write to private field"), s ? s.call(e, t) : a.set(e, t), t);
6
+ import { d as g } from "../events-CsVF98U6.js";
7
+ import "../index-euf5anj6.js";
8
+ var d, n, c, o, h, u;
9
+ class v extends HTMLElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ r(this, d, []);
13
+ r(this, n);
14
+ r(this, c, null);
15
+ r(this, o, () => {
16
+ this.isConnected && (document.documentElement.addEventListener(
17
+ "radioChange",
18
+ i(this, u)
19
+ ), i(this, d).forEach((t) => {
20
+ t.addEventListener("click", i(this, h)), t.hasAttribute("data-checked") && this.setValue(t.getAttribute("data-value"));
21
+ }));
22
+ });
23
+ r(this, h, (t) => {
24
+ const m = t.currentTarget.getAttribute("data-value");
25
+ m && this.setValue(m);
26
+ });
27
+ r(this, u, (t) => {
28
+ const s = t.target;
29
+ s !== this && s.name === this.name && this.setValue(t.detail);
30
+ });
31
+ }
32
+ get value() {
33
+ return i(this, n);
34
+ }
35
+ get name() {
36
+ return this.getAttribute("name");
37
+ }
38
+ get currentButtonElement() {
39
+ return i(this, c);
40
+ }
41
+ setValue(t) {
42
+ t && t !== i(this, n) && (l(this, n, t), i(this, d).forEach((s) => {
43
+ s.getAttribute("data-value") === i(this, n) ? (s.setAttribute("data-checked", ""), l(this, c, s)) : s.removeAttribute("data-checked");
44
+ }), g(this, "radioChange", {
45
+ detail: i(this, n),
46
+ bubbles: !0
47
+ }));
48
+ }
49
+ connectedCallback() {
50
+ l(this, d, [
51
+ ...this.querySelectorAll("[data-radio-button]")
52
+ ]), document.readyState === "complete" ? i(this, o).call(this) : addEventListener("load", i(this, o));
53
+ }
54
+ disconnectedCallback() {
55
+ i(this, d).forEach((t) => {
56
+ t.removeEventListener("click", i(this, h));
57
+ }), removeEventListener("load", i(this, o)), document.documentElement.removeEventListener(
58
+ "radioChange",
59
+ i(this, u)
60
+ );
61
+ }
62
+ }
63
+ d = new WeakMap(), n = new WeakMap(), c = new WeakMap(), o = new WeakMap(), h = new WeakMap(), u = new WeakMap();
64
+ customElements.get("e-radio") || customElements.define("e-radio", v);
65
+ export {
66
+ v as RadioElement
67
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.47.12",
3
+ "version": "0.48.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"
@@ -163,6 +163,11 @@
163
163
  "require": "./lib/popover/index.cjs",
164
164
  "default": "./lib/popover/index.js"
165
165
  },
166
+ "./radio": {
167
+ "types": "./lib/radio/index.d.ts",
168
+ "require": "./lib/radio/index.cjs",
169
+ "default": "./lib/radio/index.js"
170
+ },
166
171
  "./router": {
167
172
  "types": "./lib/router/index.d.ts",
168
173
  "require": "./lib/router/index.cjs",
@@ -331,6 +336,9 @@
331
336
  "popover": [
332
337
  "lib/popover/index.d.ts"
333
338
  ],
339
+ "radio": [
340
+ "lib/radio/index.d.ts"
341
+ ],
334
342
  "router": [
335
343
  "lib/router/index.d.ts"
336
344
  ],