aptechka 0.30.0 → 0.30.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/lib/slicer/index.cjs +3 -3
- package/lib/slicer/index.js +31 -34
- package/package.json +1 -1
package/lib/slicer/index.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";var T=i=>{throw TypeError(i)};var
|
|
1
|
+
"use strict";var T=i=>{throw TypeError(i)};var A=(i,t,s)=>t.has(i)||T("Cannot "+s);var e=(i,t,s)=>(A(i,t,"read from private field"),s?s.call(i):t.get(i)),l=(i,t,s)=>t.has(i)?T("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,s),r=(i,t,s,n)=>(A(i,t,"write to private field"),n?n.call(i,s):t.set(i,s),s),p=(i,t,s)=>(A(i,t,"access private method"),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("../media/index.cjs");var m,o;class M{constructor(t){l(this,m);l(this,o);r(this,m,t.index),r(this,o,document.createElement("span")),e(this,o).classList.add("letter"),t.clone?e(this,o).innerHTML=`
|
|
2
2
|
<span class="original">${t.text}</span>
|
|
3
3
|
<span class="clone" aria-hidden>${t.text}</span>
|
|
4
4
|
`:e(this,o).innerHTML=`
|
|
5
5
|
<span class="value">${t.text}</span>
|
|
6
|
-
`}get index(){return e(this,
|
|
6
|
+
`}get index(){return e(this,m)}get element(){return e(this,o)}}m=new WeakMap,o=new WeakMap;var y,c,a;class w{constructor(t){l(this,y);l(this,c);l(this,a);r(this,y,t.index),r(this,c,document.createElement("span")),r(this,a,[]),t.letters&&t.lettersAcc!==void 0?(r(this,a,t.text.split("").map((s,n)=>new M({index:t.lettersAcc+n,text:s,clone:t.clone}))),e(this,c).append(...e(this,a).map(s=>s.element))):t.clone?e(this,c).innerHTML=`
|
|
7
7
|
<span class="original">${t.text}</span>
|
|
8
8
|
<span class="clone" aria-hidden>${t.text}</span>
|
|
9
9
|
`:e(this,c).innerHTML=`
|
|
10
10
|
<span class="value">${t.text}</span>
|
|
11
|
-
`,e(this,c).classList.add("word")}get index(){return e(this,
|
|
11
|
+
`,e(this,c).classList.add("word")}get index(){return e(this,y)}get element(){return e(this,c)}get letters(){return e(this,a)}}y=new WeakMap,c=new WeakMap,a=new WeakMap;var u,h,g,x,d,L,E;class S extends HTMLElement{constructor(){super(...arguments);l(this,d);l(this,u,"");l(this,h,[]);l(this,g,[]);l(this,x,null)}get wordsArray(){return e(this,h)}get lettersArray(){return e(this,g)}get originalText(){return e(this,u)}connectedCallback(){var s;r(this,u,((s=this.textContent)==null?void 0:s.trim())||""),this.hasAttribute("media")?(r(this,x,new v.Media(this.getAttribute("media"))),e(this,x).subscribe(n=>{n.current?p(this,d,L).call(this):!n.current&&n.previous&&p(this,d,E).call(this)})):p(this,d,L).call(this)}disconnectedCallback(){var s;p(this,d,E).call(this),(s=e(this,x))==null||s.close()}}u=new WeakMap,h=new WeakMap,g=new WeakMap,x=new WeakMap,d=new WeakSet,L=function(){this.innerHTML="";let s=0;r(this,h,e(this,u).replace(/ +/g," ").split(" ").map((n,f)=>{const b=new w({index:f,text:n,letters:this.hasAttribute("letters"),lettersAcc:s,clone:this.hasAttribute("clone")});return s+=b.letters.length,e(this,g).push(...b.letters),b})),this.hasAttribute("index")&&(e(this,h).forEach(n=>{n.element.style.setProperty("--word-index",n.index.toString())}),e(this,g).forEach(n=>{n.element.style.setProperty("--letter-index",n.index.toString())})),e(this,h).forEach((n,f)=>{this.appendChild(n.element),f!==e(this,h).length-1&&n.element.insertAdjacentHTML("beforeend"," ")}),this.style.setProperty("--words-length",e(this,h).length.toString()),this.style.setProperty("--letters-length",e(this,g).length.toString())},E=function(){r(this,h,[]),this.textContent=e(this,u),this.style.removeProperty("--words-length"),this.style.removeProperty("--letters-length")};customElements.get("e-slicer")||customElements.define("e-slicer",S);exports.Letter=M;exports.SlicerElement=S;exports.Word=w;
|
package/lib/slicer/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
1
|
+
var T = (i) => {
|
|
2
2
|
throw TypeError(i);
|
|
3
3
|
};
|
|
4
|
-
var A = (i, t, s) => t.has(i) ||
|
|
5
|
-
var e = (i, t, s) => (A(i, t, "read from private field"), s ? s.call(i) : t.get(i)), l = (i, t, s) => t.has(i) ?
|
|
6
|
-
import { Media as
|
|
7
|
-
var
|
|
4
|
+
var A = (i, t, s) => t.has(i) || T("Cannot " + s);
|
|
5
|
+
var e = (i, t, s) => (A(i, t, "read from private field"), s ? s.call(i) : t.get(i)), l = (i, t, s) => t.has(i) ? T("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, s), r = (i, t, s, n) => (A(i, t, "write to private field"), n ? n.call(i, s) : t.set(i, s), s), p = (i, t, s) => (A(i, t, "access private method"), s);
|
|
6
|
+
import { Media as w } from "../media/index.js";
|
|
7
|
+
var m, o;
|
|
8
8
|
class M {
|
|
9
9
|
constructor(t) {
|
|
10
|
-
l(this,
|
|
10
|
+
l(this, m);
|
|
11
11
|
l(this, o);
|
|
12
|
-
r(this,
|
|
12
|
+
r(this, m, t.index), r(this, o, document.createElement("span")), e(this, o).classList.add("letter"), t.clone ? e(this, o).innerHTML = `
|
|
13
13
|
<span class="original">${t.text}</span>
|
|
14
14
|
<span class="clone" aria-hidden>${t.text}</span>
|
|
15
15
|
` : e(this, o).innerHTML = `
|
|
@@ -17,20 +17,20 @@ class M {
|
|
|
17
17
|
`;
|
|
18
18
|
}
|
|
19
19
|
get index() {
|
|
20
|
-
return e(this,
|
|
20
|
+
return e(this, m);
|
|
21
21
|
}
|
|
22
22
|
get element() {
|
|
23
23
|
return e(this, o);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
var
|
|
26
|
+
m = new WeakMap(), o = new WeakMap();
|
|
27
|
+
var f, c, a;
|
|
28
28
|
class H {
|
|
29
29
|
constructor(t) {
|
|
30
|
-
l(this,
|
|
30
|
+
l(this, f);
|
|
31
31
|
l(this, c);
|
|
32
32
|
l(this, a);
|
|
33
|
-
r(this,
|
|
33
|
+
r(this, f, t.index), r(this, c, document.createElement("span")), r(this, a, []), t.letters && t.lettersAcc !== void 0 ? (r(this, a, t.text.split("").map((s, n) => new M({
|
|
34
34
|
index: t.lettersAcc + n,
|
|
35
35
|
text: s,
|
|
36
36
|
clone: t.clone
|
|
@@ -42,7 +42,7 @@ class H {
|
|
|
42
42
|
`, e(this, c).classList.add("word");
|
|
43
43
|
}
|
|
44
44
|
get index() {
|
|
45
|
-
return e(this,
|
|
45
|
+
return e(this, f);
|
|
46
46
|
}
|
|
47
47
|
get element() {
|
|
48
48
|
return e(this, c);
|
|
@@ -51,63 +51,60 @@ class H {
|
|
|
51
51
|
return e(this, a);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
|
|
55
|
-
var u, h,
|
|
54
|
+
f = new WeakMap(), c = new WeakMap(), a = new WeakMap();
|
|
55
|
+
var u, h, g, x, d, L, E;
|
|
56
56
|
class v extends HTMLElement {
|
|
57
57
|
constructor() {
|
|
58
58
|
super(...arguments);
|
|
59
59
|
l(this, d);
|
|
60
60
|
l(this, u, "");
|
|
61
61
|
l(this, h, []);
|
|
62
|
-
l(this,
|
|
62
|
+
l(this, g, []);
|
|
63
63
|
l(this, x, null);
|
|
64
64
|
}
|
|
65
65
|
get wordsArray() {
|
|
66
66
|
return e(this, h);
|
|
67
67
|
}
|
|
68
68
|
get lettersArray() {
|
|
69
|
-
return e(this,
|
|
69
|
+
return e(this, g);
|
|
70
70
|
}
|
|
71
71
|
get originalText() {
|
|
72
72
|
return e(this, u);
|
|
73
73
|
}
|
|
74
74
|
connectedCallback() {
|
|
75
75
|
var s;
|
|
76
|
-
r(this, u, ((s = this.textContent) == null ? void 0 : s.trim()) || ""), this.hasAttribute("media") ? (r(this, x, new
|
|
77
|
-
n.current ?
|
|
78
|
-
})) :
|
|
76
|
+
r(this, u, ((s = this.textContent) == null ? void 0 : s.trim()) || ""), this.hasAttribute("media") ? (r(this, x, new w(this.getAttribute("media"))), e(this, x).subscribe((n) => {
|
|
77
|
+
n.current ? p(this, d, L).call(this) : !n.current && n.previous && p(this, d, E).call(this);
|
|
78
|
+
})) : p(this, d, L).call(this);
|
|
79
79
|
}
|
|
80
80
|
disconnectedCallback() {
|
|
81
81
|
var s;
|
|
82
|
-
|
|
82
|
+
p(this, d, E).call(this), (s = e(this, x)) == null || s.close();
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
u = new WeakMap(), h = new WeakMap(),
|
|
85
|
+
u = new WeakMap(), h = new WeakMap(), g = new WeakMap(), x = new WeakMap(), d = new WeakSet(), L = function() {
|
|
86
86
|
this.innerHTML = "";
|
|
87
87
|
let s = 0;
|
|
88
|
-
r(this, h, e(this, u).replace(/ +/g, " ").split(" ").map((n,
|
|
89
|
-
const
|
|
90
|
-
index:
|
|
88
|
+
r(this, h, e(this, u).replace(/ +/g, " ").split(" ").map((n, y) => {
|
|
89
|
+
const b = new H({
|
|
90
|
+
index: y,
|
|
91
91
|
text: n,
|
|
92
92
|
letters: this.hasAttribute("letters"),
|
|
93
93
|
lettersAcc: s,
|
|
94
94
|
clone: this.hasAttribute("clone")
|
|
95
95
|
});
|
|
96
|
-
return s +=
|
|
96
|
+
return s += b.letters.length, e(this, g).push(...b.letters), b;
|
|
97
97
|
})), this.hasAttribute("index") && (e(this, h).forEach((n) => {
|
|
98
98
|
n.element.style.setProperty("--word-index", n.index.toString());
|
|
99
|
-
}), e(this,
|
|
99
|
+
}), e(this, g).forEach((n) => {
|
|
100
100
|
n.element.style.setProperty(
|
|
101
101
|
"--letter-index",
|
|
102
102
|
n.index.toString()
|
|
103
103
|
);
|
|
104
|
-
})), e(this, h).forEach((n,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
109
|
-
}), this.style.setProperty("--words-length", e(this, h).length.toString()), this.style.setProperty("--letters-length", e(this, p).length.toString());
|
|
110
|
-
}, L = function() {
|
|
104
|
+
})), e(this, h).forEach((n, y) => {
|
|
105
|
+
this.appendChild(n.element), y !== e(this, h).length - 1 && n.element.insertAdjacentHTML("beforeend", " ");
|
|
106
|
+
}), this.style.setProperty("--words-length", e(this, h).length.toString()), this.style.setProperty("--letters-length", e(this, g).length.toString());
|
|
107
|
+
}, E = function() {
|
|
111
108
|
r(this, h, []), this.textContent = e(this, u), this.style.removeProperty("--words-length"), this.style.removeProperty("--letters-length");
|
|
112
109
|
};
|
|
113
110
|
customElements.get("e-slicer") || customElements.define("e-slicer", v);
|