@editframe/elements 0.6.0-beta.17 → 0.6.0-beta.19
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/package.json +2 -2
- package/src/elements/EFMedia.ts +1 -1
- package/src/elements/EFTimegroup.ts +14 -6
- package/src/gui/EFFilmstrip.ts +144 -30
- package/dist/lib/av/EncodedAsset.cjs +0 -567
- package/dist/lib/av/EncodedAsset.js +0 -550
- package/dist/lib/av/MP4File.cjs +0 -182
- package/dist/lib/av/MP4File.js +0 -165
- package/dist/lib/av/msToTimeCode.cjs +0 -15
- package/dist/lib/av/msToTimeCode.js +0 -15
- package/dist/lib/util/awaitMicrotask.cjs +0 -4
- package/dist/lib/util/awaitMicrotask.js +0 -4
- package/dist/lib/util/memoize.cjs +0 -14
- package/dist/lib/util/memoize.js +0 -14
- package/dist/packages/elements/src/EF_FRAMEGEN.cjs +0 -200
- package/dist/packages/elements/src/EF_FRAMEGEN.d.ts +0 -45
- package/dist/packages/elements/src/EF_FRAMEGEN.js +0 -200
- package/dist/packages/elements/src/EF_INTERACTIVE.cjs +0 -4
- package/dist/packages/elements/src/EF_INTERACTIVE.d.ts +0 -1
- package/dist/packages/elements/src/EF_INTERACTIVE.js +0 -4
- package/dist/packages/elements/src/elements/CrossUpdateController.cjs +0 -16
- package/dist/packages/elements/src/elements/CrossUpdateController.d.ts +0 -9
- package/dist/packages/elements/src/elements/CrossUpdateController.js +0 -16
- package/dist/packages/elements/src/elements/EFAudio.cjs +0 -53
- package/dist/packages/elements/src/elements/EFAudio.d.ts +0 -10
- package/dist/packages/elements/src/elements/EFAudio.js +0 -54
- package/dist/packages/elements/src/elements/EFCaptions.cjs +0 -164
- package/dist/packages/elements/src/elements/EFCaptions.d.ts +0 -38
- package/dist/packages/elements/src/elements/EFCaptions.js +0 -166
- package/dist/packages/elements/src/elements/EFImage.cjs +0 -79
- package/dist/packages/elements/src/elements/EFImage.d.ts +0 -14
- package/dist/packages/elements/src/elements/EFImage.js +0 -80
- package/dist/packages/elements/src/elements/EFMedia.cjs +0 -334
- package/dist/packages/elements/src/elements/EFMedia.d.ts +0 -61
- package/dist/packages/elements/src/elements/EFMedia.js +0 -334
- package/dist/packages/elements/src/elements/EFSourceMixin.cjs +0 -55
- package/dist/packages/elements/src/elements/EFSourceMixin.d.ts +0 -12
- package/dist/packages/elements/src/elements/EFSourceMixin.js +0 -55
- package/dist/packages/elements/src/elements/EFTemporal.cjs +0 -198
- package/dist/packages/elements/src/elements/EFTemporal.d.ts +0 -36
- package/dist/packages/elements/src/elements/EFTemporal.js +0 -198
- package/dist/packages/elements/src/elements/EFTimegroup.browsertest.d.ts +0 -12
- package/dist/packages/elements/src/elements/EFTimegroup.cjs +0 -343
- package/dist/packages/elements/src/elements/EFTimegroup.d.ts +0 -39
- package/dist/packages/elements/src/elements/EFTimegroup.js +0 -344
- package/dist/packages/elements/src/elements/EFTimeline.cjs +0 -15
- package/dist/packages/elements/src/elements/EFTimeline.d.ts +0 -3
- package/dist/packages/elements/src/elements/EFTimeline.js +0 -15
- package/dist/packages/elements/src/elements/EFVideo.cjs +0 -109
- package/dist/packages/elements/src/elements/EFVideo.d.ts +0 -14
- package/dist/packages/elements/src/elements/EFVideo.js +0 -110
- package/dist/packages/elements/src/elements/EFWaveform.cjs +0 -235
- package/dist/packages/elements/src/elements/EFWaveform.d.ts +0 -28
- package/dist/packages/elements/src/elements/EFWaveform.js +0 -219
- package/dist/packages/elements/src/elements/FetchMixin.cjs +0 -28
- package/dist/packages/elements/src/elements/FetchMixin.d.ts +0 -8
- package/dist/packages/elements/src/elements/FetchMixin.js +0 -28
- package/dist/packages/elements/src/elements/TimegroupController.cjs +0 -20
- package/dist/packages/elements/src/elements/TimegroupController.d.ts +0 -14
- package/dist/packages/elements/src/elements/TimegroupController.js +0 -20
- package/dist/packages/elements/src/elements/durationConverter.cjs +0 -8
- package/dist/packages/elements/src/elements/durationConverter.d.ts +0 -4
- package/dist/packages/elements/src/elements/durationConverter.js +0 -8
- package/dist/packages/elements/src/elements/parseTimeToMs.cjs +0 -12
- package/dist/packages/elements/src/elements/parseTimeToMs.d.ts +0 -1
- package/dist/packages/elements/src/elements/parseTimeToMs.js +0 -12
- package/dist/packages/elements/src/elements/util.cjs +0 -11
- package/dist/packages/elements/src/elements/util.d.ts +0 -4
- package/dist/packages/elements/src/elements/util.js +0 -11
- package/dist/packages/elements/src/gui/EFFilmstrip.cjs +0 -719
- package/dist/packages/elements/src/gui/EFFilmstrip.d.ts +0 -143
- package/dist/packages/elements/src/gui/EFFilmstrip.js +0 -727
- package/dist/packages/elements/src/gui/EFWorkbench.cjs +0 -213
- package/dist/packages/elements/src/gui/EFWorkbench.d.ts +0 -45
- package/dist/packages/elements/src/gui/EFWorkbench.js +0 -214
- package/dist/packages/elements/src/gui/TWMixin.cjs +0 -28
- package/dist/packages/elements/src/gui/TWMixin.css.cjs +0 -3
- package/dist/packages/elements/src/gui/TWMixin.css.js +0 -4
- package/dist/packages/elements/src/gui/TWMixin.d.ts +0 -3
- package/dist/packages/elements/src/gui/TWMixin.js +0 -28
- package/dist/packages/elements/src/index.cjs +0 -47
- package/dist/packages/elements/src/index.d.ts +0 -10
- package/dist/packages/elements/src/index.js +0 -23
- package/dist/style.css +0 -769
|
@@ -1,719 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const EFTimegroup = require("../elements/EFTimegroup.cjs");
|
|
4
|
-
const lit = require("lit");
|
|
5
|
-
const decorators_js = require("lit/decorators.js");
|
|
6
|
-
const styleMap_js = require("lit/directives/style-map.js");
|
|
7
|
-
const ref_js = require("lit/directives/ref.js");
|
|
8
|
-
const EFImage = require("../elements/EFImage.cjs");
|
|
9
|
-
const EFAudio = require("../elements/EFAudio.cjs");
|
|
10
|
-
const EFVideo = require("../elements/EFVideo.cjs");
|
|
11
|
-
const EFCaptions = require("../elements/EFCaptions.cjs");
|
|
12
|
-
const EFWaveform = require("../elements/EFWaveform.cjs");
|
|
13
|
-
const TimegroupController = require("../elements/TimegroupController.cjs");
|
|
14
|
-
const context = require("@lit/context");
|
|
15
|
-
const EFWorkbench = require("./EFWorkbench.cjs");
|
|
16
|
-
const TWMixin = require("./TWMixin.cjs");
|
|
17
|
-
const msToTimeCode = require("../../../../lib/av/msToTimeCode.cjs");
|
|
18
|
-
var __defProp = Object.defineProperty;
|
|
19
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
20
|
-
var __typeError = (msg) => {
|
|
21
|
-
throw TypeError(msg);
|
|
22
|
-
};
|
|
23
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
24
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
25
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
26
|
-
if (decorator = decorators[i])
|
|
27
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
28
|
-
if (kind && result) __defProp(target, key, result);
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
|
-
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
32
|
-
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), member.get(obj));
|
|
33
|
-
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
34
|
-
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
35
|
-
var _lastTick;
|
|
36
|
-
class ElementFilmstripController {
|
|
37
|
-
constructor(host, filmstrip) {
|
|
38
|
-
this.host = host;
|
|
39
|
-
this.filmstrip = filmstrip;
|
|
40
|
-
this.host.addController(this);
|
|
41
|
-
}
|
|
42
|
-
remove() {
|
|
43
|
-
this.host.removeController(this);
|
|
44
|
-
}
|
|
45
|
-
hostDisconnected() {
|
|
46
|
-
this.host.removeController(this);
|
|
47
|
-
}
|
|
48
|
-
hostUpdated() {
|
|
49
|
-
this.filmstrip.requestUpdate();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
const CommonEffectKeys = /* @__PURE__ */ new Set([
|
|
53
|
-
"offset",
|
|
54
|
-
"easing",
|
|
55
|
-
"composite",
|
|
56
|
-
"computedOffset"
|
|
57
|
-
]);
|
|
58
|
-
class FilmstripItem extends TWMixin.TWMixin(lit.LitElement) {
|
|
59
|
-
constructor() {
|
|
60
|
-
super(...arguments);
|
|
61
|
-
this.element = new EFTimegroup.EFTimegroup();
|
|
62
|
-
this.pixelsPerMs = 0.04;
|
|
63
|
-
}
|
|
64
|
-
static {
|
|
65
|
-
this.styles = [
|
|
66
|
-
lit.css`
|
|
67
|
-
:host {
|
|
68
|
-
display: block;
|
|
69
|
-
}
|
|
70
|
-
`
|
|
71
|
-
];
|
|
72
|
-
}
|
|
73
|
-
get isFocused() {
|
|
74
|
-
return this.element && this.focusedElement === this.element;
|
|
75
|
-
}
|
|
76
|
-
get styles() {
|
|
77
|
-
return {
|
|
78
|
-
position: "relative",
|
|
79
|
-
left: `${this.pixelsPerMs * this.element.startTimeWithinParentMs}px`,
|
|
80
|
-
width: `${this.pixelsPerMs * this.element.durationMs}px`
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
render() {
|
|
84
|
-
return lit.html` <div class="" style=${styleMap_js.styleMap(this.styles)}>
|
|
85
|
-
<div
|
|
86
|
-
@mouseenter=${() => {
|
|
87
|
-
if (this.focusContext) {
|
|
88
|
-
this.focusContext.focusedElement = this.element;
|
|
89
|
-
}
|
|
90
|
-
}}
|
|
91
|
-
@mouseleave=${() => {
|
|
92
|
-
if (this.focusContext) {
|
|
93
|
-
this.focusContext.focusedElement = null;
|
|
94
|
-
}
|
|
95
|
-
}}
|
|
96
|
-
?data-focused=${this.isFocused}
|
|
97
|
-
class="border-outset relative mb-[1px] block h-[1.25rem] text-nowrap border border-slate-500 bg-blue-200 text-sm data-[focused]:bg-slate-400"
|
|
98
|
-
>
|
|
99
|
-
${this.animations()}
|
|
100
|
-
</div>
|
|
101
|
-
${this.renderChildren()}
|
|
102
|
-
</div>`;
|
|
103
|
-
}
|
|
104
|
-
renderChildren() {
|
|
105
|
-
return renderFilmStripChildren(
|
|
106
|
-
Array.from(this.element.children),
|
|
107
|
-
this.pixelsPerMs
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
contents() {
|
|
111
|
-
return lit.html``;
|
|
112
|
-
}
|
|
113
|
-
animations() {
|
|
114
|
-
const animations = this.element.getAnimations();
|
|
115
|
-
return animations.map((animation) => {
|
|
116
|
-
const effect = animation.effect;
|
|
117
|
-
if (!(effect instanceof KeyframeEffect)) {
|
|
118
|
-
return lit.nothing;
|
|
119
|
-
}
|
|
120
|
-
const start = effect.getTiming().delay ?? 0;
|
|
121
|
-
const duration = effect.getTiming().duration;
|
|
122
|
-
if (duration === null) {
|
|
123
|
-
return lit.nothing;
|
|
124
|
-
}
|
|
125
|
-
const keyframes = effect.getKeyframes();
|
|
126
|
-
const firstKeyframe = keyframes[0];
|
|
127
|
-
if (!firstKeyframe) {
|
|
128
|
-
return lit.nothing;
|
|
129
|
-
}
|
|
130
|
-
const properties = new Set(Object.keys(firstKeyframe));
|
|
131
|
-
for (const key of CommonEffectKeys) {
|
|
132
|
-
properties.delete(key);
|
|
133
|
-
}
|
|
134
|
-
return lit.html`<div
|
|
135
|
-
class="relative h-[5px] bg-blue-500 opacity-50"
|
|
136
|
-
label="animation"
|
|
137
|
-
style=${styleMap_js.styleMap({
|
|
138
|
-
left: `${this.pixelsPerMs * start}px`,
|
|
139
|
-
width: `${this.pixelsPerMs * Number(duration)}px`
|
|
140
|
-
})}
|
|
141
|
-
>
|
|
142
|
-
<!-- <div class="text-nowrap">${Array.from(properties).join(" ")}</div> -->
|
|
143
|
-
${effect.getKeyframes().map((keyframe) => {
|
|
144
|
-
return lit.html`<div
|
|
145
|
-
class="absolute top-0 h-full w-1 bg-red-500"
|
|
146
|
-
style=${styleMap_js.styleMap({
|
|
147
|
-
left: `${this.pixelsPerMs * keyframe.computedOffset * Number(duration)}px`
|
|
148
|
-
})}
|
|
149
|
-
></div>`;
|
|
150
|
-
})}
|
|
151
|
-
</div>`;
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
update(changedProperties) {
|
|
155
|
-
if (changedProperties.has("element") && this.element instanceof lit.LitElement) {
|
|
156
|
-
this.filmstripController?.remove();
|
|
157
|
-
this.filmstripController = new ElementFilmstripController(
|
|
158
|
-
this.element,
|
|
159
|
-
this
|
|
160
|
-
);
|
|
161
|
-
}
|
|
162
|
-
super.update(changedProperties);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
__decorateClass([
|
|
166
|
-
context.consume({ context: EFWorkbench.focusContext })
|
|
167
|
-
], FilmstripItem.prototype, "focusContext", 2);
|
|
168
|
-
__decorateClass([
|
|
169
|
-
context.consume({ context: EFWorkbench.focusedElement, subscribe: true })
|
|
170
|
-
], FilmstripItem.prototype, "focusedElement", 2);
|
|
171
|
-
__decorateClass([
|
|
172
|
-
decorators_js.property({ type: HTMLElement, attribute: false })
|
|
173
|
-
], FilmstripItem.prototype, "element", 2);
|
|
174
|
-
__decorateClass([
|
|
175
|
-
decorators_js.property({ type: Number })
|
|
176
|
-
], FilmstripItem.prototype, "pixelsPerMs", 2);
|
|
177
|
-
exports.EFAudioFilmstrip = class EFAudioFilmstrip extends FilmstripItem {
|
|
178
|
-
contents() {
|
|
179
|
-
return lit.html``;
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
exports.EFAudioFilmstrip = __decorateClass([
|
|
183
|
-
decorators_js.customElement("ef-audio-filmstrip")
|
|
184
|
-
], exports.EFAudioFilmstrip);
|
|
185
|
-
exports.EFVideoFilmstrip = class EFVideoFilmstrip extends FilmstripItem {
|
|
186
|
-
contents() {
|
|
187
|
-
return lit.html` 📼 `;
|
|
188
|
-
}
|
|
189
|
-
};
|
|
190
|
-
exports.EFVideoFilmstrip = __decorateClass([
|
|
191
|
-
decorators_js.customElement("ef-video-filmstrip")
|
|
192
|
-
], exports.EFVideoFilmstrip);
|
|
193
|
-
exports.EFCaptionsFilmstrip = class EFCaptionsFilmstrip extends FilmstripItem {
|
|
194
|
-
contents() {
|
|
195
|
-
return lit.html` 📝 `;
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
exports.EFCaptionsFilmstrip = __decorateClass([
|
|
199
|
-
decorators_js.customElement("ef-captions-filmstrip")
|
|
200
|
-
], exports.EFCaptionsFilmstrip);
|
|
201
|
-
exports.EFWaveformFilmstrip = class EFWaveformFilmstrip extends FilmstripItem {
|
|
202
|
-
contents() {
|
|
203
|
-
return lit.html` 🌊 `;
|
|
204
|
-
}
|
|
205
|
-
renderChildren() {
|
|
206
|
-
return lit.nothing;
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
exports.EFWaveformFilmstrip = __decorateClass([
|
|
210
|
-
decorators_js.customElement("ef-waveform-filmstrip")
|
|
211
|
-
], exports.EFWaveformFilmstrip);
|
|
212
|
-
exports.EFImageFilmstrip = class EFImageFilmstrip extends FilmstripItem {
|
|
213
|
-
contents() {
|
|
214
|
-
return lit.html` 🖼️ `;
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
exports.EFImageFilmstrip = __decorateClass([
|
|
218
|
-
decorators_js.customElement("ef-image-filmstrip")
|
|
219
|
-
], exports.EFImageFilmstrip);
|
|
220
|
-
exports.EFTimegroupFilmstrip = class EFTimegroupFilmstrip extends FilmstripItem {
|
|
221
|
-
contents() {
|
|
222
|
-
return lit.html`
|
|
223
|
-
<span>TIME GROUP</span>
|
|
224
|
-
${renderFilmStripChildren(
|
|
225
|
-
Array.from(this.element.children || []),
|
|
226
|
-
this.pixelsPerMs
|
|
227
|
-
)}
|
|
228
|
-
</div>
|
|
229
|
-
`;
|
|
230
|
-
}
|
|
231
|
-
};
|
|
232
|
-
exports.EFTimegroupFilmstrip = __decorateClass([
|
|
233
|
-
decorators_js.customElement("ef-timegroup-filmstrip")
|
|
234
|
-
], exports.EFTimegroupFilmstrip);
|
|
235
|
-
exports.EFHTMLFilmstrip = class EFHTMLFilmstrip extends FilmstripItem {
|
|
236
|
-
contents() {
|
|
237
|
-
return lit.html`
|
|
238
|
-
<span>${this.element.tagName}</span>
|
|
239
|
-
${renderFilmStripChildren(
|
|
240
|
-
Array.from(this.element.children || []),
|
|
241
|
-
this.pixelsPerMs
|
|
242
|
-
)}
|
|
243
|
-
`;
|
|
244
|
-
}
|
|
245
|
-
};
|
|
246
|
-
exports.EFHTMLFilmstrip = __decorateClass([
|
|
247
|
-
decorators_js.customElement("ef-html-filmstrip")
|
|
248
|
-
], exports.EFHTMLFilmstrip);
|
|
249
|
-
let EFHierarchyItem = class extends TWMixin.TWMixin(lit.LitElement) {
|
|
250
|
-
constructor() {
|
|
251
|
-
super(...arguments);
|
|
252
|
-
this.element = new EFTimegroup.EFTimegroup();
|
|
253
|
-
}
|
|
254
|
-
get icon() {
|
|
255
|
-
return "📼";
|
|
256
|
-
}
|
|
257
|
-
get isFocused() {
|
|
258
|
-
return this.element && this.focusedElement === this.element;
|
|
259
|
-
}
|
|
260
|
-
displayLabel() {
|
|
261
|
-
return lit.nothing;
|
|
262
|
-
}
|
|
263
|
-
render() {
|
|
264
|
-
return lit.html`
|
|
265
|
-
<div>
|
|
266
|
-
<div
|
|
267
|
-
?data-focused=${this.isFocused}
|
|
268
|
-
class="peer
|
|
269
|
-
flex h-[1.25rem] items-center overflow-hidden text-nowrap border border-slate-500
|
|
270
|
-
bg-slate-200 pl-2 text-sm hover:bg-slate-400 data-[focused]:bg-slate-400"
|
|
271
|
-
@mouseenter=${() => {
|
|
272
|
-
if (this.focusContext) {
|
|
273
|
-
this.focusContext.focusedElement = this.element;
|
|
274
|
-
}
|
|
275
|
-
}}
|
|
276
|
-
@mouseleave=${() => {
|
|
277
|
-
if (this.focusContext) {
|
|
278
|
-
this.focusContext.focusedElement = null;
|
|
279
|
-
}
|
|
280
|
-
}}
|
|
281
|
-
>
|
|
282
|
-
${this.icon} ${this.displayLabel()}
|
|
283
|
-
</div>
|
|
284
|
-
<div
|
|
285
|
-
class="p-[1px] pb-0 pl-2 pr-0 peer-hover:bg-slate-300 peer-data-[focused]:bg-slate-300 peer-hover:border-slate-400 peer-data-[focused]:border-slate-400""
|
|
286
|
-
>
|
|
287
|
-
${this.renderChildren()}
|
|
288
|
-
</div>
|
|
289
|
-
</div>`;
|
|
290
|
-
}
|
|
291
|
-
renderChildren() {
|
|
292
|
-
return renderHierarchyChildren(Array.from(this.element.children));
|
|
293
|
-
}
|
|
294
|
-
};
|
|
295
|
-
__decorateClass([
|
|
296
|
-
decorators_js.property({ type: HTMLElement, attribute: false })
|
|
297
|
-
], EFHierarchyItem.prototype, "element", 2);
|
|
298
|
-
__decorateClass([
|
|
299
|
-
context.consume({ context: EFWorkbench.focusContext })
|
|
300
|
-
], EFHierarchyItem.prototype, "focusContext", 2);
|
|
301
|
-
__decorateClass([
|
|
302
|
-
context.consume({ context: EFWorkbench.focusedElement, subscribe: true })
|
|
303
|
-
], EFHierarchyItem.prototype, "focusedElement", 2);
|
|
304
|
-
EFHierarchyItem = __decorateClass([
|
|
305
|
-
decorators_js.customElement("ef-hierarchy-item")
|
|
306
|
-
], EFHierarchyItem);
|
|
307
|
-
let EFTimegroupHierarchyItem = class extends EFHierarchyItem {
|
|
308
|
-
get icon() {
|
|
309
|
-
return "🕒";
|
|
310
|
-
}
|
|
311
|
-
displayLabel() {
|
|
312
|
-
return this.element.mode ?? "(no mode)";
|
|
313
|
-
}
|
|
314
|
-
};
|
|
315
|
-
EFTimegroupHierarchyItem = __decorateClass([
|
|
316
|
-
decorators_js.customElement("ef-timegroup-hierarchy-item")
|
|
317
|
-
], EFTimegroupHierarchyItem);
|
|
318
|
-
let EFAudioHierarchyItem = class extends EFHierarchyItem {
|
|
319
|
-
get icon() {
|
|
320
|
-
return "🔊";
|
|
321
|
-
}
|
|
322
|
-
displayLabel() {
|
|
323
|
-
return this.element.getAttribute("src") ?? "(no src)";
|
|
324
|
-
}
|
|
325
|
-
};
|
|
326
|
-
EFAudioHierarchyItem = __decorateClass([
|
|
327
|
-
decorators_js.customElement("ef-audio-hierarchy-item")
|
|
328
|
-
], EFAudioHierarchyItem);
|
|
329
|
-
let EFVideoHierarchyItem = class extends EFHierarchyItem {
|
|
330
|
-
get icon() {
|
|
331
|
-
return "📼";
|
|
332
|
-
}
|
|
333
|
-
displayLabel() {
|
|
334
|
-
return this.element.getAttribute("src") ?? "(no src)";
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
EFVideoHierarchyItem = __decorateClass([
|
|
338
|
-
decorators_js.customElement("ef-video-hierarchy-item")
|
|
339
|
-
], EFVideoHierarchyItem);
|
|
340
|
-
let EFCaptionsHierarchyItem = class extends EFHierarchyItem {
|
|
341
|
-
get icon() {
|
|
342
|
-
return "📝 Captions";
|
|
343
|
-
}
|
|
344
|
-
};
|
|
345
|
-
EFCaptionsHierarchyItem = __decorateClass([
|
|
346
|
-
decorators_js.customElement("ef-captions-hierarchy-item")
|
|
347
|
-
], EFCaptionsHierarchyItem);
|
|
348
|
-
let EFCaptionsActiveWordHierarchyItem = class extends EFHierarchyItem {
|
|
349
|
-
get icon() {
|
|
350
|
-
return "🗣️ Active Word";
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
EFCaptionsActiveWordHierarchyItem = __decorateClass([
|
|
354
|
-
decorators_js.customElement("ef-captions-active-word-hierarchy-item")
|
|
355
|
-
], EFCaptionsActiveWordHierarchyItem);
|
|
356
|
-
let EFWaveformHierarchyItem = class extends EFHierarchyItem {
|
|
357
|
-
get icon() {
|
|
358
|
-
return "🌊";
|
|
359
|
-
}
|
|
360
|
-
renderChildren() {
|
|
361
|
-
return lit.nothing;
|
|
362
|
-
}
|
|
363
|
-
};
|
|
364
|
-
EFWaveformHierarchyItem = __decorateClass([
|
|
365
|
-
decorators_js.customElement("ef-waveform-hierarchy-item")
|
|
366
|
-
], EFWaveformHierarchyItem);
|
|
367
|
-
let EFImageHierarchyItem = class extends EFHierarchyItem {
|
|
368
|
-
get icon() {
|
|
369
|
-
return "🖼️";
|
|
370
|
-
}
|
|
371
|
-
displayLabel() {
|
|
372
|
-
return this.element.getAttribute("src") ?? "(no src)";
|
|
373
|
-
}
|
|
374
|
-
};
|
|
375
|
-
EFImageHierarchyItem = __decorateClass([
|
|
376
|
-
decorators_js.customElement("ef-image-hierarchy-item")
|
|
377
|
-
], EFImageHierarchyItem);
|
|
378
|
-
let EFHTMLHierarchyItem = class extends EFHierarchyItem {
|
|
379
|
-
get icon() {
|
|
380
|
-
return lit.html`<code>${`<${this.element.tagName.toLowerCase()}>`}</code>`;
|
|
381
|
-
}
|
|
382
|
-
};
|
|
383
|
-
EFHTMLHierarchyItem = __decorateClass([
|
|
384
|
-
decorators_js.customElement("ef-html-hierarchy-item")
|
|
385
|
-
], EFHTMLHierarchyItem);
|
|
386
|
-
const renderHierarchyChildren = (children) => {
|
|
387
|
-
return children.map((child) => {
|
|
388
|
-
if (child instanceof EFTimegroup.EFTimegroup) {
|
|
389
|
-
return lit.html`<ef-timegroup-hierarchy-item
|
|
390
|
-
.element=${child}
|
|
391
|
-
></ef-timegroup-hierarchy-item>`;
|
|
392
|
-
}
|
|
393
|
-
if (child instanceof EFImage.EFImage) {
|
|
394
|
-
return lit.html`<ef-image-hierarchy-item
|
|
395
|
-
.element=${child}
|
|
396
|
-
></ef-image-hierarchy-item>`;
|
|
397
|
-
}
|
|
398
|
-
if (child instanceof EFAudio.EFAudio) {
|
|
399
|
-
return lit.html`<ef-audio-hierarchy-item
|
|
400
|
-
.element=${child}
|
|
401
|
-
></ef-audio-hierarchy-item>`;
|
|
402
|
-
}
|
|
403
|
-
if (child instanceof EFVideo.EFVideo) {
|
|
404
|
-
return lit.html`<ef-video-hierarchy-item
|
|
405
|
-
.element=${child}
|
|
406
|
-
></ef-video-hierarchy-item>`;
|
|
407
|
-
}
|
|
408
|
-
if (child instanceof EFCaptions.EFCaptions) {
|
|
409
|
-
return lit.html`<ef-captions-hierarchy-item
|
|
410
|
-
.element=${child}
|
|
411
|
-
></ef-captions-hierarchy-item>`;
|
|
412
|
-
}
|
|
413
|
-
if (child instanceof EFCaptions.EFCaptionsActiveWord) {
|
|
414
|
-
return lit.html`<ef-captions-active-word-hierarchy-item
|
|
415
|
-
.element=${child}
|
|
416
|
-
></ef-captions-active-word-hierarchy-item>`;
|
|
417
|
-
}
|
|
418
|
-
if (child instanceof EFWaveform.EFWaveform) {
|
|
419
|
-
return lit.html`<ef-waveform-hierarchy-item
|
|
420
|
-
.element=${child}
|
|
421
|
-
></ef-waveform-hierarchy-item>`;
|
|
422
|
-
}
|
|
423
|
-
return lit.html`<ef-html-hierarchy-item
|
|
424
|
-
.element=${child}
|
|
425
|
-
></ef-html-hierarchy-item>`;
|
|
426
|
-
});
|
|
427
|
-
};
|
|
428
|
-
const renderFilmStripChildren = (children, pixelsPerMs) => {
|
|
429
|
-
return children.map((child) => {
|
|
430
|
-
if (child instanceof EFTimegroup.EFTimegroup) {
|
|
431
|
-
return lit.html`<ef-timegroup-filmstrip
|
|
432
|
-
.element=${child}
|
|
433
|
-
.pixelsPerMs=${pixelsPerMs}
|
|
434
|
-
>
|
|
435
|
-
</ef-timegroup-filmstrip>`;
|
|
436
|
-
}
|
|
437
|
-
if (child instanceof EFImage.EFImage) {
|
|
438
|
-
return lit.html`<ef-image-filmstrip
|
|
439
|
-
.element=${child}
|
|
440
|
-
.pixelsPerMs=${pixelsPerMs}
|
|
441
|
-
></ef-image-filmstrip>`;
|
|
442
|
-
}
|
|
443
|
-
if (child instanceof EFAudio.EFAudio) {
|
|
444
|
-
return lit.html`<ef-audio-filmstrip
|
|
445
|
-
.element=${child}
|
|
446
|
-
.pixelsPerMs=${pixelsPerMs}
|
|
447
|
-
></ef-audio-filmstrip>`;
|
|
448
|
-
}
|
|
449
|
-
if (child instanceof EFVideo.EFVideo) {
|
|
450
|
-
return lit.html`<ef-video-filmstrip
|
|
451
|
-
.element=${child}
|
|
452
|
-
.pixelsPerMs=${pixelsPerMs}
|
|
453
|
-
></ef-video-filmstrip>`;
|
|
454
|
-
}
|
|
455
|
-
if (child instanceof EFCaptions.EFCaptions) {
|
|
456
|
-
return lit.html`<ef-captions-filmstrip
|
|
457
|
-
.element=${child}
|
|
458
|
-
.pixelsPerMs=${pixelsPerMs}
|
|
459
|
-
></ef-captions-filmstrip>`;
|
|
460
|
-
}
|
|
461
|
-
if (child instanceof EFWaveform.EFWaveform) {
|
|
462
|
-
return lit.html`<ef-waveform-filmstrip
|
|
463
|
-
.element=${child}
|
|
464
|
-
.pixelsPerMs=${pixelsPerMs}
|
|
465
|
-
></ef-waveform-filmstrip>`;
|
|
466
|
-
}
|
|
467
|
-
return lit.html`<ef-html-filmstrip
|
|
468
|
-
.element=${child}
|
|
469
|
-
.pixelsPerMs=${pixelsPerMs}
|
|
470
|
-
></ef-html-filmstrip>`;
|
|
471
|
-
});
|
|
472
|
-
};
|
|
473
|
-
exports.EFFilmStrip = class EFFilmStrip extends TWMixin.TWMixin(lit.LitElement) {
|
|
474
|
-
constructor() {
|
|
475
|
-
super(...arguments);
|
|
476
|
-
this.pixelsPerMs = 0.04;
|
|
477
|
-
this.currentTimeMs = 0;
|
|
478
|
-
this.targetSelector = "";
|
|
479
|
-
this.scrubbing = false;
|
|
480
|
-
this.playing = false;
|
|
481
|
-
this.timelineScrolltop = 0;
|
|
482
|
-
__privateAdd(this, _lastTick);
|
|
483
|
-
this.advancePlayhead = (tick) => {
|
|
484
|
-
if (__privateGet(this, _lastTick) && tick && this.target) {
|
|
485
|
-
this.target.currentTimeMs += tick - __privateGet(this, _lastTick);
|
|
486
|
-
if (this.target.currentTimeMs >= this.target.durationMs) {
|
|
487
|
-
this.playing = false;
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
__privateSet(this, _lastTick, tick);
|
|
491
|
-
if (this.playing) {
|
|
492
|
-
requestAnimationFrame(this.advancePlayhead);
|
|
493
|
-
}
|
|
494
|
-
};
|
|
495
|
-
this.gutterRef = ref_js.createRef();
|
|
496
|
-
this.hierarchyRef = ref_js.createRef();
|
|
497
|
-
this.playheadRef = ref_js.createRef();
|
|
498
|
-
}
|
|
499
|
-
connectedCallback() {
|
|
500
|
-
super.connectedCallback();
|
|
501
|
-
const target = this.target;
|
|
502
|
-
if (target) {
|
|
503
|
-
this.timegroupController = new TimegroupController.TimegroupController(target, this);
|
|
504
|
-
this.currentTimeMs = target.currentTimeMs;
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
syncGutterScroll() {
|
|
508
|
-
if (this.gutter && this.hierarchyRef.value) {
|
|
509
|
-
this.hierarchyRef.value.scrollTop = this.gutter.scrollTop;
|
|
510
|
-
this.timelineScrolltop = this.gutter.scrollTop;
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
syncHierarchyScroll() {
|
|
514
|
-
if (this.gutter && this.hierarchyRef.value) {
|
|
515
|
-
this.gutter.scrollTop = this.hierarchyRef.value.scrollTop;
|
|
516
|
-
this.timelineScrolltop = this.hierarchyRef.value.scrollTop;
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
scrub(e) {
|
|
520
|
-
if (this.playing) {
|
|
521
|
-
return;
|
|
522
|
-
}
|
|
523
|
-
if (!this.scrubbing) {
|
|
524
|
-
return;
|
|
525
|
-
}
|
|
526
|
-
const gutter = this.shadowRoot?.querySelector("#gutter");
|
|
527
|
-
if (!gutter) {
|
|
528
|
-
return;
|
|
529
|
-
}
|
|
530
|
-
const rect = gutter.getBoundingClientRect();
|
|
531
|
-
if (this.target) {
|
|
532
|
-
const layerX = e.pageX - rect.left + gutter.scrollLeft;
|
|
533
|
-
this.target.currentTimeMs = layerX / this.pixelsPerMs;
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
startScrub(e) {
|
|
537
|
-
e.preventDefault();
|
|
538
|
-
this.scrubbing = true;
|
|
539
|
-
queueMicrotask(() => {
|
|
540
|
-
const gutter = this.shadowRoot?.querySelector("#gutter");
|
|
541
|
-
if (!gutter) {
|
|
542
|
-
return;
|
|
543
|
-
}
|
|
544
|
-
const rect = gutter.getBoundingClientRect();
|
|
545
|
-
if (this.target) {
|
|
546
|
-
const layerX = e.pageX - rect.left + gutter.scrollLeft;
|
|
547
|
-
this.target.currentTimeMs = layerX / this.pixelsPerMs;
|
|
548
|
-
}
|
|
549
|
-
});
|
|
550
|
-
addEventListener(
|
|
551
|
-
"mouseup",
|
|
552
|
-
() => {
|
|
553
|
-
this.scrubbing = false;
|
|
554
|
-
},
|
|
555
|
-
{ once: true }
|
|
556
|
-
);
|
|
557
|
-
}
|
|
558
|
-
scrollScrub(e) {
|
|
559
|
-
if (this.target && this.gutter && !this.playing) {
|
|
560
|
-
e.preventDefault();
|
|
561
|
-
if (this.gutterRef.value && this.gutterRef.value.scrollLeft === 0 && e.deltaX < 0) {
|
|
562
|
-
this.gutter.scrollBy(0, e.deltaY);
|
|
563
|
-
return;
|
|
564
|
-
}
|
|
565
|
-
if (this.gutter.scrollWidth - this.gutter.scrollLeft === this.gutter.clientWidth && e.deltaX > 0) {
|
|
566
|
-
this.gutter.scrollBy(0, e.deltaY);
|
|
567
|
-
return;
|
|
568
|
-
}
|
|
569
|
-
if (this) {
|
|
570
|
-
this.gutter.scrollBy(e.deltaX, e.deltaY);
|
|
571
|
-
this.target.currentTimeMs += e.deltaX / this.pixelsPerMs;
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
}
|
|
575
|
-
get gutter() {
|
|
576
|
-
return this.gutterRef.value;
|
|
577
|
-
}
|
|
578
|
-
render() {
|
|
579
|
-
const target = this.target;
|
|
580
|
-
return lit.html` <div
|
|
581
|
-
class="grid h-full bg-slate-100"
|
|
582
|
-
style=${styleMap_js.styleMap({
|
|
583
|
-
gridTemplateColumns: "200px 1fr",
|
|
584
|
-
gridTemplateRows: "1.5rem 1fr"
|
|
585
|
-
})}
|
|
586
|
-
>
|
|
587
|
-
<div
|
|
588
|
-
class="z-20 col-span-2 border-b-slate-600 bg-slate-100 shadow shadow-slate-300"
|
|
589
|
-
>
|
|
590
|
-
<input
|
|
591
|
-
type="range"
|
|
592
|
-
.value=${this.pixelsPerMs}
|
|
593
|
-
min="0.01"
|
|
594
|
-
max="0.1"
|
|
595
|
-
step="0.001"
|
|
596
|
-
@input=${(e) => {
|
|
597
|
-
const target2 = e.target;
|
|
598
|
-
this.pixelsPerMs = Number.parseFloat(target2.value);
|
|
599
|
-
}}
|
|
600
|
-
/>
|
|
601
|
-
<code>${msToTimeCode.msToTimeCode(this.currentTimeMs, true)} </code> /
|
|
602
|
-
<code>${msToTimeCode.msToTimeCode(target?.durationMs ?? 0, true)}</code>
|
|
603
|
-
${this.playing ? lit.html`<button
|
|
604
|
-
@click=${() => {
|
|
605
|
-
this.playing = false;
|
|
606
|
-
}}
|
|
607
|
-
>
|
|
608
|
-
⏸️
|
|
609
|
-
</button>` : lit.html`<button
|
|
610
|
-
@click=${() => {
|
|
611
|
-
this.playing = true;
|
|
612
|
-
}}
|
|
613
|
-
>
|
|
614
|
-
▶️
|
|
615
|
-
</button>`}
|
|
616
|
-
</div>
|
|
617
|
-
<div
|
|
618
|
-
class="z-10 pl-1 pr-1 pt-2 shadow shadow-slate-600 overflow-auto"
|
|
619
|
-
${ref_js.ref(this.hierarchyRef)}
|
|
620
|
-
@scroll=${this.syncHierarchyScroll}
|
|
621
|
-
>
|
|
622
|
-
${renderHierarchyChildren(Array.from(target?.children ?? []))}
|
|
623
|
-
</div>
|
|
624
|
-
<div
|
|
625
|
-
class="h-full w-full cursor-crosshair overflow-auto bg-slate-200 pt-2"
|
|
626
|
-
id="gutter"
|
|
627
|
-
${ref_js.ref(this.gutterRef)}
|
|
628
|
-
@scroll=${this.syncGutterScroll}
|
|
629
|
-
@wheel=${this.scrollScrub}
|
|
630
|
-
>
|
|
631
|
-
<div
|
|
632
|
-
class="relative h-full w-full"
|
|
633
|
-
style="width: ${this.pixelsPerMs * (target?.durationMs ?? 0)}px;"
|
|
634
|
-
@mousemove=${this.scrub}
|
|
635
|
-
@mousedown=${this.startScrub}
|
|
636
|
-
>
|
|
637
|
-
<div
|
|
638
|
-
class="border-red pointer-events-none absolute z-10 h-full w-[2px] border-r-2 border-red-700"
|
|
639
|
-
style=${styleMap_js.styleMap({
|
|
640
|
-
left: `${this.pixelsPerMs * this.currentTimeMs}px`,
|
|
641
|
-
top: `${this.timelineScrolltop}px`
|
|
642
|
-
})}
|
|
643
|
-
${ref_js.ref(this.playheadRef)}
|
|
644
|
-
></div>
|
|
645
|
-
|
|
646
|
-
${renderFilmStripChildren(
|
|
647
|
-
Array.from(target?.children || []),
|
|
648
|
-
this.pixelsPerMs
|
|
649
|
-
)}
|
|
650
|
-
</div>
|
|
651
|
-
</div>
|
|
652
|
-
</div>`;
|
|
653
|
-
}
|
|
654
|
-
update(changedProperties) {
|
|
655
|
-
if (changedProperties.has("playing")) {
|
|
656
|
-
if (this.playing) {
|
|
657
|
-
this.advancePlayhead(0);
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
super.update(changedProperties);
|
|
661
|
-
}
|
|
662
|
-
updated(changes) {
|
|
663
|
-
if (!this.target) {
|
|
664
|
-
return;
|
|
665
|
-
}
|
|
666
|
-
if (changes.has("currentTimeMs")) {
|
|
667
|
-
if (this.target.currentTimeMs !== this.currentTimeMs) {
|
|
668
|
-
this.target.currentTimeMs = this.currentTimeMs;
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
get target() {
|
|
673
|
-
if (this.getAttribute("target")) {
|
|
674
|
-
const target = document.querySelector(this.getAttribute("target") ?? "");
|
|
675
|
-
if (target instanceof EFTimegroup.EFTimegroup) {
|
|
676
|
-
return target;
|
|
677
|
-
}
|
|
678
|
-
throw new Error("Invalid target, must be an EFTimegroup element");
|
|
679
|
-
}
|
|
680
|
-
return void 0;
|
|
681
|
-
}
|
|
682
|
-
};
|
|
683
|
-
_lastTick = /* @__PURE__ */ new WeakMap();
|
|
684
|
-
__decorateClass([
|
|
685
|
-
decorators_js.property({ type: Number })
|
|
686
|
-
], exports.EFFilmStrip.prototype, "pixelsPerMs", 2);
|
|
687
|
-
__decorateClass([
|
|
688
|
-
decorators_js.property({ type: Number })
|
|
689
|
-
], exports.EFFilmStrip.prototype, "currentTimeMs", 2);
|
|
690
|
-
__decorateClass([
|
|
691
|
-
decorators_js.property({ type: String, attribute: "target" })
|
|
692
|
-
], exports.EFFilmStrip.prototype, "targetSelector", 2);
|
|
693
|
-
__decorateClass([
|
|
694
|
-
decorators_js.state()
|
|
695
|
-
], exports.EFFilmStrip.prototype, "scrubbing", 2);
|
|
696
|
-
__decorateClass([
|
|
697
|
-
decorators_js.state()
|
|
698
|
-
], exports.EFFilmStrip.prototype, "playing", 2);
|
|
699
|
-
__decorateClass([
|
|
700
|
-
decorators_js.state()
|
|
701
|
-
], exports.EFFilmStrip.prototype, "timelineScrolltop", 2);
|
|
702
|
-
__decorateClass([
|
|
703
|
-
decorators_js.eventOptions({ passive: false })
|
|
704
|
-
], exports.EFFilmStrip.prototype, "syncGutterScroll", 1);
|
|
705
|
-
__decorateClass([
|
|
706
|
-
decorators_js.eventOptions({ passive: false })
|
|
707
|
-
], exports.EFFilmStrip.prototype, "syncHierarchyScroll", 1);
|
|
708
|
-
__decorateClass([
|
|
709
|
-
decorators_js.eventOptions({ capture: false })
|
|
710
|
-
], exports.EFFilmStrip.prototype, "scrub", 1);
|
|
711
|
-
__decorateClass([
|
|
712
|
-
decorators_js.eventOptions({ capture: false })
|
|
713
|
-
], exports.EFFilmStrip.prototype, "startScrub", 1);
|
|
714
|
-
__decorateClass([
|
|
715
|
-
decorators_js.eventOptions({ passive: false })
|
|
716
|
-
], exports.EFFilmStrip.prototype, "scrollScrub", 1);
|
|
717
|
-
exports.EFFilmStrip = __decorateClass([
|
|
718
|
-
decorators_js.customElement("ef-filmstrip")
|
|
719
|
-
], exports.EFFilmStrip);
|