@editframe/elements 0.16.7-beta.0 → 0.17.6-beta.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 +30 -0
- package/dist/DecoderResetFrequency.test.d.ts +1 -0
- package/dist/DecoderResetRecovery.test.d.ts +1 -0
- package/dist/DelayedLoadingState.d.ts +48 -0
- package/dist/DelayedLoadingState.integration.test.d.ts +1 -0
- package/dist/DelayedLoadingState.js +113 -0
- package/dist/DelayedLoadingState.test.d.ts +1 -0
- package/dist/EF_FRAMEGEN.d.ts +10 -1
- package/dist/EF_FRAMEGEN.js +199 -179
- package/dist/EF_INTERACTIVE.js +2 -6
- package/dist/EF_RENDERING.js +1 -3
- package/dist/JitTranscodingClient.browsertest.d.ts +1 -0
- package/dist/JitTranscodingClient.d.ts +167 -0
- package/dist/JitTranscodingClient.js +373 -0
- package/dist/JitTranscodingClient.test.d.ts +1 -0
- package/dist/LoadingDebounce.test.d.ts +1 -0
- package/dist/LoadingIndicator.browsertest.d.ts +0 -0
- package/dist/ManualScrubTest.test.d.ts +1 -0
- package/dist/ScrubResolvedFlashing.test.d.ts +1 -0
- package/dist/ScrubTrackIntegration.test.d.ts +1 -0
- package/dist/ScrubTrackManager.d.ts +96 -0
- package/dist/ScrubTrackManager.js +216 -0
- package/dist/ScrubTrackManager.test.d.ts +1 -0
- package/dist/SegmentSwitchLoading.test.d.ts +1 -0
- package/dist/VideoSeekFlashing.browsertest.d.ts +0 -0
- package/dist/VideoStuckDiagnostic.test.d.ts +1 -0
- package/dist/elements/CrossUpdateController.js +13 -15
- package/dist/elements/EFAudio.browsertest.d.ts +0 -0
- package/dist/elements/EFAudio.d.ts +1 -1
- package/dist/elements/EFAudio.js +30 -43
- package/dist/elements/EFCaptions.js +337 -373
- package/dist/elements/EFImage.js +64 -90
- package/dist/elements/EFMedia.d.ts +98 -33
- package/dist/elements/EFMedia.js +1169 -678
- package/dist/elements/EFSourceMixin.js +31 -48
- package/dist/elements/EFTemporal.d.ts +1 -0
- package/dist/elements/EFTemporal.js +266 -360
- package/dist/elements/EFTimegroup.d.ts +3 -1
- package/dist/elements/EFTimegroup.js +262 -323
- package/dist/elements/EFVideo.browsertest.d.ts +0 -0
- package/dist/elements/EFVideo.d.ts +90 -2
- package/dist/elements/EFVideo.js +408 -111
- package/dist/elements/EFWaveform.js +375 -411
- package/dist/elements/FetchMixin.js +14 -24
- package/dist/elements/MediaController.d.ts +30 -0
- package/dist/elements/TargetController.js +130 -156
- package/dist/elements/TimegroupController.js +17 -19
- package/dist/elements/durationConverter.js +15 -4
- package/dist/elements/parseTimeToMs.js +4 -10
- package/dist/elements/printTaskStatus.d.ts +2 -0
- package/dist/elements/printTaskStatus.js +11 -0
- package/dist/elements/updateAnimations.js +39 -59
- package/dist/getRenderInfo.js +58 -67
- package/dist/gui/ContextMixin.js +203 -288
- package/dist/gui/EFConfiguration.js +27 -43
- package/dist/gui/EFFilmstrip.js +440 -620
- package/dist/gui/EFFitScale.js +112 -135
- package/dist/gui/EFFocusOverlay.js +45 -61
- package/dist/gui/EFPreview.js +30 -49
- package/dist/gui/EFScrubber.js +78 -99
- package/dist/gui/EFTimeDisplay.js +49 -70
- package/dist/gui/EFToggleLoop.js +17 -34
- package/dist/gui/EFTogglePlay.js +37 -58
- package/dist/gui/EFWorkbench.js +66 -88
- package/dist/gui/TWMixin.js +2 -48
- package/dist/gui/TWMixin2.js +31 -0
- package/dist/gui/efContext.js +2 -6
- package/dist/gui/fetchContext.js +1 -3
- package/dist/gui/focusContext.js +1 -3
- package/dist/gui/focusedElementContext.js +2 -6
- package/dist/gui/playingContext.js +1 -4
- package/dist/index.js +5 -30
- package/dist/msToTimeCode.js +11 -13
- package/dist/style.css +2 -1
- package/package.json +3 -3
- package/src/elements/EFAudio.browsertest.ts +569 -0
- package/src/elements/EFAudio.ts +4 -6
- package/src/elements/EFCaptions.browsertest.ts +0 -1
- package/src/elements/EFImage.browsertest.ts +0 -1
- package/src/elements/EFMedia.browsertest.ts +147 -115
- package/src/elements/EFMedia.ts +1339 -307
- package/src/elements/EFTemporal.browsertest.ts +0 -1
- package/src/elements/EFTemporal.ts +11 -0
- package/src/elements/EFTimegroup.ts +73 -10
- package/src/elements/EFVideo.browsertest.ts +680 -0
- package/src/elements/EFVideo.ts +729 -50
- package/src/elements/EFWaveform.ts +4 -4
- package/src/elements/MediaController.ts +108 -0
- package/src/elements/__screenshots__/EFMedia.browsertest.ts/EFMedia-JIT-audio-playback-audioBufferTask-should-work-in-JIT-mode-without-URL-errors-1.png +0 -0
- package/src/elements/printTaskStatus.ts +16 -0
- package/src/elements/updateAnimations.ts +6 -0
- package/src/gui/TWMixin.ts +10 -3
- package/test/EFVideo.frame-tasks.browsertest.ts +524 -0
- package/test/EFVideo.framegen.browsertest.ts +118 -0
- package/test/createJitTestClips.ts +293 -0
- package/test/useAssetMSW.ts +49 -0
- package/test/useMSW.ts +31 -0
- package/types.json +1 -1
- package/dist/gui/TWMixin.css.js +0 -4
- /package/dist/elements/{TargetController.test.d.ts → TargetController.browsertest.d.ts} +0 -0
- /package/src/elements/{TargetController.test.ts → TargetController.browsertest.ts} +0 -0
package/dist/gui/EFFitScale.js
CHANGED
|
@@ -1,138 +1,115 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
|
-
import {
|
|
2
|
+
import { customElement, state } from "lit/decorators.js";
|
|
3
|
+
import _decorate from "@oxc-project/runtime/helpers/decorate";
|
|
3
4
|
import { createRef } from "lit/directives/ref.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
scale,
|
|
112
|
-
containerWidth,
|
|
113
|
-
containerHeight,
|
|
114
|
-
contentWidth,
|
|
115
|
-
contentHeight
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
connectedCallback() {
|
|
119
|
-
super.connectedCallback();
|
|
120
|
-
this.animationFrameId = requestAnimationFrame(this.setScale);
|
|
121
|
-
}
|
|
122
|
-
disconnectedCallback() {
|
|
123
|
-
super.disconnectedCallback();
|
|
124
|
-
this.removeScale();
|
|
125
|
-
if (this.animationFrameId) {
|
|
126
|
-
cancelAnimationFrame(this.animationFrameId);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
__decorateClass([
|
|
131
|
-
state()
|
|
132
|
-
], EFFitScale.prototype, "scale", 2);
|
|
133
|
-
EFFitScale = __decorateClass([
|
|
134
|
-
customElement("ef-fit-scale")
|
|
135
|
-
], EFFitScale);
|
|
136
|
-
export {
|
|
137
|
-
EFFitScale
|
|
5
|
+
let EFFitScale = class EFFitScale$1 extends LitElement {
|
|
6
|
+
constructor(..._args) {
|
|
7
|
+
super(..._args);
|
|
8
|
+
this.containerRef = createRef();
|
|
9
|
+
this.contentRef = createRef();
|
|
10
|
+
this.uniqueId = Math.random().toString(36).substring(2, 15);
|
|
11
|
+
this.scale = 1;
|
|
12
|
+
this.scaleLastSetOn = null;
|
|
13
|
+
this.setScale = () => {
|
|
14
|
+
if (this.isConnected) {
|
|
15
|
+
const { scale } = this.scaleInfo;
|
|
16
|
+
if (this.contentChild) {
|
|
17
|
+
const containerRect = this.getBoundingClientRect();
|
|
18
|
+
const contentRect = this.contentChild.getBoundingClientRect();
|
|
19
|
+
const unscaledWidth = contentRect.width / this.scale;
|
|
20
|
+
const unscaledHeight = contentRect.height / this.scale;
|
|
21
|
+
const scaledWidth = unscaledWidth * scale;
|
|
22
|
+
const scaledHeight = unscaledHeight * scale;
|
|
23
|
+
const translateX = (containerRect.width - scaledWidth) / 2;
|
|
24
|
+
const translateY = (containerRect.height - scaledHeight) / 2;
|
|
25
|
+
if (this.scaleLastSetOn !== this.contentChild) this.removeScale();
|
|
26
|
+
Object.assign(this.contentChild.style, {
|
|
27
|
+
transform: `translate(${translateX.toFixed(4)}px, ${translateY.toFixed(4)}px) scale(${scale.toFixed(4)})`,
|
|
28
|
+
transformOrigin: "top left"
|
|
29
|
+
});
|
|
30
|
+
this.scale = scale;
|
|
31
|
+
this.scaleLastSetOn = this.contentChild;
|
|
32
|
+
}
|
|
33
|
+
this.animationFrameId = requestAnimationFrame(this.setScale);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
this.removeScale = () => {
|
|
37
|
+
if (this.scaleLastSetOn) {
|
|
38
|
+
Object.assign(this.scaleLastSetOn.style, {
|
|
39
|
+
transform: "",
|
|
40
|
+
transformOrigin: ""
|
|
41
|
+
});
|
|
42
|
+
this.scaleLastSetOn = null;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
createRenderRoot() {
|
|
47
|
+
Object.assign(this.style, {
|
|
48
|
+
display: "grid",
|
|
49
|
+
width: "100%",
|
|
50
|
+
height: "100%",
|
|
51
|
+
gridTemplateColumns: "100%",
|
|
52
|
+
gridTemplateRows: "100%",
|
|
53
|
+
overflow: "hidden",
|
|
54
|
+
boxSizing: "border-box",
|
|
55
|
+
contain: "strict",
|
|
56
|
+
position: "relative"
|
|
57
|
+
});
|
|
58
|
+
this.id = `${this.uniqueId}`;
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
get contentChild() {
|
|
62
|
+
const firstElement = this.children[0];
|
|
63
|
+
if (!firstElement) return null;
|
|
64
|
+
let current = firstElement;
|
|
65
|
+
while (current) {
|
|
66
|
+
if (current instanceof HTMLSlotElement) {
|
|
67
|
+
const assigned = current.assignedElements()[0];
|
|
68
|
+
if (!assigned) break;
|
|
69
|
+
current = assigned;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
const display = window.getComputedStyle(current).display;
|
|
73
|
+
if (display !== "contents" && display !== "none") return current;
|
|
74
|
+
const firstChild = current.children[0];
|
|
75
|
+
if (!firstChild) break;
|
|
76
|
+
current = firstChild;
|
|
77
|
+
}
|
|
78
|
+
return firstElement;
|
|
79
|
+
}
|
|
80
|
+
get scaleInfo() {
|
|
81
|
+
if (!this.contentChild) return {
|
|
82
|
+
scale: 1,
|
|
83
|
+
containerWidth: 0,
|
|
84
|
+
containerHeight: 0,
|
|
85
|
+
contentWidth: 0,
|
|
86
|
+
contentHeight: 0
|
|
87
|
+
};
|
|
88
|
+
const containerWidth = this.clientWidth;
|
|
89
|
+
const containerHeight = this.clientHeight;
|
|
90
|
+
const contentWidth = this.contentChild.clientWidth;
|
|
91
|
+
const contentHeight = this.contentChild.clientHeight;
|
|
92
|
+
const containerRatio = containerWidth / containerHeight;
|
|
93
|
+
const contentRatio = contentWidth / contentHeight;
|
|
94
|
+
const scale = containerRatio > contentRatio ? containerHeight / contentHeight : containerWidth / contentWidth;
|
|
95
|
+
return {
|
|
96
|
+
scale,
|
|
97
|
+
containerWidth,
|
|
98
|
+
containerHeight,
|
|
99
|
+
contentWidth,
|
|
100
|
+
contentHeight
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
connectedCallback() {
|
|
104
|
+
super.connectedCallback();
|
|
105
|
+
this.animationFrameId = requestAnimationFrame(this.setScale);
|
|
106
|
+
}
|
|
107
|
+
disconnectedCallback() {
|
|
108
|
+
super.disconnectedCallback();
|
|
109
|
+
this.removeScale();
|
|
110
|
+
if (this.animationFrameId) cancelAnimationFrame(this.animationFrameId);
|
|
111
|
+
}
|
|
138
112
|
};
|
|
113
|
+
_decorate([state()], EFFitScale.prototype, "scale", void 0);
|
|
114
|
+
EFFitScale = _decorate([customElement("ef-fit-scale")], EFFitScale);
|
|
115
|
+
export { EFFitScale };
|
|
@@ -1,59 +1,30 @@
|
|
|
1
|
+
import { focusedElementContext } from "./focusedElementContext.js";
|
|
1
2
|
import { consume } from "@lit/context";
|
|
2
|
-
import {
|
|
3
|
+
import { LitElement, css, html } from "lit";
|
|
3
4
|
import { customElement } from "lit/decorators.js";
|
|
5
|
+
import _decorate from "@oxc-project/runtime/helpers/decorate";
|
|
4
6
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
Object.assign(overlay.style, {
|
|
27
|
-
top: `${rect.top}px`,
|
|
28
|
-
left: `${rect.left}px`,
|
|
29
|
-
width: `${rect.width}px`,
|
|
30
|
-
height: `${rect.height}px`
|
|
31
|
-
});
|
|
32
|
-
this.animationFrame = requestAnimationFrame(this.drawOverlay);
|
|
33
|
-
} else {
|
|
34
|
-
overlay.style.display = "none";
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
render() {
|
|
40
|
-
return html`<div ${ref(this.overlay)} class="overlay"></div>`;
|
|
41
|
-
}
|
|
42
|
-
connectedCallback() {
|
|
43
|
-
super.connectedCallback();
|
|
44
|
-
this.drawOverlay();
|
|
45
|
-
}
|
|
46
|
-
disconnectedCallback() {
|
|
47
|
-
super.disconnectedCallback();
|
|
48
|
-
if (this.animationFrame) {
|
|
49
|
-
cancelAnimationFrame(this.animationFrame);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
updated() {
|
|
53
|
-
this.drawOverlay();
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
EFFocusOverlay.styles = css`
|
|
7
|
+
let EFFocusOverlay = class EFFocusOverlay$1 extends LitElement {
|
|
8
|
+
constructor(..._args) {
|
|
9
|
+
super(..._args);
|
|
10
|
+
this.overlay = createRef();
|
|
11
|
+
this.drawOverlay = () => {
|
|
12
|
+
const overlay = this.overlay.value;
|
|
13
|
+
if (overlay) if (this.focusedElement) {
|
|
14
|
+
overlay.style.display = "block";
|
|
15
|
+
const rect = this.focusedElement.getBoundingClientRect();
|
|
16
|
+
Object.assign(overlay.style, {
|
|
17
|
+
top: `${rect.top}px`,
|
|
18
|
+
left: `${rect.left}px`,
|
|
19
|
+
width: `${rect.width}px`,
|
|
20
|
+
height: `${rect.height}px`
|
|
21
|
+
});
|
|
22
|
+
this.animationFrame = requestAnimationFrame(this.drawOverlay);
|
|
23
|
+
} else overlay.style.display = "none";
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
static {
|
|
27
|
+
this.styles = css`
|
|
57
28
|
:host {
|
|
58
29
|
display: block;
|
|
59
30
|
position: relative;
|
|
@@ -71,12 +42,25 @@ EFFocusOverlay.styles = css`
|
|
|
71
42
|
display: none;
|
|
72
43
|
}
|
|
73
44
|
`;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
45
|
+
}
|
|
46
|
+
render() {
|
|
47
|
+
return html`<div ${ref(this.overlay)} class="overlay"></div>`;
|
|
48
|
+
}
|
|
49
|
+
connectedCallback() {
|
|
50
|
+
super.connectedCallback();
|
|
51
|
+
this.drawOverlay();
|
|
52
|
+
}
|
|
53
|
+
disconnectedCallback() {
|
|
54
|
+
super.disconnectedCallback();
|
|
55
|
+
if (this.animationFrame) cancelAnimationFrame(this.animationFrame);
|
|
56
|
+
}
|
|
57
|
+
updated() {
|
|
58
|
+
this.drawOverlay();
|
|
59
|
+
}
|
|
82
60
|
};
|
|
61
|
+
_decorate([consume({
|
|
62
|
+
context: focusedElementContext,
|
|
63
|
+
subscribe: true
|
|
64
|
+
})], EFFocusOverlay.prototype, "focusedElement", void 0);
|
|
65
|
+
EFFocusOverlay = _decorate([customElement("ef-focus-overlay")], EFFocusOverlay);
|
|
66
|
+
export { EFFocusOverlay };
|
package/dist/gui/EFPreview.js
CHANGED
|
@@ -1,56 +1,37 @@
|
|
|
1
|
-
import { LitElement, html, css } from "lit";
|
|
2
|
-
import { customElement } from "lit/decorators.js";
|
|
3
|
-
import { provide } from "@lit/context";
|
|
4
|
-
import { ContextMixin } from "./ContextMixin.js";
|
|
5
|
-
import { TWMixin } from "./TWMixin.js";
|
|
6
1
|
import { focusedElementContext } from "./focusedElementContext.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
17
|
-
let EFPreview = class extends ContextMixin(TWMixin(LitElement)) {
|
|
18
|
-
constructor() {
|
|
19
|
-
super();
|
|
20
|
-
this.addEventListener("mouseover", (e) => {
|
|
21
|
-
const target = e.target;
|
|
22
|
-
const timegroup = target.closest("ef-timegroup");
|
|
23
|
-
if (target !== this && timegroup) {
|
|
24
|
-
this.focusedElement = target;
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
this.addEventListener("mouseout", (e) => {
|
|
28
|
-
const relatedTarget = e.relatedTarget;
|
|
29
|
-
const targetingTimegroup = relatedTarget?.closest("ef-timegroup");
|
|
30
|
-
if (!this.contains(relatedTarget) || relatedTarget === this || !targetingTimegroup) {
|
|
31
|
-
this.focusedElement = void 0;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
render() {
|
|
36
|
-
return html`<slot></slot>`;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
EFPreview.styles = [
|
|
40
|
-
css`
|
|
2
|
+
import { ContextMixin } from "./ContextMixin.js";
|
|
3
|
+
import { TWMixin } from "./TWMixin2.js";
|
|
4
|
+
import { provide } from "@lit/context";
|
|
5
|
+
import { LitElement, css, html } from "lit";
|
|
6
|
+
import { customElement } from "lit/decorators.js";
|
|
7
|
+
import _decorate from "@oxc-project/runtime/helpers/decorate";
|
|
8
|
+
let EFPreview = class EFPreview$1 extends ContextMixin(TWMixin(LitElement)) {
|
|
9
|
+
static {
|
|
10
|
+
this.styles = [css`
|
|
41
11
|
:host {
|
|
42
12
|
position: relative;
|
|
43
13
|
display: block;
|
|
44
14
|
cursor: crosshair;
|
|
45
15
|
}
|
|
46
|
-
`
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
16
|
+
`];
|
|
17
|
+
}
|
|
18
|
+
constructor() {
|
|
19
|
+
super();
|
|
20
|
+
this.addEventListener("mouseover", (e) => {
|
|
21
|
+
const target = e.target;
|
|
22
|
+
const timegroup = target.closest("ef-timegroup");
|
|
23
|
+
if (target !== this && timegroup) this.focusedElement = target;
|
|
24
|
+
});
|
|
25
|
+
this.addEventListener("mouseout", (e) => {
|
|
26
|
+
const relatedTarget = e.relatedTarget;
|
|
27
|
+
const targetingTimegroup = relatedTarget?.closest("ef-timegroup");
|
|
28
|
+
if (!this.contains(relatedTarget) || relatedTarget === this || !targetingTimegroup) this.focusedElement = void 0;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
render() {
|
|
32
|
+
return html`<slot></slot>`;
|
|
33
|
+
}
|
|
56
34
|
};
|
|
35
|
+
_decorate([provide({ context: focusedElementContext })], EFPreview.prototype, "focusedElement", void 0);
|
|
36
|
+
EFPreview = _decorate([customElement("ef-preview")], EFPreview);
|
|
37
|
+
export { EFPreview };
|
package/dist/gui/EFScrubber.js
CHANGED
|
@@ -1,82 +1,31 @@
|
|
|
1
|
-
import { consume } from "@lit/context";
|
|
2
|
-
import { css, LitElement, html } from "lit";
|
|
3
|
-
import { state, customElement } from "lit/decorators.js";
|
|
4
|
-
import { ref } from "lit/directives/ref.js";
|
|
5
1
|
import { efContext } from "./efContext.js";
|
|
6
2
|
import { playingContext } from "./playingContext.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
};
|
|
34
|
-
this.boundHandleMouseUp = () => {
|
|
35
|
-
this.isDragging = false;
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
updateProgress(e) {
|
|
39
|
-
if (!this.context || !this.scrubberRef) return;
|
|
40
|
-
const rect = this.scrubberRef.getBoundingClientRect();
|
|
41
|
-
const x = e.clientX - rect.left;
|
|
42
|
-
const progress = Math.max(0, Math.min(1, x / rect.width));
|
|
43
|
-
this.scrubProgress = progress;
|
|
44
|
-
this.context.currentTimeMs = progress * (this.context.targetTimegroup?.durationMs ?? 0);
|
|
45
|
-
}
|
|
46
|
-
render() {
|
|
47
|
-
const displayProgress = this.isDragging ? this.scrubProgress : this.lastTimeUpdateProgress;
|
|
48
|
-
return html`
|
|
49
|
-
<div
|
|
50
|
-
${ref((el) => {
|
|
51
|
-
this.scrubberRef = el;
|
|
52
|
-
})}
|
|
53
|
-
part="scrubber"
|
|
54
|
-
class="scrubber"
|
|
55
|
-
@mousedown=${this.boundHandleMouseDown}
|
|
56
|
-
>
|
|
57
|
-
<div class="progress" style="width: ${displayProgress * 100}%"></div>
|
|
58
|
-
<div class="handle" style="left: ${displayProgress * 100}%"></div>
|
|
59
|
-
</div>
|
|
60
|
-
`;
|
|
61
|
-
}
|
|
62
|
-
connectedCallback() {
|
|
63
|
-
super.connectedCallback();
|
|
64
|
-
window.addEventListener("mouseup", this.boundHandleMouseUp);
|
|
65
|
-
window.addEventListener("mousemove", this.boundHandleMouseMove);
|
|
66
|
-
if (this.context) {
|
|
67
|
-
this.context.addEventListener("timeupdate", (e) => {
|
|
68
|
-
this.lastTimeUpdateProgress = e.detail.progress;
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
disconnectedCallback() {
|
|
73
|
-
super.disconnectedCallback();
|
|
74
|
-
window.removeEventListener("mouseup", this.boundHandleMouseUp);
|
|
75
|
-
window.removeEventListener("mousemove", this.boundHandleMouseMove);
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
EFScrubber.styles = [
|
|
79
|
-
css`
|
|
3
|
+
import { consume } from "@lit/context";
|
|
4
|
+
import { LitElement, css, html } from "lit";
|
|
5
|
+
import { customElement, state } from "lit/decorators.js";
|
|
6
|
+
import _decorate from "@oxc-project/runtime/helpers/decorate";
|
|
7
|
+
import { ref } from "lit/directives/ref.js";
|
|
8
|
+
let EFScrubber = class EFScrubber$1 extends LitElement {
|
|
9
|
+
constructor(..._args) {
|
|
10
|
+
super(..._args);
|
|
11
|
+
this.playing = false;
|
|
12
|
+
this.lastTimeUpdateProgress = 0;
|
|
13
|
+
this.scrubProgress = 0;
|
|
14
|
+
this.isDragging = false;
|
|
15
|
+
this.boundHandleMouseDown = (e) => {
|
|
16
|
+
this.isDragging = true;
|
|
17
|
+
e.preventDefault();
|
|
18
|
+
this.updateProgress(e);
|
|
19
|
+
};
|
|
20
|
+
this.boundHandleMouseMove = (e) => {
|
|
21
|
+
if (this.isDragging) this.updateProgress(e);
|
|
22
|
+
};
|
|
23
|
+
this.boundHandleMouseUp = () => {
|
|
24
|
+
this.isDragging = false;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
static {
|
|
28
|
+
this.styles = [css`
|
|
80
29
|
:host {
|
|
81
30
|
--ef-scrubber-height: 4px;
|
|
82
31
|
--ef-scrubber-background: rgb(209 213 219);
|
|
@@ -117,26 +66,56 @@ EFScrubber.styles = [
|
|
|
117
66
|
::part(scrubber) { }
|
|
118
67
|
::part(progress) { }
|
|
119
68
|
::part(handle) { }
|
|
120
|
-
`
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
69
|
+
`];
|
|
70
|
+
}
|
|
71
|
+
updateProgress(e) {
|
|
72
|
+
if (!this.context || !this.scrubberRef) return;
|
|
73
|
+
const rect = this.scrubberRef.getBoundingClientRect();
|
|
74
|
+
const x = e.clientX - rect.left;
|
|
75
|
+
const progress = Math.max(0, Math.min(1, x / rect.width));
|
|
76
|
+
this.scrubProgress = progress;
|
|
77
|
+
this.context.currentTimeMs = progress * (this.context.targetTimegroup?.durationMs ?? 0);
|
|
78
|
+
}
|
|
79
|
+
render() {
|
|
80
|
+
const displayProgress = this.isDragging ? this.scrubProgress : this.lastTimeUpdateProgress;
|
|
81
|
+
return html`
|
|
82
|
+
<div
|
|
83
|
+
${ref((el) => {
|
|
84
|
+
this.scrubberRef = el;
|
|
85
|
+
})}
|
|
86
|
+
part="scrubber"
|
|
87
|
+
class="scrubber"
|
|
88
|
+
@mousedown=${this.boundHandleMouseDown}
|
|
89
|
+
>
|
|
90
|
+
<div class="progress" style="width: ${displayProgress * 100}%"></div>
|
|
91
|
+
<div class="handle" style="left: ${displayProgress * 100}%"></div>
|
|
92
|
+
</div>
|
|
93
|
+
`;
|
|
94
|
+
}
|
|
95
|
+
connectedCallback() {
|
|
96
|
+
super.connectedCallback();
|
|
97
|
+
window.addEventListener("mouseup", this.boundHandleMouseUp);
|
|
98
|
+
window.addEventListener("mousemove", this.boundHandleMouseMove);
|
|
99
|
+
if (this.context) this.context.addEventListener("timeupdate", (e) => {
|
|
100
|
+
this.lastTimeUpdateProgress = e.detail.progress;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
disconnectedCallback() {
|
|
104
|
+
super.disconnectedCallback();
|
|
105
|
+
window.removeEventListener("mouseup", this.boundHandleMouseUp);
|
|
106
|
+
window.removeEventListener("mousemove", this.boundHandleMouseMove);
|
|
107
|
+
}
|
|
142
108
|
};
|
|
109
|
+
_decorate([consume({
|
|
110
|
+
context: efContext,
|
|
111
|
+
subscribe: true
|
|
112
|
+
})], EFScrubber.prototype, "context", void 0);
|
|
113
|
+
_decorate([consume({
|
|
114
|
+
context: playingContext,
|
|
115
|
+
subscribe: true
|
|
116
|
+
})], EFScrubber.prototype, "playing", void 0);
|
|
117
|
+
_decorate([state()], EFScrubber.prototype, "lastTimeUpdateProgress", void 0);
|
|
118
|
+
_decorate([state()], EFScrubber.prototype, "scrubProgress", void 0);
|
|
119
|
+
_decorate([state()], EFScrubber.prototype, "isDragging", void 0);
|
|
120
|
+
EFScrubber = _decorate([customElement("ef-scrubber")], EFScrubber);
|
|
121
|
+
export { EFScrubber };
|