aptechka 0.54.5 → 0.54.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/lib/loading/index.cjs +1 -1
- package/lib/loading/index.js +30 -31
- package/package.json +1 -1
package/lib/loading/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var m=i=>{throw TypeError(i)};var v=(i,t,s)=>t.has(i)||m("Cannot "+s);var e=(i,t,s)=>(v(i,t,"read from private field"),s?s.call(i):t.get(i)),r=(i,t,s)=>t.has(i)?m("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(i):t.set(i,s),n=(i,t,s,d)=>(v(i,t,"write to private field"),d?d.call(i,s):t.set(i,s),s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("../events-KVanG9sR.cjs"),E=require("../function-MthRj-GJ.cjs");require("../index-Cqw2NKev.cjs");var o,a,h,l,u,c,p;class S{constructor(){r(this,o,new Map);r(this,a,!1);r(this,h,0);r(this,l,0);r(this,u,E.debounce(()=>{e(this,a)||(n(this,a,!0),g.dispatchEvent(document,"loadingStart"),e(this,c).call(this))},0));r(this,c,t=>{if(!e(this,a))return;const s=e(this,o).size,d=Array.from(e(this,o)).filter(b=>b[1]).length,f=d/s;n(this,h,d),n(this,l,f),g.dispatchEvent(document,"loadingProgress",{detail:{total:s,loaded:d,progress:f,resourceName:t}}),f===1&&e(this,p).call(this)});r(this,p,E.debounce(()=>{n(this,a,!1),g.dispatchEvent(document,"loadingComplete",{detail:{total:e(this,o).size}}),n(this,h,0),n(this,l,0),e(this,o).clear()},0))}get total(){return e(this,o).size}get loaded(){return e(this,h)}get progress(){return e(this,l)}get map(){return e(this,o)}add(t){e(this,o).set(t,!1),e(this,u).call(this)}complete(t){e(this,o).set(t,!0),e(this,c).call(this,t)}error(t){e(this,o).has(t)&&(console.error(`Failed to load ${t}`),e(this,o).delete(t),g.dispatchEvent(document,"loadingError",{detail:{name:t}})),e(this,c).call(this)}}o=new WeakMap,a=new WeakMap,h=new WeakMap,l=new WeakMap,u=new WeakMap,c=new WeakMap,p=new WeakMap;const q=new S;exports.loading=q;
|
package/lib/loading/index.js
CHANGED
|
@@ -1,71 +1,70 @@
|
|
|
1
|
-
var
|
|
1
|
+
var u = (i) => {
|
|
2
2
|
throw TypeError(i);
|
|
3
3
|
};
|
|
4
|
-
var z = (i, t, e) => t.has(i) ||
|
|
5
|
-
var s = (i, t, e) => (z(i, t, "read from private field"), e ? e.call(i) : t.get(i)), r = (i, t, e) => t.has(i) ?
|
|
6
|
-
import { d as
|
|
7
|
-
import { d as
|
|
4
|
+
var z = (i, t, e) => t.has(i) || u("Cannot " + e);
|
|
5
|
+
var s = (i, t, e) => (z(i, t, "read from private field"), e ? e.call(i) : t.get(i)), r = (i, t, e) => t.has(i) ? u("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, e), a = (i, t, e, h) => (z(i, t, "write to private field"), h ? h.call(i, e) : t.set(i, e), e);
|
|
6
|
+
import { d as p } from "../events-CsVF98U6.js";
|
|
7
|
+
import { d as w } from "../function-C10DGppn.js";
|
|
8
8
|
import "../index-euf5anj6.js";
|
|
9
|
-
var o,
|
|
10
|
-
class
|
|
9
|
+
var o, d, l, n, c, g, m;
|
|
10
|
+
class S {
|
|
11
11
|
constructor() {
|
|
12
12
|
r(this, o, /* @__PURE__ */ new Map());
|
|
13
|
-
r(this,
|
|
13
|
+
r(this, d, !1);
|
|
14
14
|
r(this, l, 0);
|
|
15
15
|
r(this, n, 0);
|
|
16
|
-
r(this,
|
|
17
|
-
|
|
18
|
-
s(this, h) || (a(this, h, !0), c(document, "loadingStart"), s(this, p).call(this));
|
|
16
|
+
r(this, c, w(() => {
|
|
17
|
+
s(this, d) || (a(this, d, !0), p(document, "loadingStart"), s(this, g).call(this));
|
|
19
18
|
}, 0));
|
|
20
|
-
r(this,
|
|
21
|
-
if (!s(this,
|
|
19
|
+
r(this, g, (t) => {
|
|
20
|
+
if (!s(this, d))
|
|
22
21
|
return;
|
|
23
|
-
const e = s(this, o).size,
|
|
24
|
-
a(this, l,
|
|
22
|
+
const e = s(this, o).size, h = Array.from(s(this, o)).filter((E) => E[1]).length, f = h / e;
|
|
23
|
+
a(this, l, h), a(this, n, f), p(document, "loadingProgress", {
|
|
25
24
|
detail: {
|
|
26
25
|
total: e,
|
|
27
|
-
loaded:
|
|
28
|
-
progress:
|
|
26
|
+
loaded: h,
|
|
27
|
+
progress: f,
|
|
29
28
|
resourceName: t
|
|
30
29
|
}
|
|
31
|
-
}),
|
|
30
|
+
}), f === 1 && s(this, m).call(this);
|
|
32
31
|
});
|
|
33
|
-
r(this,
|
|
34
|
-
a(this,
|
|
32
|
+
r(this, m, w(() => {
|
|
33
|
+
a(this, d, !1), p(document, "loadingComplete", {
|
|
35
34
|
detail: {
|
|
36
35
|
total: s(this, o).size
|
|
37
36
|
}
|
|
38
|
-
}), a(this, l, 0), a(this, n, 0),
|
|
37
|
+
}), a(this, l, 0), a(this, n, 0), s(this, o).clear();
|
|
39
38
|
}, 0));
|
|
40
39
|
}
|
|
41
40
|
get total() {
|
|
42
|
-
return s(this,
|
|
41
|
+
return s(this, o).size;
|
|
43
42
|
}
|
|
44
43
|
get loaded() {
|
|
45
|
-
return s(this,
|
|
44
|
+
return s(this, l);
|
|
46
45
|
}
|
|
47
46
|
get progress() {
|
|
48
|
-
return s(this,
|
|
47
|
+
return s(this, n);
|
|
49
48
|
}
|
|
50
49
|
get map() {
|
|
51
50
|
return s(this, o);
|
|
52
51
|
}
|
|
53
52
|
add(t) {
|
|
54
|
-
s(this, o).set(t, !1), s(this,
|
|
53
|
+
s(this, o).set(t, !1), s(this, c).call(this);
|
|
55
54
|
}
|
|
56
55
|
complete(t) {
|
|
57
|
-
s(this, o).set(t, !0), s(this,
|
|
56
|
+
s(this, o).set(t, !0), s(this, g).call(this, t);
|
|
58
57
|
}
|
|
59
58
|
error(t) {
|
|
60
|
-
s(this, o).has(t) && (console.error(`Failed to load ${t}`), s(this, o).delete(t),
|
|
59
|
+
s(this, o).has(t) && (console.error(`Failed to load ${t}`), s(this, o).delete(t), p(document, "loadingError", {
|
|
61
60
|
detail: {
|
|
62
61
|
name: t
|
|
63
62
|
}
|
|
64
|
-
})), s(this,
|
|
63
|
+
})), s(this, g).call(this);
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
|
-
o = new WeakMap(),
|
|
68
|
-
const
|
|
66
|
+
o = new WeakMap(), d = new WeakMap(), l = new WeakMap(), n = new WeakMap(), c = new WeakMap(), g = new WeakMap(), m = new WeakMap();
|
|
67
|
+
const y = new S();
|
|
69
68
|
export {
|
|
70
|
-
|
|
69
|
+
y as loading
|
|
71
70
|
};
|