@editframe/elements 0.6.0-beta.22 → 0.7.0-beta.1
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/dist/packages/elements/src/elements/EFCaptions.cjs +1 -1
- package/dist/packages/elements/src/elements/EFCaptions.js +1 -1
- package/dist/packages/elements/src/elements/EFTimegroup.cjs +1 -1
- package/dist/packages/elements/src/elements/EFTimegroup.js +1 -1
- package/dist/packages/elements/src/elements/EFWaveform.cjs +17 -10
- package/dist/packages/elements/src/elements/EFWaveform.d.ts +3 -1
- package/dist/packages/elements/src/elements/EFWaveform.js +17 -10
- package/dist/packages/elements/src/gui/EFFilmstrip.cjs +1 -1
- package/dist/packages/elements/src/gui/EFFilmstrip.js +1 -1
- package/package.json +2 -2
- package/src/elements/EFCaptions.ts +1 -1
- package/src/elements/EFTimegroup.ts +1 -1
- package/src/elements/EFWaveform.ts +19 -11
- package/src/gui/EFFilmstrip.ts +1 -1
|
@@ -139,7 +139,7 @@ exports.EFCaptions = class EFCaptions extends EFSourceMixin.EFSourceMixin(
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
get targetElement() {
|
|
142
|
-
const target = document.
|
|
142
|
+
const target = document.getElementById(this.getAttribute("target") ?? "");
|
|
143
143
|
if (target instanceof EFAudio.EFAudio || target instanceof EFVideo.EFVideo) {
|
|
144
144
|
return target;
|
|
145
145
|
}
|
|
@@ -137,7 +137,7 @@ let EFCaptions = class extends EFSourceMixin(
|
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
get targetElement() {
|
|
140
|
-
const target = document.
|
|
140
|
+
const target = document.getElementById(this.getAttribute("target") ?? "");
|
|
141
141
|
if (target instanceof EFAudio || target instanceof EFVideo) {
|
|
142
142
|
return target;
|
|
143
143
|
}
|
|
@@ -228,7 +228,7 @@ exports.EFTimegroup = class EFTimegroup extends EFTemporal.EFTemporal(lit.LitEle
|
|
|
228
228
|
workbench.append(this);
|
|
229
229
|
const filmstrip = document.createElement("ef-filmstrip");
|
|
230
230
|
filmstrip.setAttribute("slot", "timeline");
|
|
231
|
-
filmstrip.setAttribute("target",
|
|
231
|
+
filmstrip.setAttribute("target", this.id);
|
|
232
232
|
workbench.append(filmstrip);
|
|
233
233
|
}
|
|
234
234
|
get hasOwnDuration() {
|
|
@@ -226,7 +226,7 @@ let EFTimegroup = class extends EFTemporal(LitElement) {
|
|
|
226
226
|
workbench.append(this);
|
|
227
227
|
const filmstrip = document.createElement("ef-filmstrip");
|
|
228
228
|
filmstrip.setAttribute("slot", "timeline");
|
|
229
|
-
filmstrip.setAttribute("target",
|
|
229
|
+
filmstrip.setAttribute("target", this.id);
|
|
230
230
|
workbench.append(filmstrip);
|
|
231
231
|
}
|
|
232
232
|
get hasOwnDuration() {
|
|
@@ -44,11 +44,12 @@ exports.EFWaveform = class EFWaveform extends EFTemporal.EFTemporal(TWMixin.TWMi
|
|
|
44
44
|
this.svgRef = ref_js.createRef();
|
|
45
45
|
this.mode = "bars";
|
|
46
46
|
this.color = "currentColor";
|
|
47
|
+
this.targetSelector = "";
|
|
47
48
|
this.frameTask = new task.Task(this, {
|
|
48
49
|
autoRun: EF_INTERACTIVE.EF_INTERACTIVE,
|
|
49
|
-
args: () => [this.
|
|
50
|
+
args: () => [this.targetElement.audioBufferTask.status],
|
|
50
51
|
task: async () => {
|
|
51
|
-
await this.
|
|
52
|
+
await this.targetElement.audioBufferTask.taskComplete;
|
|
52
53
|
}
|
|
53
54
|
});
|
|
54
55
|
}
|
|
@@ -58,10 +59,13 @@ exports.EFWaveform = class EFWaveform extends EFTemporal.EFTemporal(TWMixin.TWMi
|
|
|
58
59
|
render() {
|
|
59
60
|
return lit.html` <svg ${ref_js.ref(this.svgRef)} class="h-full w-full" store></svg> `;
|
|
60
61
|
}
|
|
62
|
+
set target(value) {
|
|
63
|
+
this.targetSelector = value;
|
|
64
|
+
}
|
|
61
65
|
connectedCallback() {
|
|
62
66
|
super.connectedCallback();
|
|
63
|
-
if (this.
|
|
64
|
-
new CrossUpdateController.CrossUpdateController(this.
|
|
67
|
+
if (this.targetElement) {
|
|
68
|
+
new CrossUpdateController.CrossUpdateController(this.targetElement, this);
|
|
65
69
|
}
|
|
66
70
|
}
|
|
67
71
|
drawBars(svg, frequencyData) {
|
|
@@ -160,13 +164,13 @@ exports.EFWaveform = class EFWaveform extends EFTemporal.EFTemporal(TWMixin.TWMi
|
|
|
160
164
|
if (!svg) {
|
|
161
165
|
return;
|
|
162
166
|
}
|
|
163
|
-
if (!this.
|
|
167
|
+
if (!this.targetElement.audioBufferTask.value) {
|
|
164
168
|
return;
|
|
165
169
|
}
|
|
166
|
-
if (this.
|
|
170
|
+
if (this.targetElement.ownCurrentTimeMs > 0) {
|
|
167
171
|
const audioContext = new OfflineAudioContext(2, 48e3 / 25, 48e3);
|
|
168
172
|
const audioBufferSource = audioContext.createBufferSource();
|
|
169
|
-
audioBufferSource.buffer = this.
|
|
173
|
+
audioBufferSource.buffer = this.targetElement.audioBufferTask.value.buffer;
|
|
170
174
|
const analyser = audioContext.createAnalyser();
|
|
171
175
|
analyser.fftSize = 256;
|
|
172
176
|
audioBufferSource.connect(analyser);
|
|
@@ -174,7 +178,7 @@ exports.EFWaveform = class EFWaveform extends EFTemporal.EFTemporal(TWMixin.TWMi
|
|
|
174
178
|
0,
|
|
175
179
|
Math.max(
|
|
176
180
|
0,
|
|
177
|
-
(this.
|
|
181
|
+
(this.targetElement.ownCurrentTimeMs - this.targetElement.audioBufferTask.value.startOffsetMs) / 1e3
|
|
178
182
|
),
|
|
179
183
|
48e3 / 1e3
|
|
180
184
|
);
|
|
@@ -212,8 +216,8 @@ exports.EFWaveform = class EFWaveform extends EFTemporal.EFTemporal(TWMixin.TWMi
|
|
|
212
216
|
}
|
|
213
217
|
}
|
|
214
218
|
}
|
|
215
|
-
get
|
|
216
|
-
const target = document.
|
|
219
|
+
get targetElement() {
|
|
220
|
+
const target = document.getElementById(this.targetSelector ?? "");
|
|
217
221
|
if (target instanceof EFAudio.EFAudio || target instanceof EFVideo.EFVideo) {
|
|
218
222
|
return target;
|
|
219
223
|
}
|
|
@@ -230,6 +234,9 @@ __decorateClass([
|
|
|
230
234
|
__decorateClass([
|
|
231
235
|
decorators_js.property({ type: String })
|
|
232
236
|
], exports.EFWaveform.prototype, "color", 2);
|
|
237
|
+
__decorateClass([
|
|
238
|
+
decorators_js.property({ type: String, attribute: "target", reflect: true })
|
|
239
|
+
], exports.EFWaveform.prototype, "targetSelector", 2);
|
|
233
240
|
exports.EFWaveform = __decorateClass([
|
|
234
241
|
decorators_js.customElement("ef-waveform")
|
|
235
242
|
], exports.EFWaveform);
|
|
@@ -12,6 +12,8 @@ export declare class EFWaveform extends EFWaveform_base {
|
|
|
12
12
|
render(): import('lit-html').TemplateResult<1>;
|
|
13
13
|
mode: "roundBars" | "bars" | "bricks" | "equalizer" | "curve" | "line" | "pixel" | "wave";
|
|
14
14
|
color: string;
|
|
15
|
+
targetSelector: string;
|
|
16
|
+
set target(value: string);
|
|
15
17
|
connectedCallback(): void;
|
|
16
18
|
protected drawBars(svg: SVGElement, frequencyData: Uint8Array): void;
|
|
17
19
|
protected drawBricks(svg: SVGElement, frequencyData: Uint8Array): void;
|
|
@@ -23,6 +25,6 @@ export declare class EFWaveform extends EFWaveform_base {
|
|
|
23
25
|
protected drawWave(svg: SVGElement, frequencyData: Uint8Array): void;
|
|
24
26
|
frameTask: Task<readonly [import('@lit/task').TaskStatus], void>;
|
|
25
27
|
protected updated(): Promise<void>;
|
|
26
|
-
get
|
|
28
|
+
get targetElement(): EFAudio | EFVideo;
|
|
27
29
|
}
|
|
28
30
|
export {};
|
|
@@ -25,11 +25,12 @@ let EFWaveform = class extends EFTemporal(TWMixin(LitElement)) {
|
|
|
25
25
|
this.svgRef = createRef();
|
|
26
26
|
this.mode = "bars";
|
|
27
27
|
this.color = "currentColor";
|
|
28
|
+
this.targetSelector = "";
|
|
28
29
|
this.frameTask = new Task(this, {
|
|
29
30
|
autoRun: EF_INTERACTIVE,
|
|
30
|
-
args: () => [this.
|
|
31
|
+
args: () => [this.targetElement.audioBufferTask.status],
|
|
31
32
|
task: async () => {
|
|
32
|
-
await this.
|
|
33
|
+
await this.targetElement.audioBufferTask.taskComplete;
|
|
33
34
|
}
|
|
34
35
|
});
|
|
35
36
|
}
|
|
@@ -39,10 +40,13 @@ let EFWaveform = class extends EFTemporal(TWMixin(LitElement)) {
|
|
|
39
40
|
render() {
|
|
40
41
|
return html` <svg ${ref(this.svgRef)} class="h-full w-full" store></svg> `;
|
|
41
42
|
}
|
|
43
|
+
set target(value) {
|
|
44
|
+
this.targetSelector = value;
|
|
45
|
+
}
|
|
42
46
|
connectedCallback() {
|
|
43
47
|
super.connectedCallback();
|
|
44
|
-
if (this.
|
|
45
|
-
new CrossUpdateController(this.
|
|
48
|
+
if (this.targetElement) {
|
|
49
|
+
new CrossUpdateController(this.targetElement, this);
|
|
46
50
|
}
|
|
47
51
|
}
|
|
48
52
|
drawBars(svg, frequencyData) {
|
|
@@ -141,13 +145,13 @@ let EFWaveform = class extends EFTemporal(TWMixin(LitElement)) {
|
|
|
141
145
|
if (!svg) {
|
|
142
146
|
return;
|
|
143
147
|
}
|
|
144
|
-
if (!this.
|
|
148
|
+
if (!this.targetElement.audioBufferTask.value) {
|
|
145
149
|
return;
|
|
146
150
|
}
|
|
147
|
-
if (this.
|
|
151
|
+
if (this.targetElement.ownCurrentTimeMs > 0) {
|
|
148
152
|
const audioContext = new OfflineAudioContext(2, 48e3 / 25, 48e3);
|
|
149
153
|
const audioBufferSource = audioContext.createBufferSource();
|
|
150
|
-
audioBufferSource.buffer = this.
|
|
154
|
+
audioBufferSource.buffer = this.targetElement.audioBufferTask.value.buffer;
|
|
151
155
|
const analyser = audioContext.createAnalyser();
|
|
152
156
|
analyser.fftSize = 256;
|
|
153
157
|
audioBufferSource.connect(analyser);
|
|
@@ -155,7 +159,7 @@ let EFWaveform = class extends EFTemporal(TWMixin(LitElement)) {
|
|
|
155
159
|
0,
|
|
156
160
|
Math.max(
|
|
157
161
|
0,
|
|
158
|
-
(this.
|
|
162
|
+
(this.targetElement.ownCurrentTimeMs - this.targetElement.audioBufferTask.value.startOffsetMs) / 1e3
|
|
159
163
|
),
|
|
160
164
|
48e3 / 1e3
|
|
161
165
|
);
|
|
@@ -193,8 +197,8 @@ let EFWaveform = class extends EFTemporal(TWMixin(LitElement)) {
|
|
|
193
197
|
}
|
|
194
198
|
}
|
|
195
199
|
}
|
|
196
|
-
get
|
|
197
|
-
const target = document.
|
|
200
|
+
get targetElement() {
|
|
201
|
+
const target = document.getElementById(this.targetSelector ?? "");
|
|
198
202
|
if (target instanceof EFAudio || target instanceof EFVideo) {
|
|
199
203
|
return target;
|
|
200
204
|
}
|
|
@@ -211,6 +215,9 @@ __decorateClass([
|
|
|
211
215
|
__decorateClass([
|
|
212
216
|
property({ type: String })
|
|
213
217
|
], EFWaveform.prototype, "color", 2);
|
|
218
|
+
__decorateClass([
|
|
219
|
+
property({ type: String, attribute: "target", reflect: true })
|
|
220
|
+
], EFWaveform.prototype, "targetSelector", 2);
|
|
214
221
|
EFWaveform = __decorateClass([
|
|
215
222
|
customElement("ef-waveform")
|
|
216
223
|
], EFWaveform);
|
|
@@ -696,7 +696,7 @@ exports.EFFilmstrip = class EFFilmstrip extends TWMixin.TWMixin(lit.LitElement)
|
|
|
696
696
|
}
|
|
697
697
|
get targetTimegroup() {
|
|
698
698
|
if (this.getAttribute("target")) {
|
|
699
|
-
const target = document.
|
|
699
|
+
const target = document.getElementById(this.getAttribute("target") ?? "");
|
|
700
700
|
if (target instanceof EFTimegroup.EFTimegroup) {
|
|
701
701
|
return target;
|
|
702
702
|
}
|
|
@@ -694,7 +694,7 @@ let EFFilmstrip = class extends TWMixin(LitElement) {
|
|
|
694
694
|
}
|
|
695
695
|
get targetTimegroup() {
|
|
696
696
|
if (this.getAttribute("target")) {
|
|
697
|
-
const target = document.
|
|
697
|
+
const target = document.getElementById(this.getAttribute("target") ?? "");
|
|
698
698
|
if (target instanceof EFTimegroup) {
|
|
699
699
|
return target;
|
|
700
700
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@editframe/elements",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0-beta.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"author": "",
|
|
20
20
|
"license": "UNLICENSED",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@editframe/assets": "0.
|
|
22
|
+
"@editframe/assets": "0.7.0-beta.1",
|
|
23
23
|
"@lit/context": "^1.1.1",
|
|
24
24
|
"@lit/task": "^1.0.0",
|
|
25
25
|
"d3": "^7.9.0",
|
|
@@ -172,7 +172,7 @@ export class EFCaptions extends EFSourceMixin(
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
get targetElement() {
|
|
175
|
-
const target = document.
|
|
175
|
+
const target = document.getElementById(this.getAttribute("target") ?? "");
|
|
176
176
|
if (target instanceof EFAudio || target instanceof EFVideo) {
|
|
177
177
|
return target;
|
|
178
178
|
}
|
|
@@ -276,7 +276,7 @@ export class EFTimegroup extends EFTemporal(LitElement) {
|
|
|
276
276
|
|
|
277
277
|
const filmstrip = document.createElement("ef-filmstrip");
|
|
278
278
|
filmstrip.setAttribute("slot", "timeline");
|
|
279
|
-
filmstrip.setAttribute("target",
|
|
279
|
+
filmstrip.setAttribute("target", this.id);
|
|
280
280
|
workbench.append(filmstrip);
|
|
281
281
|
}
|
|
282
282
|
|
|
@@ -39,10 +39,17 @@ export class EFWaveform extends EFTemporal(TWMixin(LitElement)) {
|
|
|
39
39
|
@property({ type: String })
|
|
40
40
|
color = "currentColor";
|
|
41
41
|
|
|
42
|
+
@property({ type: String, attribute: "target", reflect: true })
|
|
43
|
+
targetSelector = "";
|
|
44
|
+
|
|
45
|
+
set target(value: string) {
|
|
46
|
+
this.targetSelector = value;
|
|
47
|
+
}
|
|
48
|
+
|
|
42
49
|
connectedCallback() {
|
|
43
50
|
super.connectedCallback();
|
|
44
|
-
if (this.
|
|
45
|
-
new CrossUpdateController(this.
|
|
51
|
+
if (this.targetElement) {
|
|
52
|
+
new CrossUpdateController(this.targetElement, this);
|
|
46
53
|
}
|
|
47
54
|
}
|
|
48
55
|
|
|
@@ -330,9 +337,9 @@ export class EFWaveform extends EFTemporal(TWMixin(LitElement)) {
|
|
|
330
337
|
|
|
331
338
|
frameTask = new Task(this, {
|
|
332
339
|
autoRun: EF_INTERACTIVE,
|
|
333
|
-
args: () => [this.
|
|
340
|
+
args: () => [this.targetElement.audioBufferTask.status] as const,
|
|
334
341
|
task: async () => {
|
|
335
|
-
await this.
|
|
342
|
+
await this.targetElement.audioBufferTask.taskComplete;
|
|
336
343
|
},
|
|
337
344
|
});
|
|
338
345
|
|
|
@@ -341,13 +348,14 @@ export class EFWaveform extends EFTemporal(TWMixin(LitElement)) {
|
|
|
341
348
|
if (!svg) {
|
|
342
349
|
return;
|
|
343
350
|
}
|
|
344
|
-
if (!this.
|
|
351
|
+
if (!this.targetElement.audioBufferTask.value) {
|
|
345
352
|
return;
|
|
346
353
|
}
|
|
347
|
-
if (this.
|
|
354
|
+
if (this.targetElement.ownCurrentTimeMs > 0) {
|
|
348
355
|
const audioContext = new OfflineAudioContext(2, 48000 / 25, 48000);
|
|
349
356
|
const audioBufferSource = audioContext.createBufferSource();
|
|
350
|
-
audioBufferSource.buffer =
|
|
357
|
+
audioBufferSource.buffer =
|
|
358
|
+
this.targetElement.audioBufferTask.value.buffer;
|
|
351
359
|
const analyser = audioContext.createAnalyser();
|
|
352
360
|
analyser.fftSize = 256;
|
|
353
361
|
audioBufferSource.connect(analyser);
|
|
@@ -356,8 +364,8 @@ export class EFWaveform extends EFTemporal(TWMixin(LitElement)) {
|
|
|
356
364
|
0,
|
|
357
365
|
Math.max(
|
|
358
366
|
0,
|
|
359
|
-
(this.
|
|
360
|
-
this.
|
|
367
|
+
(this.targetElement.ownCurrentTimeMs -
|
|
368
|
+
this.targetElement.audioBufferTask.value.startOffsetMs) /
|
|
361
369
|
1000,
|
|
362
370
|
),
|
|
363
371
|
48000 / 1000,
|
|
@@ -399,8 +407,8 @@ export class EFWaveform extends EFTemporal(TWMixin(LitElement)) {
|
|
|
399
407
|
}
|
|
400
408
|
}
|
|
401
409
|
|
|
402
|
-
get
|
|
403
|
-
const target = document.
|
|
410
|
+
get targetElement() {
|
|
411
|
+
const target = document.getElementById(this.targetSelector ?? "");
|
|
404
412
|
if (target instanceof EFAudio || target instanceof EFVideo) {
|
|
405
413
|
return target;
|
|
406
414
|
}
|
package/src/gui/EFFilmstrip.ts
CHANGED
|
@@ -847,7 +847,7 @@ export class EFFilmstrip extends TWMixin(LitElement) {
|
|
|
847
847
|
|
|
848
848
|
get targetTimegroup() {
|
|
849
849
|
if (this.getAttribute("target")) {
|
|
850
|
-
const target = document.
|
|
850
|
+
const target = document.getElementById(this.getAttribute("target") ?? "");
|
|
851
851
|
if (target instanceof EFTimegroup) {
|
|
852
852
|
return target;
|
|
853
853
|
}
|