aptechka 0.5.38 → 0.5.39
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/source/SourceElement.d.ts +2 -0
- package/lib/source/index.cjs +2 -2
- package/lib/source/index.js +32 -29
- package/lib/video/index.cjs +1 -1
- package/lib/video/index.js +25 -19
- package/package.json +1 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ClassLinkedStatus } from '../class-linked-status';
|
|
2
|
+
import { SourceManager } from './SourceManager';
|
|
2
3
|
import { CustomElement } from '../custom-element';
|
|
3
4
|
|
|
4
5
|
export declare abstract class SourceElement<T extends HTMLElement> extends CustomElement {
|
|
5
6
|
#private;
|
|
6
7
|
constructor();
|
|
7
8
|
get consumerElement(): T;
|
|
9
|
+
get sourceManager(): SourceManager;
|
|
8
10
|
get status(): ClassLinkedStatus<{
|
|
9
11
|
loading: false;
|
|
10
12
|
loaded: false;
|
package/lib/source/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var C=(i,r,t)=>{if(!r.has(i))throw TypeError("Cannot "+t)};var e=(i,r,t)=>(C(i,r,"read from private field"),t?t.call(i):r.get(i)),a=(i,r,t)=>{if(r.has(i))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(i):r.set(i,t)},u=(i,r,t,o)=>(C(i,r,"write to private field"),o?o.call(i,t):r.set(i,t),t);var p=(i,r,t)=>(C(i,r,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("../SourceManager-vSlsMKUE.cjs"),M=require("../custom-element/index.cjs"),w=require("../loading/index.cjs"),k=require("../class-linked-status/index.cjs"),x=require("../browser-CpzFX2xg.cjs");let A=0;var h,s,c,f,l,d,n,m,g,v,E,b,L;class q extends M.CustomElement{constructor(){super();a(this,g);a(this,h,null);a(this,s,null);a(this,c,!1);a(this,f,!1);a(this,l,!1);a(this,d,"");a(this,n,new k.ClassLinkedStatus(this,{loading:!1,loaded:!1,error:!1}));a(this,m,null);a(this,E,t=>{const o=t[0];e(this,l)&&(!e(this,f)||this.hasAttribute("reload-source"))&&o.isIntersecting&&(e(this,h).current&&e(this,h).current!==e(this,h).previous&&p(this,g,v).call(this,e(this,h).current),u(this,f,!0)),o.isIntersecting?this.dispatchEvent(new CustomEvent("sourceCapture")):(this.hasAttribute("reload-source")&&p(this,g,v).call(this,void 0),this.dispatchEvent(new CustomEvent("sourceRelease")))});a(this,b,()=>{e(this,n).set("loaded",!0),e(this,n).set("error",!1),e(this,n).set("loading",!1),!e(this,l)&&!e(this,c)&&w.loading.setLoaded(e(this,d),1),u(this,c,!0)});a(this,L,t=>{e(this,n).set("loaded",!1),e(this,n).set("error",!0),e(this,n).set("loading",!1),!e(this,l)&&!e(this,c)&&w.loading.setError(e(this,d),t),u(this,c,!0)});x.isBrowser&&(u(this,d,`source-consumer-${++A}`),u(this,m,new IntersectionObserver(e(this,E))))}get consumerElement(){return e(this,s)}get sourceManager(){return e(this,h)}get status(){return e(this,n)}get isLazy(){return e(this,l)}connectedCallback(){const t=this.getAttribute("srcset");t&&(u(this,s,this.createConsumer()),e(this,s).style.cssText=`
|
|
2
2
|
display: block;
|
|
3
3
|
width: 100%;
|
|
4
4
|
height: 100%;
|
|
5
|
-
`,e(this,s).classList.add("source-consumer"),Array.from(this.attributes).forEach(
|
|
5
|
+
`,e(this,s).classList.add("source-consumer"),Array.from(this.attributes).forEach(o=>{if(o.name!=="srcset"){const S=o.nodeValue||"";o.name in e(this,s)&&(e(this,s)[o.name]=S||!0)}}),this.appendChild(e(this,s)),u(this,h,new y.SourceManager({srcset:t})),u(this,l,this.hasAttribute("lazy")),e(this,h).subscribe(o=>{(!e(this,l)||e(this,l)&&e(this,f))&&p(this,g,v).call(this,o.current)}),e(this,m).observe(this),e(this,h).connect())}disconnectedCallback(){e(this,m).disconnect(),e(this,h).close(),e(this,s).onloadeddata=null,e(this,s).onload=null,e(this,s).onerror=null,e(this,s).remove(),e(this,n).reset()}}h=new WeakMap,s=new WeakMap,c=new WeakMap,f=new WeakMap,l=new WeakMap,d=new WeakMap,n=new WeakMap,m=new WeakMap,g=new WeakSet,v=function(t){if(e(this,s).onloadeddata=null,e(this,s).onload=null,e(this,s).onerror=null,e(this,n).set("loaded",!1),e(this,n).set("error",!1),e(this,n).set("loading",!1),t){const o=this.hasAttribute("keep-source-parameters");e(this,n).set("loading",!0);const S=o?t.url:t.name+t.extension;this.consumeSource(S),!e(this,l)&&!e(this,c)&&w.loading.setTotal(e(this,d),1),e(this,s).onloadeddata=()=>{e(this,b).call(this)},e(this,s).onload=()=>{e(this,b).call(this)},e(this,s).onerror=()=>{e(this,L).call(this,S)}}else this.consumeSource(null)},E=new WeakMap,b=new WeakMap,L=new WeakMap;exports.Source=y.Source;exports.SourceManager=y.SourceManager;exports.SourceSet=y.SourceSet;exports.SourceElement=q;
|
package/lib/source/index.js
CHANGED
|
@@ -1,54 +1,57 @@
|
|
|
1
|
-
var
|
|
1
|
+
var L = (i, r, s) => {
|
|
2
2
|
if (!r.has(i))
|
|
3
3
|
throw TypeError("Cannot " + s);
|
|
4
4
|
};
|
|
5
|
-
var t = (i, r, s) => (
|
|
5
|
+
var t = (i, r, s) => (L(i, r, "read from private field"), s ? s.call(i) : r.get(i)), h = (i, r, s) => {
|
|
6
6
|
if (r.has(i))
|
|
7
7
|
throw TypeError("Cannot add the same private member more than once");
|
|
8
8
|
r instanceof WeakSet ? r.add(i) : r.set(i, s);
|
|
9
|
-
}, u = (i, r, s, n) => (
|
|
10
|
-
var
|
|
9
|
+
}, u = (i, r, s, n) => (L(i, r, "write to private field"), n ? n.call(i, s) : r.set(i, s), s);
|
|
10
|
+
var v = (i, r, s) => (L(i, r, "access private method"), s);
|
|
11
11
|
import { S as y } from "../SourceManager-Q-PB-Rkh.js";
|
|
12
12
|
import { a as R, b as V } from "../SourceManager-Q-PB-Rkh.js";
|
|
13
|
-
import { CustomElement as
|
|
14
|
-
import { loading as
|
|
15
|
-
import { ClassLinkedStatus as
|
|
16
|
-
import { i as
|
|
13
|
+
import { CustomElement as A } from "../custom-element/index.js";
|
|
14
|
+
import { loading as w } from "../loading/index.js";
|
|
15
|
+
import { ClassLinkedStatus as k } from "../class-linked-status/index.js";
|
|
16
|
+
import { i as x } from "../browser-0zX67oeU.js";
|
|
17
17
|
let z = 0;
|
|
18
|
-
var a, e, c, f, l, d, o, m,
|
|
19
|
-
class F extends
|
|
18
|
+
var a, e, c, f, l, d, o, m, p, S, E, b, C;
|
|
19
|
+
class F extends A {
|
|
20
20
|
constructor() {
|
|
21
21
|
super();
|
|
22
|
-
h(this,
|
|
22
|
+
h(this, p);
|
|
23
23
|
h(this, a, null);
|
|
24
24
|
h(this, e, null);
|
|
25
25
|
h(this, c, !1);
|
|
26
26
|
h(this, f, !1);
|
|
27
27
|
h(this, l, !1);
|
|
28
28
|
h(this, d, "");
|
|
29
|
-
h(this, o, new
|
|
29
|
+
h(this, o, new k(this, {
|
|
30
30
|
loading: !1,
|
|
31
31
|
loaded: !1,
|
|
32
32
|
error: !1
|
|
33
33
|
}));
|
|
34
34
|
h(this, m, null);
|
|
35
|
-
h(this,
|
|
35
|
+
h(this, E, (s) => {
|
|
36
36
|
const n = s[0];
|
|
37
|
-
t(this, l) && !t(this, f) && n.isIntersecting && (t(this, a).current && t(this, a).current !== t(this, a).previous &&
|
|
37
|
+
t(this, l) && (!t(this, f) || this.hasAttribute("reload-source")) && n.isIntersecting && (t(this, a).current && t(this, a).current !== t(this, a).previous && v(this, p, S).call(this, t(this, a).current), u(this, f, !0)), n.isIntersecting ? this.dispatchEvent(new CustomEvent("sourceCapture")) : (this.hasAttribute("reload-source") && v(this, p, S).call(this, void 0), this.dispatchEvent(new CustomEvent("sourceRelease")));
|
|
38
38
|
});
|
|
39
39
|
h(this, b, () => {
|
|
40
|
-
t(this, o).set("loaded", !0), t(this, o).set("error", !1), t(this, o).set("loading", !1), !t(this, l) && !t(this, c) &&
|
|
40
|
+
t(this, o).set("loaded", !0), t(this, o).set("error", !1), t(this, o).set("loading", !1), !t(this, l) && !t(this, c) && w.setLoaded(t(this, d), 1), u(this, c, !0);
|
|
41
41
|
});
|
|
42
|
-
h(this,
|
|
43
|
-
t(this, o).set("loaded", !1), t(this, o).set("error", !0), t(this, o).set("loading", !1), !t(this, l) && !t(this, c) &&
|
|
42
|
+
h(this, C, (s) => {
|
|
43
|
+
t(this, o).set("loaded", !1), t(this, o).set("error", !0), t(this, o).set("loading", !1), !t(this, l) && !t(this, c) && w.setError(t(this, d), s), u(this, c, !0);
|
|
44
44
|
});
|
|
45
|
-
|
|
46
|
-
t(this,
|
|
45
|
+
x && (u(this, d, `source-consumer-${++z}`), u(this, m, new IntersectionObserver(
|
|
46
|
+
t(this, E)
|
|
47
47
|
)));
|
|
48
48
|
}
|
|
49
49
|
get consumerElement() {
|
|
50
50
|
return t(this, e);
|
|
51
51
|
}
|
|
52
|
+
get sourceManager() {
|
|
53
|
+
return t(this, a);
|
|
54
|
+
}
|
|
52
55
|
get status() {
|
|
53
56
|
return t(this, o);
|
|
54
57
|
}
|
|
@@ -63,34 +66,34 @@ class F extends k {
|
|
|
63
66
|
height: 100%;
|
|
64
67
|
`, t(this, e).classList.add("source-consumer"), Array.from(this.attributes).forEach((n) => {
|
|
65
68
|
if (n.name !== "srcset") {
|
|
66
|
-
const
|
|
67
|
-
n.name in t(this, e) && (t(this, e)[n.name] =
|
|
69
|
+
const g = n.nodeValue || "";
|
|
70
|
+
n.name in t(this, e) && (t(this, e)[n.name] = g || !0);
|
|
68
71
|
}
|
|
69
72
|
}), this.appendChild(t(this, e)), u(this, a, new y({
|
|
70
73
|
srcset: s
|
|
71
74
|
})), u(this, l, this.hasAttribute("lazy")), t(this, a).subscribe((n) => {
|
|
72
|
-
(!t(this, l) || t(this, l) && t(this, f)) &&
|
|
75
|
+
(!t(this, l) || t(this, l) && t(this, f)) && v(this, p, S).call(this, n.current);
|
|
73
76
|
}), t(this, m).observe(this), t(this, a).connect());
|
|
74
77
|
}
|
|
75
78
|
disconnectedCallback() {
|
|
76
79
|
t(this, m).disconnect(), t(this, a).close(), t(this, e).onloadeddata = null, t(this, e).onload = null, t(this, e).onerror = null, t(this, e).remove(), t(this, o).reset();
|
|
77
80
|
}
|
|
78
81
|
}
|
|
79
|
-
a = new WeakMap(), e = new WeakMap(), c = new WeakMap(), f = new WeakMap(), l = new WeakMap(), d = new WeakMap(), o = new WeakMap(), m = new WeakMap(),
|
|
80
|
-
if (t(this, e).onloadeddata = null, t(this, e).onload = null, t(this, e).onerror = null, s) {
|
|
82
|
+
a = new WeakMap(), e = new WeakMap(), c = new WeakMap(), f = new WeakMap(), l = new WeakMap(), d = new WeakMap(), o = new WeakMap(), m = new WeakMap(), p = new WeakSet(), S = function(s) {
|
|
83
|
+
if (t(this, e).onloadeddata = null, t(this, e).onload = null, t(this, e).onerror = null, t(this, o).set("loaded", !1), t(this, o).set("error", !1), t(this, o).set("loading", !1), s) {
|
|
81
84
|
const n = this.hasAttribute("keep-source-parameters");
|
|
82
|
-
t(this, o).set("
|
|
83
|
-
const
|
|
84
|
-
this.consumeSource(
|
|
85
|
+
t(this, o).set("loading", !0);
|
|
86
|
+
const g = n ? s.url : s.name + s.extension;
|
|
87
|
+
this.consumeSource(g), !t(this, l) && !t(this, c) && w.setTotal(t(this, d), 1), t(this, e).onloadeddata = () => {
|
|
85
88
|
t(this, b).call(this);
|
|
86
89
|
}, t(this, e).onload = () => {
|
|
87
90
|
t(this, b).call(this);
|
|
88
91
|
}, t(this, e).onerror = () => {
|
|
89
|
-
t(this,
|
|
92
|
+
t(this, C).call(this, g);
|
|
90
93
|
};
|
|
91
94
|
} else
|
|
92
95
|
this.consumeSource(null);
|
|
93
|
-
},
|
|
96
|
+
}, E = new WeakMap(), b = new WeakMap(), C = new WeakMap();
|
|
94
97
|
export {
|
|
95
98
|
R as Source,
|
|
96
99
|
F as SourceElement,
|
package/lib/video/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../custom-element/index.cjs");require("../window-resizer/index.cjs");require("../Store-C-1ruEIm.cjs");const v=require("../source/index.cjs"),d=require("../ticker/index.cjs");var E=Object.defineProperty,
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../custom-element/index.cjs");require("../window-resizer/index.cjs");require("../Store-C-1ruEIm.cjs");const v=require("../source/index.cjs"),d=require("../ticker/index.cjs");var E=Object.defineProperty,f=Object.getOwnPropertyDescriptor,_=(t,e,r,s)=>{for(var a=s>1?void 0:s?f(e,r):e,o=t.length-1,u;o>=0;o--)(u=t[o])&&(a=(s?u(e,r,a):u(a))||a);return s&&a&&E(e,r,a),a},p=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},n=(t,e,r)=>(p(t,e,"read from private field"),r?r.call(t):e.get(t)),l=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},h=(t,e,r,s)=>(p(t,e,"write to private field"),s?s.call(t,r):e.set(t,r),r),i,c;exports.VideoElement=class extends v.SourceElement{constructor(){super(...arguments),l(this,i,0),l(this,c,()=>{this.classList.add(`state-${this.consumerElement.readyState}`);const e=this.consumerElement.readyState/4;e>n(this,i)&&h(this,i,e),this.dispatchEvent(new CustomEvent("readyStateChange",{detail:{readyState:this.consumerElement.readyState,progress:n(this,i)}})),this.consumerElement.readyState===4&&d.ticker.unsubscribe(n(this,c))})}connectedCallback(){super.connectedCallback(),this.addEventListener("sourceCapture",()=>{d.ticker.subscribe(n(this,c)),this.hasAttribute("capture-autoplay")&&this.consumerElement.play()}),this.addEventListener("sourceRelease",()=>{this.hasAttribute("capture-autoplay")&&(this.consumerElement.pause(),this.hasAttribute("replay")&&(this.consumerElement.currentTime=0)),this.hasAttribute("reload-source")&&this.classList.remove("state-0","state-1","state-2","state-3","state-4")})}disconnectedCallback(){super.disconnectedCallback(),d.ticker.unsubscribe(n(this,c)),h(this,i,0)}createConsumer(){return document.createElement("video")}consumeSource(e){this.consumerElement.src=e||""}};i=new WeakMap;c=new WeakMap;exports.VideoElement=_([m.define("e-video")],exports.VideoElement);
|
package/lib/video/index.js
CHANGED
|
@@ -2,43 +2,49 @@ import { define as v } from "../custom-element/index.js";
|
|
|
2
2
|
import "../window-resizer/index.js";
|
|
3
3
|
import "../Store-BQXXikps.js";
|
|
4
4
|
import { SourceElement as f } from "../source/index.js";
|
|
5
|
-
import { ticker as
|
|
6
|
-
var E = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, y = (e, t,
|
|
7
|
-
for (var a =
|
|
8
|
-
(
|
|
9
|
-
return
|
|
10
|
-
}, m = (e, t,
|
|
5
|
+
import { ticker as u } from "../ticker/index.js";
|
|
6
|
+
var E = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, y = (e, t, s, r) => {
|
|
7
|
+
for (var a = r > 1 ? void 0 : r ? _(t, s) : t, o = e.length - 1, h; o >= 0; o--)
|
|
8
|
+
(h = e[o]) && (a = (r ? h(t, s, a) : h(a)) || a);
|
|
9
|
+
return r && a && E(t, s, a), a;
|
|
10
|
+
}, m = (e, t, s) => {
|
|
11
11
|
if (!t.has(e))
|
|
12
|
-
throw TypeError("Cannot " +
|
|
13
|
-
}, n = (e, t,
|
|
12
|
+
throw TypeError("Cannot " + s);
|
|
13
|
+
}, n = (e, t, s) => (m(e, t, "read from private field"), s ? s.call(e) : t.get(e)), l = (e, t, s) => {
|
|
14
14
|
if (t.has(e))
|
|
15
15
|
throw TypeError("Cannot add the same private member more than once");
|
|
16
|
-
t instanceof WeakSet ? t.add(e) : t.set(e,
|
|
17
|
-
},
|
|
18
|
-
let
|
|
16
|
+
t instanceof WeakSet ? t.add(e) : t.set(e, s);
|
|
17
|
+
}, d = (e, t, s, r) => (m(e, t, "write to private field"), r ? r.call(e, s) : t.set(e, s), s), i, c;
|
|
18
|
+
let p = class extends f {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(...arguments), l(this, i, 0), l(this, c, () => {
|
|
21
21
|
this.classList.add(`state-${this.consumerElement.readyState}`);
|
|
22
22
|
const e = this.consumerElement.readyState / 4;
|
|
23
|
-
e > n(this, i) &&
|
|
23
|
+
e > n(this, i) && d(this, i, e), this.dispatchEvent(
|
|
24
24
|
new CustomEvent("readyStateChange", {
|
|
25
25
|
detail: {
|
|
26
26
|
readyState: this.consumerElement.readyState,
|
|
27
27
|
progress: n(this, i)
|
|
28
28
|
}
|
|
29
29
|
})
|
|
30
|
-
), this.consumerElement.readyState === 4 &&
|
|
30
|
+
), this.consumerElement.readyState === 4 && u.unsubscribe(n(this, c));
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
connectedCallback() {
|
|
34
34
|
super.connectedCallback(), this.addEventListener("sourceCapture", () => {
|
|
35
|
-
|
|
35
|
+
u.subscribe(n(this, c)), this.hasAttribute("capture-autoplay") && this.consumerElement.play();
|
|
36
36
|
}), this.addEventListener("sourceRelease", () => {
|
|
37
|
-
this.hasAttribute("capture-autoplay") && (this.consumerElement.pause(), this.hasAttribute("replay") && (this.consumerElement.currentTime = 0))
|
|
37
|
+
this.hasAttribute("capture-autoplay") && (this.consumerElement.pause(), this.hasAttribute("replay") && (this.consumerElement.currentTime = 0)), this.hasAttribute("reload-source") && this.classList.remove(
|
|
38
|
+
"state-0",
|
|
39
|
+
"state-1",
|
|
40
|
+
"state-2",
|
|
41
|
+
"state-3",
|
|
42
|
+
"state-4"
|
|
43
|
+
);
|
|
38
44
|
});
|
|
39
45
|
}
|
|
40
46
|
disconnectedCallback() {
|
|
41
|
-
super.disconnectedCallback(),
|
|
47
|
+
super.disconnectedCallback(), u.unsubscribe(n(this, c)), d(this, i, 0);
|
|
42
48
|
}
|
|
43
49
|
createConsumer() {
|
|
44
50
|
return document.createElement("video");
|
|
@@ -49,9 +55,9 @@ let d = class extends f {
|
|
|
49
55
|
};
|
|
50
56
|
i = /* @__PURE__ */ new WeakMap();
|
|
51
57
|
c = /* @__PURE__ */ new WeakMap();
|
|
52
|
-
|
|
58
|
+
p = y([
|
|
53
59
|
v("e-video")
|
|
54
|
-
],
|
|
60
|
+
], p);
|
|
55
61
|
export {
|
|
56
|
-
|
|
62
|
+
p as VideoElement
|
|
57
63
|
};
|