aptechka 0.5.34 → 0.5.36
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/video/index.cjs +1 -1
- package/lib/video/index.d.ts +2 -0
- package/lib/video/index.js +35 -17
- package/package.json +1 -1
package/lib/video/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../custom-element/index.cjs");require("../window-resizer/index.cjs");require("../Store-C-1ruEIm.cjs");const d=require("../source/index.cjs"),o=require("../ticker/index.cjs");var h=Object.defineProperty,p=Object.getOwnPropertyDescriptor,m=(t,e,r,n)=>{for(var s=n>1?void 0:n?p(e,r):e,a=t.length-1,c;a>=0;a--)(c=t[a])&&(s=(n?c(e,r,s):c(s))||s);return n&&s&&h(e,r,s),s},v=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},u=(t,e,r)=>(v(t,e,"read from private field"),r?r.call(t):e.get(t)),E=(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)},i;exports.VideoElement=class extends d.SourceElement{constructor(){super(...arguments),E(this,i,()=>{this.classList.add(`state-${this.consumerElement.readyState}`),this.style.setProperty("--loading-progress",(this.consumerElement.readyState/4).toString()),this.consumerElement.readyState===4&&o.ticker.unsubscribe(u(this,i))})}connectedCallback(){super.connectedCallback(),this.addEventListener("sourceCapture",()=>{o.ticker.subscribe(u(this,i)),this.hasAttribute("capture-autoplay")&&this.consumerElement.play()}),this.addEventListener("sourceRelease",()=>{this.hasAttribute("capture-autoplay")&&(this.consumerElement.pause(),this.hasAttribute("replay")&&(this.consumerElement.currentTime=0))})}disconnectedCallback(){super.disconnectedCallback(),o.ticker.unsubscribe(u(this,i))}createConsumer(){return document.createElement("video")}consumeSource(e){this.consumerElement.src=e||""}};i=new WeakMap;exports.VideoElement=m([l.define("e-video")],exports.VideoElement);
|
package/lib/video/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { SourceElement } from '../source';
|
|
2
2
|
|
|
3
3
|
export declare class VideoElement extends SourceElement<HTMLVideoElement> {
|
|
4
|
+
#private;
|
|
4
5
|
protected connectedCallback(): void;
|
|
6
|
+
protected disconnectedCallback(): void;
|
|
5
7
|
protected createConsumer(): HTMLVideoElement;
|
|
6
8
|
protected consumeSource(url: string | null): void;
|
|
7
9
|
}
|
package/lib/video/index.js
CHANGED
|
@@ -1,32 +1,50 @@
|
|
|
1
|
-
import { define as
|
|
1
|
+
import { define as p } from "../custom-element/index.js";
|
|
2
2
|
import "../window-resizer/index.js";
|
|
3
3
|
import "../Store-BQXXikps.js";
|
|
4
|
-
import { SourceElement as
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
import { SourceElement as h } from "../source/index.js";
|
|
5
|
+
import { ticker as o } from "../ticker/index.js";
|
|
6
|
+
var d = Object.defineProperty, m = Object.getOwnPropertyDescriptor, f = (e, t, r, i) => {
|
|
7
|
+
for (var s = i > 1 ? void 0 : i ? m(t, r) : t, n = e.length - 1, c; n >= 0; n--)
|
|
8
|
+
(c = e[n]) && (s = (i ? c(t, r, s) : c(s)) || s);
|
|
9
|
+
return i && s && d(t, r, s), s;
|
|
10
|
+
}, v = (e, t, r) => {
|
|
11
|
+
if (!t.has(e))
|
|
12
|
+
throw TypeError("Cannot " + r);
|
|
13
|
+
}, u = (e, t, r) => (v(e, t, "read from private field"), r ? r.call(e) : t.get(e)), E = (e, t, r) => {
|
|
14
|
+
if (t.has(e))
|
|
15
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
16
|
+
t instanceof WeakSet ? t.add(e) : t.set(e, r);
|
|
17
|
+
}, a;
|
|
18
|
+
let l = class extends h {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments), E(this, a, () => {
|
|
21
|
+
this.classList.add(`state-${this.consumerElement.readyState}`), this.style.setProperty(
|
|
22
|
+
"--loading-progress",
|
|
23
|
+
(this.consumerElement.readyState / 4).toString()
|
|
24
|
+
), this.consumerElement.readyState === 4 && o.unsubscribe(u(this, a));
|
|
25
|
+
});
|
|
26
|
+
}
|
|
11
27
|
connectedCallback() {
|
|
12
28
|
super.connectedCallback(), this.addEventListener("sourceCapture", () => {
|
|
13
|
-
this.hasAttribute("capture-autoplay") && this.consumerElement.play();
|
|
29
|
+
o.subscribe(u(this, a)), this.hasAttribute("capture-autoplay") && this.consumerElement.play();
|
|
14
30
|
}), this.addEventListener("sourceRelease", () => {
|
|
15
31
|
this.hasAttribute("capture-autoplay") && (this.consumerElement.pause(), this.hasAttribute("replay") && (this.consumerElement.currentTime = 0));
|
|
16
|
-
}), this.consumerElement.addEventListener("loadeddata", () => {
|
|
17
|
-
this.consumerElement.readyState === 4 && this.classList.add("enough-data");
|
|
18
32
|
});
|
|
19
33
|
}
|
|
34
|
+
disconnectedCallback() {
|
|
35
|
+
super.disconnectedCallback(), o.unsubscribe(u(this, a));
|
|
36
|
+
}
|
|
20
37
|
createConsumer() {
|
|
21
38
|
return document.createElement("video");
|
|
22
39
|
}
|
|
23
|
-
consumeSource(
|
|
24
|
-
this.consumerElement.src =
|
|
40
|
+
consumeSource(e) {
|
|
41
|
+
this.consumerElement.src = e || "";
|
|
25
42
|
}
|
|
26
43
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
44
|
+
a = /* @__PURE__ */ new WeakMap();
|
|
45
|
+
l = f([
|
|
46
|
+
p("e-video")
|
|
47
|
+
], l);
|
|
30
48
|
export {
|
|
31
|
-
|
|
49
|
+
l as VideoElement
|
|
32
50
|
};
|