@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/EFFilmstrip.js
CHANGED
|
@@ -1,111 +1,84 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { EFAudio } from "../elements/EFAudio.js";
|
|
7
|
-
import { EFCaptions, EFCaptionsActiveWord } from "../elements/EFCaptions.js";
|
|
8
|
-
import { EFImage } from "../elements/EFImage.js";
|
|
1
|
+
import { focusContext } from "./focusContext.js";
|
|
2
|
+
import { focusedElementContext } from "./focusedElementContext.js";
|
|
3
|
+
import { loopContext, playingContext } from "./playingContext.js";
|
|
4
|
+
import { targetTimegroupContext } from "./ContextMixin.js";
|
|
5
|
+
import { TimegroupController } from "../elements/TimegroupController.js";
|
|
9
6
|
import { EFTimegroup } from "../elements/EFTimegroup.js";
|
|
7
|
+
import { EFImage } from "../elements/EFImage.js";
|
|
8
|
+
import { EFAudio } from "../elements/EFAudio.js";
|
|
9
|
+
import { TWMixin } from "./TWMixin2.js";
|
|
10
10
|
import { EFVideo } from "../elements/EFVideo.js";
|
|
11
|
+
import { EFCaptions, EFCaptionsActiveWord } from "../elements/EFCaptions.js";
|
|
11
12
|
import { EFWaveform } from "../elements/EFWaveform.js";
|
|
12
|
-
import { TimegroupController } from "../elements/TimegroupController.js";
|
|
13
13
|
import { msToTimeCode } from "../msToTimeCode.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
14
|
+
import { consume } from "@lit/context";
|
|
15
|
+
import { LitElement, css, html, nothing } from "lit";
|
|
16
|
+
import { customElement, eventOptions, property, state } from "lit/decorators.js";
|
|
17
|
+
import _decorate from "@oxc-project/runtime/helpers/decorate";
|
|
18
|
+
import { createRef, ref } from "lit/directives/ref.js";
|
|
19
|
+
import { styleMap } from "lit/directives/style-map.js";
|
|
20
|
+
var ElementFilmstripController = class {
|
|
21
|
+
constructor(host, filmstrip) {
|
|
22
|
+
this.host = host;
|
|
23
|
+
this.filmstrip = filmstrip;
|
|
24
|
+
this.host.addController(this);
|
|
25
|
+
}
|
|
26
|
+
remove() {
|
|
27
|
+
this.host.removeController(this);
|
|
28
|
+
}
|
|
29
|
+
hostDisconnected() {
|
|
30
|
+
this.host.removeController(this);
|
|
31
|
+
}
|
|
32
|
+
hostUpdated() {
|
|
33
|
+
this.filmstrip.requestUpdate();
|
|
34
|
+
}
|
|
31
35
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
class ElementFilmstripController {
|
|
38
|
-
constructor(host, filmstrip) {
|
|
39
|
-
this.host = host;
|
|
40
|
-
this.filmstrip = filmstrip;
|
|
41
|
-
this.host.addController(this);
|
|
42
|
-
}
|
|
43
|
-
remove() {
|
|
44
|
-
this.host.removeController(this);
|
|
45
|
-
}
|
|
46
|
-
hostDisconnected() {
|
|
47
|
-
this.host.removeController(this);
|
|
48
|
-
}
|
|
49
|
-
hostUpdated() {
|
|
50
|
-
this.filmstrip.requestUpdate();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
const CommonEffectKeys = /* @__PURE__ */ new Set([
|
|
54
|
-
"offset",
|
|
55
|
-
"easing",
|
|
56
|
-
"composite",
|
|
57
|
-
"computedOffset"
|
|
36
|
+
const CommonEffectKeys = new Set([
|
|
37
|
+
"offset",
|
|
38
|
+
"easing",
|
|
39
|
+
"composite",
|
|
40
|
+
"computedOffset"
|
|
58
41
|
]);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
css`
|
|
42
|
+
var FilmstripItem = class extends TWMixin(LitElement) {
|
|
43
|
+
constructor(..._args) {
|
|
44
|
+
super(..._args);
|
|
45
|
+
this.element = new EFTimegroup();
|
|
46
|
+
this.pixelsPerMs = .04;
|
|
47
|
+
}
|
|
48
|
+
static {
|
|
49
|
+
this.styles = [css`
|
|
68
50
|
:host {
|
|
69
51
|
display: block;
|
|
70
52
|
}
|
|
71
|
-
`
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
left: `${this.pixelsPerMs * this.element.sourceStartMs}px`
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
render() {
|
|
95
|
-
return html`<div style=${styleMap(this.gutterStyles)}>
|
|
53
|
+
`];
|
|
54
|
+
}
|
|
55
|
+
get isFocused() {
|
|
56
|
+
return this.element && this.focusContext?.focusedElement === this.element;
|
|
57
|
+
}
|
|
58
|
+
get gutterStyles() {
|
|
59
|
+
return {
|
|
60
|
+
position: "relative",
|
|
61
|
+
left: `${this.pixelsPerMs * (this.element.startTimeWithinParentMs - this.element.sourceStartMs)}px`,
|
|
62
|
+
width: `${this.pixelsPerMs * (this.element.intrinsicDurationMs ?? this.element.durationMs)}px`
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
get trimPortionStyles() {
|
|
66
|
+
return {
|
|
67
|
+
width: `${this.pixelsPerMs * this.element.durationMs}px`,
|
|
68
|
+
left: `${this.pixelsPerMs * this.element.sourceStartMs}px`
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
render() {
|
|
72
|
+
return html`<div style=${styleMap(this.gutterStyles)}>
|
|
96
73
|
<div
|
|
97
74
|
class="bg-slate-300"
|
|
98
75
|
?data-focused=${this.isFocused}
|
|
99
76
|
@mouseenter=${() => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
}}
|
|
77
|
+
if (this.focusContext) this.focusContext.focusedElement = this.element;
|
|
78
|
+
}}
|
|
104
79
|
@mouseleave=${() => {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
}}
|
|
80
|
+
if (this.focusContext) this.focusContext.focusedElement = null;
|
|
81
|
+
}}
|
|
109
82
|
>
|
|
110
83
|
<div
|
|
111
84
|
?data-focused=${this.isFocused}
|
|
@@ -117,168 +90,133 @@ class FilmstripItem extends TWMixin(LitElement) {
|
|
|
117
90
|
</div>
|
|
118
91
|
${this.renderChildren()}
|
|
119
92
|
</div>`;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
const keyframes = effect.getKeyframes();
|
|
143
|
-
const firstKeyframe = keyframes[0];
|
|
144
|
-
if (!firstKeyframe) {
|
|
145
|
-
return nothing;
|
|
146
|
-
}
|
|
147
|
-
const properties = new Set(Object.keys(firstKeyframe));
|
|
148
|
-
for (const key of CommonEffectKeys) {
|
|
149
|
-
properties.delete(key);
|
|
150
|
-
}
|
|
151
|
-
return html`<div
|
|
93
|
+
}
|
|
94
|
+
renderChildren() {
|
|
95
|
+
return renderFilmstripChildren(Array.from(this.element.children), this.pixelsPerMs);
|
|
96
|
+
}
|
|
97
|
+
contents() {
|
|
98
|
+
return html``;
|
|
99
|
+
}
|
|
100
|
+
animations() {
|
|
101
|
+
const animations = this.element.getAnimations();
|
|
102
|
+
return animations.map((animation) => {
|
|
103
|
+
const effect = animation.effect;
|
|
104
|
+
if (!(effect instanceof KeyframeEffect)) return nothing;
|
|
105
|
+
const start = effect.getTiming().delay ?? 0;
|
|
106
|
+
const duration = effect.getTiming().duration;
|
|
107
|
+
if (duration === null) return nothing;
|
|
108
|
+
const keyframes = effect.getKeyframes();
|
|
109
|
+
const firstKeyframe = keyframes[0];
|
|
110
|
+
if (!firstKeyframe) return nothing;
|
|
111
|
+
const properties = new Set(Object.keys(firstKeyframe));
|
|
112
|
+
for (const key of CommonEffectKeys) properties.delete(key);
|
|
113
|
+
return html`<div
|
|
152
114
|
class="relative h-[5px] bg-blue-500 opacity-50"
|
|
153
115
|
label="animation"
|
|
154
116
|
style=${styleMap({
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
117
|
+
left: `${this.pixelsPerMs * start}px`,
|
|
118
|
+
width: `${this.pixelsPerMs * Number(duration)}px`
|
|
119
|
+
})}
|
|
158
120
|
>
|
|
159
121
|
<!-- <div class="text-nowrap">${Array.from(properties).join(" ")}</div> -->
|
|
160
122
|
${effect.getKeyframes().map((keyframe) => {
|
|
161
|
-
|
|
123
|
+
return html`<div
|
|
162
124
|
class="absolute top-0 h-full w-1 bg-red-500"
|
|
163
|
-
style=${styleMap({
|
|
164
|
-
left: `${this.pixelsPerMs * keyframe.computedOffset * Number(duration)}px`
|
|
165
|
-
})}
|
|
125
|
+
style=${styleMap({ left: `${this.pixelsPerMs * keyframe.computedOffset * Number(duration)}px` })}
|
|
166
126
|
></div>`;
|
|
167
|
-
|
|
127
|
+
})}
|
|
168
128
|
</div>`;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
super.update(changedProperties);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
__decorateClass([
|
|
183
|
-
consume({ context: focusContext, subscribe: true })
|
|
184
|
-
], FilmstripItem.prototype, "focusContext", 2);
|
|
185
|
-
__decorateClass([
|
|
186
|
-
consume({ context: focusedElementContext, subscribe: true })
|
|
187
|
-
], FilmstripItem.prototype, "focusedElement", 2);
|
|
188
|
-
__decorateClass([
|
|
189
|
-
property({ type: Object, attribute: false })
|
|
190
|
-
], FilmstripItem.prototype, "element", 2);
|
|
191
|
-
__decorateClass([
|
|
192
|
-
property({ type: Number })
|
|
193
|
-
], FilmstripItem.prototype, "pixelsPerMs", 2);
|
|
194
|
-
let EFAudioFilmstrip = class extends FilmstripItem {
|
|
195
|
-
contents() {
|
|
196
|
-
return html``;
|
|
197
|
-
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
update(changedProperties) {
|
|
132
|
+
if (changedProperties.has("element") && this.element instanceof LitElement) {
|
|
133
|
+
this.filmstripController?.remove();
|
|
134
|
+
this.filmstripController = new ElementFilmstripController(this.element, this);
|
|
135
|
+
}
|
|
136
|
+
super.update(changedProperties);
|
|
137
|
+
}
|
|
198
138
|
};
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
139
|
+
_decorate([consume({
|
|
140
|
+
context: focusContext,
|
|
141
|
+
subscribe: true
|
|
142
|
+
})], FilmstripItem.prototype, "focusContext", void 0);
|
|
143
|
+
_decorate([consume({
|
|
144
|
+
context: focusedElementContext,
|
|
145
|
+
subscribe: true
|
|
146
|
+
})], FilmstripItem.prototype, "focusedElement", void 0);
|
|
147
|
+
_decorate([property({
|
|
148
|
+
type: Object,
|
|
149
|
+
attribute: false
|
|
150
|
+
})], FilmstripItem.prototype, "element", void 0);
|
|
151
|
+
_decorate([property({ type: Number })], FilmstripItem.prototype, "pixelsPerMs", void 0);
|
|
152
|
+
let EFAudioFilmstrip = class EFAudioFilmstrip$1 extends FilmstripItem {
|
|
153
|
+
contents() {
|
|
154
|
+
return html``;
|
|
155
|
+
}
|
|
206
156
|
};
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
return html` 📝 `;
|
|
213
|
-
}
|
|
157
|
+
EFAudioFilmstrip = _decorate([customElement("ef-audio-filmstrip")], EFAudioFilmstrip);
|
|
158
|
+
let EFVideoFilmstrip = class EFVideoFilmstrip$1 extends FilmstripItem {
|
|
159
|
+
contents() {
|
|
160
|
+
return html` 📼 `;
|
|
161
|
+
}
|
|
214
162
|
};
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
return html` 🌊 `;
|
|
221
|
-
}
|
|
222
|
-
renderChildren() {
|
|
223
|
-
return nothing;
|
|
224
|
-
}
|
|
163
|
+
EFVideoFilmstrip = _decorate([customElement("ef-video-filmstrip")], EFVideoFilmstrip);
|
|
164
|
+
let EFCaptionsFilmstrip = class EFCaptionsFilmstrip$1 extends FilmstripItem {
|
|
165
|
+
contents() {
|
|
166
|
+
return html` 📝 `;
|
|
167
|
+
}
|
|
225
168
|
};
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
169
|
+
EFCaptionsFilmstrip = _decorate([customElement("ef-captions-filmstrip")], EFCaptionsFilmstrip);
|
|
170
|
+
let EFWaveformFilmstrip = class EFWaveformFilmstrip$1 extends FilmstripItem {
|
|
171
|
+
contents() {
|
|
172
|
+
return html` 🌊 `;
|
|
173
|
+
}
|
|
174
|
+
renderChildren() {
|
|
175
|
+
return nothing;
|
|
176
|
+
}
|
|
233
177
|
};
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
178
|
+
EFWaveformFilmstrip = _decorate([customElement("ef-waveform-filmstrip")], EFWaveformFilmstrip);
|
|
179
|
+
let EFImageFilmstrip = class EFImageFilmstrip$1 extends FilmstripItem {
|
|
180
|
+
contents() {
|
|
181
|
+
return html` 🖼️ `;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
EFImageFilmstrip = _decorate([customElement("ef-image-filmstrip")], EFImageFilmstrip);
|
|
185
|
+
let EFTimegroupFilmstrip = class EFTimegroupFilmstrip$1 extends FilmstripItem {
|
|
186
|
+
contents() {
|
|
187
|
+
return html`
|
|
240
188
|
<span>TIME GROUP</span>
|
|
241
|
-
${renderFilmstripChildren(
|
|
242
|
-
Array.from(this.element.children || []),
|
|
243
|
-
this.pixelsPerMs
|
|
244
|
-
)}
|
|
189
|
+
${renderFilmstripChildren(Array.from(this.element.children || []), this.pixelsPerMs)}
|
|
245
190
|
</div>
|
|
246
191
|
`;
|
|
247
|
-
|
|
192
|
+
}
|
|
248
193
|
};
|
|
249
|
-
EFTimegroupFilmstrip =
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
contents() {
|
|
254
|
-
return html`
|
|
194
|
+
EFTimegroupFilmstrip = _decorate([customElement("ef-timegroup-filmstrip")], EFTimegroupFilmstrip);
|
|
195
|
+
let EFHTMLFilmstrip = class EFHTMLFilmstrip$1 extends FilmstripItem {
|
|
196
|
+
contents() {
|
|
197
|
+
return html`
|
|
255
198
|
<span>${this.element.tagName}</span>
|
|
256
|
-
${renderFilmstripChildren(
|
|
257
|
-
Array.from(this.element.children || []),
|
|
258
|
-
this.pixelsPerMs
|
|
259
|
-
)}
|
|
199
|
+
${renderFilmstripChildren(Array.from(this.element.children || []), this.pixelsPerMs)}
|
|
260
200
|
`;
|
|
261
|
-
|
|
201
|
+
}
|
|
262
202
|
};
|
|
263
|
-
EFHTMLFilmstrip =
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
render() {
|
|
281
|
-
return html`
|
|
203
|
+
EFHTMLFilmstrip = _decorate([customElement("ef-html-filmstrip")], EFHTMLFilmstrip);
|
|
204
|
+
let EFHierarchyItem = class EFHierarchyItem$1 extends TWMixin(LitElement) {
|
|
205
|
+
constructor(..._args2) {
|
|
206
|
+
super(..._args2);
|
|
207
|
+
this.element = new EFTimegroup();
|
|
208
|
+
}
|
|
209
|
+
get icon() {
|
|
210
|
+
return "📼";
|
|
211
|
+
}
|
|
212
|
+
get isFocused() {
|
|
213
|
+
return this.element && this.focusContext?.focusedElement === this.element;
|
|
214
|
+
}
|
|
215
|
+
displayLabel() {
|
|
216
|
+
return nothing;
|
|
217
|
+
}
|
|
218
|
+
render() {
|
|
219
|
+
return html`
|
|
282
220
|
<div>
|
|
283
221
|
<div
|
|
284
222
|
class="peer
|
|
@@ -286,15 +224,11 @@ let EFHierarchyItem = class extends TWMixin(LitElement) {
|
|
|
286
224
|
bg-slate-200 pl-2 text-xs font-mono hover:bg-slate-400 data-[focused]:bg-slate-400"
|
|
287
225
|
?data-focused=${this.isFocused}
|
|
288
226
|
@mouseenter=${() => {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
}
|
|
292
|
-
}}
|
|
227
|
+
if (this.focusContext) this.focusContext.focusedElement = this.element;
|
|
228
|
+
}}
|
|
293
229
|
@mouseleave=${() => {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
}}
|
|
230
|
+
if (this.focusContext) this.focusContext.focusedElement = null;
|
|
231
|
+
}}
|
|
298
232
|
>
|
|
299
233
|
${this.icon} ${this.displayLabel()}
|
|
300
234
|
</div>
|
|
@@ -304,328 +238,273 @@ let EFHierarchyItem = class extends TWMixin(LitElement) {
|
|
|
304
238
|
${this.renderChildren()}
|
|
305
239
|
</div>
|
|
306
240
|
</div>`;
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
241
|
+
}
|
|
242
|
+
renderChildren() {
|
|
243
|
+
return renderHierarchyChildren(Array.from(this.element.children));
|
|
244
|
+
}
|
|
311
245
|
};
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
], EFHierarchyItem.prototype, "focusedElement",
|
|
321
|
-
EFHierarchyItem =
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
return this.element.mode ?? "(no mode)";
|
|
330
|
-
}
|
|
246
|
+
_decorate([property({
|
|
247
|
+
type: Object,
|
|
248
|
+
attribute: false
|
|
249
|
+
})], EFHierarchyItem.prototype, "element", void 0);
|
|
250
|
+
_decorate([consume({ context: focusContext })], EFHierarchyItem.prototype, "focusContext", void 0);
|
|
251
|
+
_decorate([consume({
|
|
252
|
+
context: focusedElementContext,
|
|
253
|
+
subscribe: true
|
|
254
|
+
})], EFHierarchyItem.prototype, "focusedElement", void 0);
|
|
255
|
+
EFHierarchyItem = _decorate([customElement("ef-hierarchy-item")], EFHierarchyItem);
|
|
256
|
+
let EFTimegroupHierarchyItem = class EFTimegroupHierarchyItem$1 extends EFHierarchyItem {
|
|
257
|
+
get icon() {
|
|
258
|
+
return "🕒";
|
|
259
|
+
}
|
|
260
|
+
displayLabel() {
|
|
261
|
+
return this.element.mode ?? "(no mode)";
|
|
262
|
+
}
|
|
331
263
|
};
|
|
332
|
-
EFTimegroupHierarchyItem =
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
return this.element.src ?? "(no src)";
|
|
341
|
-
}
|
|
264
|
+
EFTimegroupHierarchyItem = _decorate([customElement("ef-timegroup-hierarchy-item")], EFTimegroupHierarchyItem);
|
|
265
|
+
let EFAudioHierarchyItem = class EFAudioHierarchyItem$1 extends EFHierarchyItem {
|
|
266
|
+
get icon() {
|
|
267
|
+
return "🔊";
|
|
268
|
+
}
|
|
269
|
+
displayLabel() {
|
|
270
|
+
return this.element.src ?? "(no src)";
|
|
271
|
+
}
|
|
342
272
|
};
|
|
343
|
-
EFAudioHierarchyItem =
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
return this.element.src ?? "(no src)";
|
|
352
|
-
}
|
|
273
|
+
EFAudioHierarchyItem = _decorate([customElement("ef-audio-hierarchy-item")], EFAudioHierarchyItem);
|
|
274
|
+
let EFVideoHierarchyItem = class EFVideoHierarchyItem$1 extends EFHierarchyItem {
|
|
275
|
+
get icon() {
|
|
276
|
+
return "📼";
|
|
277
|
+
}
|
|
278
|
+
displayLabel() {
|
|
279
|
+
return this.element.src ?? "(no src)";
|
|
280
|
+
}
|
|
353
281
|
};
|
|
354
|
-
EFVideoHierarchyItem =
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
return "📝 Captions";
|
|
360
|
-
}
|
|
282
|
+
EFVideoHierarchyItem = _decorate([customElement("ef-video-hierarchy-item")], EFVideoHierarchyItem);
|
|
283
|
+
let EFCaptionsHierarchyItem = class EFCaptionsHierarchyItem$1 extends EFHierarchyItem {
|
|
284
|
+
get icon() {
|
|
285
|
+
return "📝 Captions";
|
|
286
|
+
}
|
|
361
287
|
};
|
|
362
|
-
EFCaptionsHierarchyItem =
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
return "🗣️ Active Word";
|
|
368
|
-
}
|
|
288
|
+
EFCaptionsHierarchyItem = _decorate([customElement("ef-captions-hierarchy-item")], EFCaptionsHierarchyItem);
|
|
289
|
+
let EFCaptionsActiveWordHierarchyItem = class EFCaptionsActiveWordHierarchyItem$1 extends EFHierarchyItem {
|
|
290
|
+
get icon() {
|
|
291
|
+
return "🗣️ Active Word";
|
|
292
|
+
}
|
|
369
293
|
};
|
|
370
|
-
EFCaptionsActiveWordHierarchyItem =
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
return nothing;
|
|
379
|
-
}
|
|
294
|
+
EFCaptionsActiveWordHierarchyItem = _decorate([customElement("ef-captions-active-word-hierarchy-item")], EFCaptionsActiveWordHierarchyItem);
|
|
295
|
+
let EFWaveformHierarchyItem = class EFWaveformHierarchyItem$1 extends EFHierarchyItem {
|
|
296
|
+
get icon() {
|
|
297
|
+
return "🌊";
|
|
298
|
+
}
|
|
299
|
+
renderChildren() {
|
|
300
|
+
return nothing;
|
|
301
|
+
}
|
|
380
302
|
};
|
|
381
|
-
EFWaveformHierarchyItem =
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
return this.element.src ?? "(no src)";
|
|
390
|
-
}
|
|
303
|
+
EFWaveformHierarchyItem = _decorate([customElement("ef-waveform-hierarchy-item")], EFWaveformHierarchyItem);
|
|
304
|
+
let EFImageHierarchyItem = class EFImageHierarchyItem$1 extends EFHierarchyItem {
|
|
305
|
+
get icon() {
|
|
306
|
+
return "🖼️";
|
|
307
|
+
}
|
|
308
|
+
displayLabel() {
|
|
309
|
+
return this.element.src ?? "(no src)";
|
|
310
|
+
}
|
|
391
311
|
};
|
|
392
|
-
EFImageHierarchyItem =
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
return html`<code>${`<${this.element.tagName.toLowerCase()}>`}</code>`;
|
|
398
|
-
}
|
|
312
|
+
EFImageHierarchyItem = _decorate([customElement("ef-image-hierarchy-item")], EFImageHierarchyItem);
|
|
313
|
+
let EFHTMLHierarchyItem = class EFHTMLHierarchyItem$1 extends EFHierarchyItem {
|
|
314
|
+
get icon() {
|
|
315
|
+
return html`<code>${`<${this.element.tagName.toLowerCase()}>`}</code>`;
|
|
316
|
+
}
|
|
399
317
|
};
|
|
400
|
-
EFHTMLHierarchyItem =
|
|
401
|
-
customElement("ef-html-hierarchy-item")
|
|
402
|
-
], EFHTMLHierarchyItem);
|
|
318
|
+
EFHTMLHierarchyItem = _decorate([customElement("ef-html-hierarchy-item")], EFHTMLHierarchyItem);
|
|
403
319
|
const renderHierarchyChildren = (children) => {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
}
|
|
408
|
-
if (child instanceof EFTimegroup) {
|
|
409
|
-
return html`<ef-timegroup-hierarchy-item
|
|
320
|
+
return children.map((child) => {
|
|
321
|
+
if (child instanceof HTMLElement && child.dataset?.efHidden) return nothing;
|
|
322
|
+
if (child instanceof EFTimegroup) return html`<ef-timegroup-hierarchy-item
|
|
410
323
|
.element=${child}
|
|
411
324
|
></ef-timegroup-hierarchy-item>`;
|
|
412
|
-
|
|
413
|
-
if (child instanceof EFImage) {
|
|
414
|
-
return html`<ef-image-hierarchy-item
|
|
325
|
+
if (child instanceof EFImage) return html`<ef-image-hierarchy-item
|
|
415
326
|
.element=${child}
|
|
416
327
|
></ef-image-hierarchy-item>`;
|
|
417
|
-
|
|
418
|
-
if (child instanceof EFAudio) {
|
|
419
|
-
return html`<ef-audio-hierarchy-item
|
|
328
|
+
if (child instanceof EFAudio) return html`<ef-audio-hierarchy-item
|
|
420
329
|
.element=${child}
|
|
421
330
|
></ef-audio-hierarchy-item>`;
|
|
422
|
-
|
|
423
|
-
if (child instanceof EFVideo) {
|
|
424
|
-
return html`<ef-video-hierarchy-item
|
|
331
|
+
if (child instanceof EFVideo) return html`<ef-video-hierarchy-item
|
|
425
332
|
.element=${child}
|
|
426
333
|
></ef-video-hierarchy-item>`;
|
|
427
|
-
|
|
428
|
-
if (child instanceof EFCaptions) {
|
|
429
|
-
return html`<ef-captions-hierarchy-item
|
|
334
|
+
if (child instanceof EFCaptions) return html`<ef-captions-hierarchy-item
|
|
430
335
|
.element=${child}
|
|
431
336
|
></ef-captions-hierarchy-item>`;
|
|
432
|
-
|
|
433
|
-
if (child instanceof EFCaptionsActiveWord) {
|
|
434
|
-
return html`<ef-captions-active-word-hierarchy-item
|
|
337
|
+
if (child instanceof EFCaptionsActiveWord) return html`<ef-captions-active-word-hierarchy-item
|
|
435
338
|
.element=${child}
|
|
436
339
|
></ef-captions-active-word-hierarchy-item>`;
|
|
437
|
-
|
|
438
|
-
if (child instanceof EFWaveform) {
|
|
439
|
-
return html`<ef-waveform-hierarchy-item
|
|
340
|
+
if (child instanceof EFWaveform) return html`<ef-waveform-hierarchy-item
|
|
440
341
|
.element=${child}
|
|
441
342
|
></ef-waveform-hierarchy-item>`;
|
|
442
|
-
|
|
443
|
-
return html`<ef-html-hierarchy-item
|
|
343
|
+
return html`<ef-html-hierarchy-item
|
|
444
344
|
.element=${child}
|
|
445
345
|
></ef-html-hierarchy-item>`;
|
|
446
|
-
|
|
346
|
+
});
|
|
447
347
|
};
|
|
448
348
|
const renderFilmstripChildren = (children, pixelsPerMs) => {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
}
|
|
453
|
-
if (child instanceof EFTimegroup) {
|
|
454
|
-
return html`<ef-timegroup-filmstrip
|
|
349
|
+
return children.map((child) => {
|
|
350
|
+
if (child instanceof HTMLElement && child.dataset?.efHidden) return nothing;
|
|
351
|
+
if (child instanceof EFTimegroup) return html`<ef-timegroup-filmstrip
|
|
455
352
|
.element=${child}
|
|
456
353
|
.pixelsPerMs=${pixelsPerMs}
|
|
457
354
|
>
|
|
458
355
|
</ef-timegroup-filmstrip>`;
|
|
459
|
-
|
|
460
|
-
if (child instanceof EFImage) {
|
|
461
|
-
return html`<ef-image-filmstrip
|
|
356
|
+
if (child instanceof EFImage) return html`<ef-image-filmstrip
|
|
462
357
|
.element=${child}
|
|
463
358
|
.pixelsPerMs=${pixelsPerMs}
|
|
464
359
|
></ef-image-filmstrip>`;
|
|
465
|
-
|
|
466
|
-
if (child instanceof EFAudio) {
|
|
467
|
-
return html`<ef-audio-filmstrip
|
|
360
|
+
if (child instanceof EFAudio) return html`<ef-audio-filmstrip
|
|
468
361
|
.element=${child}
|
|
469
362
|
.pixelsPerMs=${pixelsPerMs}
|
|
470
363
|
></ef-audio-filmstrip>`;
|
|
471
|
-
|
|
472
|
-
if (child instanceof EFVideo) {
|
|
473
|
-
return html`<ef-video-filmstrip
|
|
364
|
+
if (child instanceof EFVideo) return html`<ef-video-filmstrip
|
|
474
365
|
.element=${child}
|
|
475
366
|
.pixelsPerMs=${pixelsPerMs}
|
|
476
367
|
></ef-video-filmstrip>`;
|
|
477
|
-
|
|
478
|
-
if (child instanceof EFCaptions) {
|
|
479
|
-
return html`<ef-captions-filmstrip
|
|
368
|
+
if (child instanceof EFCaptions) return html`<ef-captions-filmstrip
|
|
480
369
|
.element=${child}
|
|
481
370
|
.pixelsPerMs=${pixelsPerMs}
|
|
482
371
|
></ef-captions-filmstrip>`;
|
|
483
|
-
|
|
484
|
-
if (child instanceof EFWaveform) {
|
|
485
|
-
return html`<ef-waveform-filmstrip
|
|
372
|
+
if (child instanceof EFWaveform) return html`<ef-waveform-filmstrip
|
|
486
373
|
.element=${child}
|
|
487
374
|
.pixelsPerMs=${pixelsPerMs}
|
|
488
375
|
></ef-waveform-filmstrip>`;
|
|
489
|
-
|
|
490
|
-
return html`<ef-html-filmstrip
|
|
376
|
+
return html`<ef-html-filmstrip
|
|
491
377
|
.element=${child}
|
|
492
378
|
.pixelsPerMs=${pixelsPerMs}
|
|
493
379
|
></ef-html-filmstrip>`;
|
|
494
|
-
|
|
380
|
+
});
|
|
495
381
|
};
|
|
496
|
-
let EFFilmstrip = class extends TWMixin(LitElement) {
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
return;
|
|
519
|
-
}
|
|
520
|
-
event.preventDefault();
|
|
521
|
-
if (__privateGet(this, _EFFilmstrip_instances, contextElement_get)) {
|
|
522
|
-
__privateGet(this, _EFFilmstrip_instances, contextElement_get).playing = !__privateGet(this, _EFFilmstrip_instances, contextElement_get).playing;
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
});
|
|
526
|
-
this.gutterRef = createRef();
|
|
527
|
-
this.hierarchyRef = createRef();
|
|
528
|
-
this.playheadRef = createRef();
|
|
529
|
-
}
|
|
530
|
-
connectedCallback() {
|
|
531
|
-
super.connectedCallback();
|
|
532
|
-
__privateMethod(this, _EFFilmstrip_instances, bindToTargetTimegroup_fn).call(this);
|
|
533
|
-
window.addEventListener("keypress", __privateGet(this, _handleKeyPress));
|
|
534
|
-
this.resizeObserver.observe(this);
|
|
535
|
-
}
|
|
536
|
-
disconnectedCallback() {
|
|
537
|
-
super.disconnectedCallback();
|
|
538
|
-
window.removeEventListener("keypress", __privateGet(this, _handleKeyPress));
|
|
539
|
-
this.resizeObserver.disconnect();
|
|
540
|
-
}
|
|
541
|
-
updatePixelsPerMs() {
|
|
542
|
-
const target = this.targetTimegroup;
|
|
543
|
-
const gutter = this.gutterRef.value;
|
|
544
|
-
if (target && gutter && gutter.clientWidth > 0) {
|
|
545
|
-
this.pixelsPerMs = gutter.clientWidth / (target.durationMs || 1);
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
syncGutterScroll() {
|
|
549
|
-
if (this.gutter && this.hierarchyRef.value) {
|
|
550
|
-
this.hierarchyRef.value.scrollTop = this.gutter.scrollTop;
|
|
551
|
-
this.timelineScrolltop = this.gutter.scrollTop;
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
syncHierarchyScroll() {
|
|
555
|
-
if (this.gutter && this.hierarchyRef.value) {
|
|
556
|
-
this.gutter.scrollTop = this.hierarchyRef.value.scrollTop;
|
|
557
|
-
this.timelineScrolltop = this.hierarchyRef.value.scrollTop;
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
scrub(e) {
|
|
561
|
-
if (this.playing) {
|
|
562
|
-
return;
|
|
563
|
-
}
|
|
564
|
-
if (!this.scrubbing) {
|
|
565
|
-
return;
|
|
566
|
-
}
|
|
567
|
-
const gutter = this.shadowRoot?.querySelector("#gutter");
|
|
568
|
-
if (!gutter) {
|
|
569
|
-
return;
|
|
570
|
-
}
|
|
571
|
-
const rect = gutter.getBoundingClientRect();
|
|
572
|
-
if (this.targetTimegroup) {
|
|
573
|
-
const layerX = e.pageX - rect.left + gutter.scrollLeft;
|
|
574
|
-
this.targetTimegroup.currentTimeMs = layerX / this.pixelsPerMs;
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
startScrub(e) {
|
|
578
|
-
e.preventDefault();
|
|
579
|
-
this.scrubbing = true;
|
|
580
|
-
queueMicrotask(() => {
|
|
581
|
-
const gutter = this.shadowRoot?.querySelector("#gutter");
|
|
582
|
-
if (!gutter) {
|
|
583
|
-
return;
|
|
584
|
-
}
|
|
585
|
-
const rect = gutter.getBoundingClientRect();
|
|
586
|
-
if (this.targetTimegroup) {
|
|
587
|
-
const layerX = e.pageX - rect.left + gutter.scrollLeft;
|
|
588
|
-
this.targetTimegroup.currentTimeMs = layerX / this.pixelsPerMs;
|
|
589
|
-
}
|
|
590
|
-
});
|
|
591
|
-
addEventListener(
|
|
592
|
-
"mouseup",
|
|
593
|
-
() => {
|
|
594
|
-
this.scrubbing = false;
|
|
595
|
-
},
|
|
596
|
-
{ once: true }
|
|
597
|
-
);
|
|
598
|
-
}
|
|
599
|
-
scrollScrub(e) {
|
|
600
|
-
if (this.targetTimegroup && this.gutter && !this.playing) {
|
|
601
|
-
if (e.deltaX !== 0) {
|
|
602
|
-
e.preventDefault();
|
|
603
|
-
}
|
|
604
|
-
if (this.gutterRef.value && this.gutterRef.value.scrollLeft === 0 && e.deltaX < 0) {
|
|
605
|
-
this.gutter.scrollBy(0, e.deltaY);
|
|
606
|
-
return;
|
|
607
|
-
}
|
|
608
|
-
if (this.gutter.scrollWidth - this.gutter.scrollLeft === this.gutter.clientWidth && e.deltaX > 0) {
|
|
609
|
-
this.gutter.scrollBy(0, e.deltaY);
|
|
610
|
-
return;
|
|
611
|
-
}
|
|
612
|
-
if (this) {
|
|
613
|
-
this.gutter.scrollBy(e.deltaX, e.deltaY);
|
|
614
|
-
this.targetTimegroup.currentTimeMs += e.deltaX / this.pixelsPerMs;
|
|
382
|
+
let EFFilmstrip = class EFFilmstrip$1 extends TWMixin(LitElement) {
|
|
383
|
+
constructor(..._args3) {
|
|
384
|
+
super(..._args3);
|
|
385
|
+
this.pixelsPerMs = .04;
|
|
386
|
+
this.scrubbing = false;
|
|
387
|
+
this.timelineScrolltop = 0;
|
|
388
|
+
this.currentTimeMs = 0;
|
|
389
|
+
this.autoScale = false;
|
|
390
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
391
|
+
if (this.autoScale) this.updatePixelsPerMs();
|
|
392
|
+
});
|
|
393
|
+
this.gutterRef = createRef();
|
|
394
|
+
this.hierarchyRef = createRef();
|
|
395
|
+
this.playheadRef = createRef();
|
|
396
|
+
}
|
|
397
|
+
static {
|
|
398
|
+
this.styles = [css`
|
|
399
|
+
:host {
|
|
400
|
+
display: block;
|
|
401
|
+
overflow: hidden;
|
|
402
|
+
width: 100%;
|
|
403
|
+
height: 100%;
|
|
615
404
|
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
405
|
+
`];
|
|
406
|
+
}
|
|
407
|
+
connectedCallback() {
|
|
408
|
+
super.connectedCallback();
|
|
409
|
+
this.#bindToTargetTimegroup();
|
|
410
|
+
window.addEventListener("keypress", this.#handleKeyPress);
|
|
411
|
+
this.resizeObserver.observe(this);
|
|
412
|
+
}
|
|
413
|
+
disconnectedCallback() {
|
|
414
|
+
super.disconnectedCallback();
|
|
415
|
+
window.removeEventListener("keypress", this.#handleKeyPress);
|
|
416
|
+
this.resizeObserver.disconnect();
|
|
417
|
+
}
|
|
418
|
+
updatePixelsPerMs() {
|
|
419
|
+
const target = this.targetTimegroup;
|
|
420
|
+
const gutter = this.gutterRef.value;
|
|
421
|
+
if (target && gutter && gutter.clientWidth > 0) this.pixelsPerMs = gutter.clientWidth / (target.durationMs || 1);
|
|
422
|
+
}
|
|
423
|
+
#bindToTargetTimegroup() {
|
|
424
|
+
if (this.timegroupController) this.timegroupController.remove();
|
|
425
|
+
const target = this.targetTimegroup;
|
|
426
|
+
if (target) {
|
|
427
|
+
this.timegroupController = new TimegroupController(target, this);
|
|
428
|
+
this.currentTimeMs = target.currentTimeMs;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
#handleKeyPress = (event) => {
|
|
432
|
+
if (event.key === " ") {
|
|
433
|
+
const [target] = event.composedPath();
|
|
434
|
+
const interactiveSelector = "input, textarea, button, select, a, [contenteditable]";
|
|
435
|
+
const closestInteractive = target?.closest(interactiveSelector);
|
|
436
|
+
if (closestInteractive) return;
|
|
437
|
+
event.preventDefault();
|
|
438
|
+
if (this.#contextElement) this.#contextElement.playing = !this.#contextElement.playing;
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
syncGutterScroll() {
|
|
442
|
+
if (this.gutter && this.hierarchyRef.value) {
|
|
443
|
+
this.hierarchyRef.value.scrollTop = this.gutter.scrollTop;
|
|
444
|
+
this.timelineScrolltop = this.gutter.scrollTop;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
syncHierarchyScroll() {
|
|
448
|
+
if (this.gutter && this.hierarchyRef.value) {
|
|
449
|
+
this.gutter.scrollTop = this.hierarchyRef.value.scrollTop;
|
|
450
|
+
this.timelineScrolltop = this.hierarchyRef.value.scrollTop;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
scrub(e) {
|
|
454
|
+
if (this.playing) return;
|
|
455
|
+
if (!this.scrubbing) return;
|
|
456
|
+
const gutter = this.shadowRoot?.querySelector("#gutter");
|
|
457
|
+
if (!gutter) return;
|
|
458
|
+
const rect = gutter.getBoundingClientRect();
|
|
459
|
+
if (this.targetTimegroup) {
|
|
460
|
+
const layerX = e.pageX - rect.left + gutter.scrollLeft;
|
|
461
|
+
this.targetTimegroup.currentTimeMs = layerX / this.pixelsPerMs;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
startScrub(e) {
|
|
465
|
+
e.preventDefault();
|
|
466
|
+
this.scrubbing = true;
|
|
467
|
+
queueMicrotask(() => {
|
|
468
|
+
const gutter = this.shadowRoot?.querySelector("#gutter");
|
|
469
|
+
if (!gutter) return;
|
|
470
|
+
const rect = gutter.getBoundingClientRect();
|
|
471
|
+
if (this.targetTimegroup) {
|
|
472
|
+
const layerX = e.pageX - rect.left + gutter.scrollLeft;
|
|
473
|
+
this.targetTimegroup.currentTimeMs = layerX / this.pixelsPerMs;
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
addEventListener("mouseup", () => {
|
|
477
|
+
this.scrubbing = false;
|
|
478
|
+
}, { once: true });
|
|
479
|
+
}
|
|
480
|
+
scrollScrub(e) {
|
|
481
|
+
if (this.targetTimegroup && this.gutter && !this.playing) {
|
|
482
|
+
if (e.deltaX !== 0) e.preventDefault();
|
|
483
|
+
if (this.gutterRef.value && this.gutterRef.value.scrollLeft === 0 && e.deltaX < 0) {
|
|
484
|
+
this.gutter.scrollBy(0, e.deltaY);
|
|
485
|
+
return;
|
|
486
|
+
}
|
|
487
|
+
if (this.gutter.scrollWidth - this.gutter.scrollLeft === this.gutter.clientWidth && e.deltaX > 0) {
|
|
488
|
+
this.gutter.scrollBy(0, e.deltaY);
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
if (this) {
|
|
492
|
+
this.gutter.scrollBy(e.deltaX, e.deltaY);
|
|
493
|
+
this.targetTimegroup.currentTimeMs += e.deltaX / this.pixelsPerMs;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
get gutter() {
|
|
498
|
+
return this.gutterRef.value;
|
|
499
|
+
}
|
|
500
|
+
render() {
|
|
501
|
+
const target = this.targetTimegroup;
|
|
502
|
+
return html` <div
|
|
624
503
|
class="grid h-full bg-slate-100"
|
|
625
504
|
style=${styleMap({
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
505
|
+
gridTemplateColumns: "200px 1fr",
|
|
506
|
+
gridTemplateRows: "1.5rem 1fr"
|
|
507
|
+
})}
|
|
629
508
|
>
|
|
630
509
|
<div
|
|
631
510
|
class="z-20 col-span-2 border-b-slate-600 bg-slate-100 shadow shadow-slate-300"
|
|
@@ -637,9 +516,9 @@ let EFFilmstrip = class extends TWMixin(LitElement) {
|
|
|
637
516
|
max="0.1"
|
|
638
517
|
step="0.001"
|
|
639
518
|
@input=${(e) => {
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
519
|
+
const target$1 = e.target;
|
|
520
|
+
this.pixelsPerMs = Number.parseFloat(target$1.value);
|
|
521
|
+
}}
|
|
643
522
|
/>` : nothing}
|
|
644
523
|
<code>${msToTimeCode(this.currentTimeMs, true)} </code> /
|
|
645
524
|
<code>${msToTimeCode(target?.durationMs ?? 0, true)}</code>
|
|
@@ -676,9 +555,9 @@ let EFFilmstrip = class extends TWMixin(LitElement) {
|
|
|
676
555
|
<div
|
|
677
556
|
class="border-red pointer-events-none absolute z-10 h-full w-[2px] border-r-2 border-red-700"
|
|
678
557
|
style=${styleMap({
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
558
|
+
left: `${this.pixelsPerMs * this.currentTimeMs}px`,
|
|
559
|
+
top: `${this.timelineScrolltop}px`
|
|
560
|
+
})}
|
|
682
561
|
${ref(this.playheadRef)}
|
|
683
562
|
></div>
|
|
684
563
|
|
|
@@ -686,107 +565,48 @@ let EFFilmstrip = class extends TWMixin(LitElement) {
|
|
|
686
565
|
</div>
|
|
687
566
|
</div>
|
|
688
567
|
</div>`;
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
if (this.autoScale) {
|
|
705
|
-
this.updatePixelsPerMs();
|
|
706
|
-
}
|
|
707
|
-
super.willUpdate(changedProperties);
|
|
708
|
-
}
|
|
709
|
-
};
|
|
710
|
-
_EFFilmstrip_instances = /* @__PURE__ */ new WeakSet();
|
|
711
|
-
bindToTargetTimegroup_fn = function() {
|
|
712
|
-
if (this.timegroupController) {
|
|
713
|
-
this.timegroupController.remove();
|
|
714
|
-
}
|
|
715
|
-
const target = this.targetTimegroup;
|
|
716
|
-
if (target) {
|
|
717
|
-
this.timegroupController = new TimegroupController(target, this);
|
|
718
|
-
this.currentTimeMs = target.currentTimeMs;
|
|
719
|
-
}
|
|
720
|
-
};
|
|
721
|
-
_handleKeyPress = /* @__PURE__ */ new WeakMap();
|
|
722
|
-
contextElement_get = function() {
|
|
723
|
-
return this.closest("ef-workbench, ef-preview");
|
|
724
|
-
};
|
|
725
|
-
EFFilmstrip.styles = [
|
|
726
|
-
css`
|
|
727
|
-
:host {
|
|
728
|
-
display: block;
|
|
729
|
-
overflow: hidden;
|
|
730
|
-
width: 100%;
|
|
731
|
-
height: 100%;
|
|
732
|
-
}
|
|
733
|
-
`
|
|
734
|
-
];
|
|
735
|
-
__decorateClass([
|
|
736
|
-
property({ type: Number })
|
|
737
|
-
], EFFilmstrip.prototype, "pixelsPerMs", 2);
|
|
738
|
-
__decorateClass([
|
|
739
|
-
state()
|
|
740
|
-
], EFFilmstrip.prototype, "scrubbing", 2);
|
|
741
|
-
__decorateClass([
|
|
742
|
-
state()
|
|
743
|
-
], EFFilmstrip.prototype, "timelineScrolltop", 2);
|
|
744
|
-
__decorateClass([
|
|
745
|
-
consume({ context: playingContext, subscribe: true }),
|
|
746
|
-
state()
|
|
747
|
-
], EFFilmstrip.prototype, "playing", 2);
|
|
748
|
-
__decorateClass([
|
|
749
|
-
consume({ context: loopContext, subscribe: true }),
|
|
750
|
-
state()
|
|
751
|
-
], EFFilmstrip.prototype, "loop", 2);
|
|
752
|
-
__decorateClass([
|
|
753
|
-
state()
|
|
754
|
-
], EFFilmstrip.prototype, "currentTimeMs", 2);
|
|
755
|
-
__decorateClass([
|
|
756
|
-
property({ type: Boolean, reflect: true, attribute: "auto-scale" })
|
|
757
|
-
], EFFilmstrip.prototype, "autoScale", 2);
|
|
758
|
-
__decorateClass([
|
|
759
|
-
eventOptions({ passive: false })
|
|
760
|
-
], EFFilmstrip.prototype, "syncGutterScroll", 1);
|
|
761
|
-
__decorateClass([
|
|
762
|
-
eventOptions({ passive: false })
|
|
763
|
-
], EFFilmstrip.prototype, "syncHierarchyScroll", 1);
|
|
764
|
-
__decorateClass([
|
|
765
|
-
eventOptions({ capture: false })
|
|
766
|
-
], EFFilmstrip.prototype, "scrub", 1);
|
|
767
|
-
__decorateClass([
|
|
768
|
-
eventOptions({ capture: false })
|
|
769
|
-
], EFFilmstrip.prototype, "startScrub", 1);
|
|
770
|
-
__decorateClass([
|
|
771
|
-
eventOptions({ passive: false })
|
|
772
|
-
], EFFilmstrip.prototype, "scrollScrub", 1);
|
|
773
|
-
__decorateClass([
|
|
774
|
-
property({ type: String })
|
|
775
|
-
], EFFilmstrip.prototype, "target", 2);
|
|
776
|
-
__decorateClass([
|
|
777
|
-
consume({ context: targetTimegroupContext, subscribe: true }),
|
|
778
|
-
state()
|
|
779
|
-
], EFFilmstrip.prototype, "targetTimegroup", 2);
|
|
780
|
-
EFFilmstrip = __decorateClass([
|
|
781
|
-
customElement("ef-filmstrip")
|
|
782
|
-
], EFFilmstrip);
|
|
783
|
-
export {
|
|
784
|
-
EFAudioFilmstrip,
|
|
785
|
-
EFCaptionsFilmstrip,
|
|
786
|
-
EFFilmstrip,
|
|
787
|
-
EFHTMLFilmstrip,
|
|
788
|
-
EFImageFilmstrip,
|
|
789
|
-
EFTimegroupFilmstrip,
|
|
790
|
-
EFVideoFilmstrip,
|
|
791
|
-
EFWaveformFilmstrip
|
|
568
|
+
}
|
|
569
|
+
updated(changes) {
|
|
570
|
+
if (!this.targetTimegroup) return;
|
|
571
|
+
if (changes.has("currentTimeMs")) {
|
|
572
|
+
if (this.targetTimegroup.currentTimeMs !== this.currentTimeMs) this.targetTimegroup.currentTimeMs = this.currentTimeMs;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
get #contextElement() {
|
|
576
|
+
return this.closest("ef-workbench, ef-preview");
|
|
577
|
+
}
|
|
578
|
+
willUpdate(changedProperties) {
|
|
579
|
+
if (changedProperties.has("targetTimegroup")) this.#bindToTargetTimegroup();
|
|
580
|
+
if (this.autoScale) this.updatePixelsPerMs();
|
|
581
|
+
super.willUpdate(changedProperties);
|
|
582
|
+
}
|
|
792
583
|
};
|
|
584
|
+
_decorate([property({ type: Number })], EFFilmstrip.prototype, "pixelsPerMs", void 0);
|
|
585
|
+
_decorate([state()], EFFilmstrip.prototype, "scrubbing", void 0);
|
|
586
|
+
_decorate([state()], EFFilmstrip.prototype, "timelineScrolltop", void 0);
|
|
587
|
+
_decorate([consume({
|
|
588
|
+
context: playingContext,
|
|
589
|
+
subscribe: true
|
|
590
|
+
}), state()], EFFilmstrip.prototype, "playing", void 0);
|
|
591
|
+
_decorate([consume({
|
|
592
|
+
context: loopContext,
|
|
593
|
+
subscribe: true
|
|
594
|
+
}), state()], EFFilmstrip.prototype, "loop", void 0);
|
|
595
|
+
_decorate([state()], EFFilmstrip.prototype, "currentTimeMs", void 0);
|
|
596
|
+
_decorate([property({
|
|
597
|
+
type: Boolean,
|
|
598
|
+
reflect: true,
|
|
599
|
+
attribute: "auto-scale"
|
|
600
|
+
})], EFFilmstrip.prototype, "autoScale", void 0);
|
|
601
|
+
_decorate([eventOptions({ passive: false })], EFFilmstrip.prototype, "syncGutterScroll", null);
|
|
602
|
+
_decorate([eventOptions({ passive: false })], EFFilmstrip.prototype, "syncHierarchyScroll", null);
|
|
603
|
+
_decorate([eventOptions({ capture: false })], EFFilmstrip.prototype, "scrub", null);
|
|
604
|
+
_decorate([eventOptions({ capture: false })], EFFilmstrip.prototype, "startScrub", null);
|
|
605
|
+
_decorate([eventOptions({ passive: false })], EFFilmstrip.prototype, "scrollScrub", null);
|
|
606
|
+
_decorate([property({ type: String })], EFFilmstrip.prototype, "target", void 0);
|
|
607
|
+
_decorate([consume({
|
|
608
|
+
context: targetTimegroupContext,
|
|
609
|
+
subscribe: true
|
|
610
|
+
}), state()], EFFilmstrip.prototype, "targetTimegroup", void 0);
|
|
611
|
+
EFFilmstrip = _decorate([customElement("ef-filmstrip")], EFFilmstrip);
|
|
612
|
+
export { EFFilmstrip };
|