@editframe/elements 0.12.0-beta.8 → 0.13.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/elements/EFAudio.d.ts +1 -1
- package/dist/elements/EFCaptions.d.ts +5 -5
- package/dist/elements/EFImage.d.ts +1 -1
- package/dist/elements/EFMedia.browsertest.d.ts +1 -1
- package/dist/elements/EFMedia.d.ts +6 -1
- package/dist/elements/{src/elements/EFMedia.js → EFMedia.js} +3 -3
- package/dist/elements/EFTemporal.browsertest.d.ts +1 -1
- package/dist/elements/EFTemporal.d.ts +145 -2
- package/dist/elements/{src/elements/EFTemporal.js → EFTemporal.js} +3 -0
- package/dist/elements/EFTimegroup.browsertest.d.ts +2 -2
- package/dist/elements/EFTimegroup.d.ts +8 -3
- package/dist/elements/{src/elements/EFTimegroup.js → EFTimegroup.js} +104 -53
- package/dist/elements/EFVideo.d.ts +1 -1
- package/dist/elements/{src/elements/EFVideo.js → EFVideo.js} +10 -2
- package/dist/elements/EFWaveform.d.ts +7 -4
- package/dist/elements/{src/elements/EFWaveform.js → EFWaveform.js} +48 -56
- package/dist/elements/TimegroupController.d.ts +2 -2
- package/dist/elements/util.d.ts +1 -1
- package/dist/gui/ContextMixin.browsertest.d.ts +1 -1
- package/dist/gui/ContextMixin.d.ts +4 -1
- package/dist/{elements/src/gui → gui}/ContextMixin.js +26 -42
- package/dist/gui/EFFilmstrip.d.ts +15 -9
- package/dist/{elements/src/gui → gui}/EFFilmstrip.js +64 -16
- package/dist/gui/EFFocusOverlay.d.ts +17 -0
- package/dist/gui/EFFocusOverlay.js +82 -0
- package/dist/gui/EFPreview.d.ts +3 -1
- package/dist/{elements/src/gui → gui}/EFPreview.js +24 -16
- package/dist/gui/EFScrubber.d.ts +1 -1
- package/dist/gui/EFTimeDisplay.d.ts +1 -1
- package/dist/gui/EFToggleLoop.d.ts +1 -1
- package/dist/gui/EFTogglePlay.d.ts +1 -1
- package/dist/gui/EFWorkbench.d.ts +1 -1
- package/dist/{elements/src/gui → gui}/TWMixin.css.js +1 -1
- package/dist/gui/efContext.d.ts +1 -1
- package/dist/index.d.ts +15 -14
- package/dist/{elements/src/index.js → index.js} +2 -0
- package/dist/style.css +769 -19
- package/package.json +5 -4
- package/src/elements/EFAudio.ts +3 -3
- package/src/elements/EFCaptions.browsertest.ts +3 -3
- package/src/elements/EFCaptions.ts +9 -9
- package/src/elements/EFImage.browsertest.ts +2 -2
- package/src/elements/EFImage.ts +4 -4
- package/src/elements/EFMedia.browsertest.ts +6 -6
- package/src/elements/EFMedia.ts +14 -7
- package/src/elements/EFSourceMixin.ts +3 -3
- package/src/elements/EFTemporal.browsertest.ts +1 -1
- package/src/elements/EFTemporal.ts +159 -4
- package/src/elements/EFTimegroup.browsertest.ts +5 -5
- package/src/elements/EFTimegroup.ts +141 -68
- package/src/elements/EFVideo.ts +15 -4
- package/src/elements/EFWaveform.ts +82 -98
- package/src/elements/FetchMixin.ts +2 -2
- package/src/elements/TimegroupController.ts +2 -2
- package/src/elements/durationConverter.ts +1 -1
- package/src/elements/util.ts +1 -1
- package/src/gui/ContextMixin.browsertest.ts +3 -3
- package/src/gui/ContextMixin.ts +37 -49
- package/src/gui/EFFilmstrip.ts +92 -36
- package/src/gui/EFFocusOverlay.ts +79 -0
- package/src/gui/EFPreview.ts +35 -18
- package/src/gui/EFScrubber.ts +3 -3
- package/src/gui/EFTimeDisplay.ts +2 -2
- package/src/gui/EFToggleLoop.ts +4 -4
- package/src/gui/EFTogglePlay.ts +3 -3
- package/src/gui/EFWorkbench.ts +2 -2
- package/src/gui/efContext.ts +1 -1
- package/dist/assets/src/EncodedAsset.js +0 -560
- package/dist/assets/src/MP4File.js +0 -223
- package/dist/assets/src/memoize.js +0 -14
- package/dist/{elements/src/EF_FRAMEGEN.js → EF_FRAMEGEN.js} +0 -0
- package/dist/{elements/src/EF_INTERACTIVE.js → EF_INTERACTIVE.js} +0 -0
- package/dist/{elements/src/EF_RENDERING.js → EF_RENDERING.js} +0 -0
- package/dist/elements/{src/elements/CrossUpdateController.js → CrossUpdateController.js} +0 -0
- package/dist/elements/{src/elements/EFAudio.js → EFAudio.js} +2 -2
- package/dist/elements/{src/elements/EFCaptions.js → EFCaptions.js} +0 -0
- package/dist/elements/{src/elements/EFImage.js → EFImage.js} +0 -0
- package/dist/elements/{src/elements/EFSourceMixin.js → EFSourceMixin.js} +1 -1
- package/dist/elements/{src/elements/FetchMixin.js → FetchMixin.js} +0 -0
- package/dist/elements/{src/elements/TimegroupController.js → TimegroupController.js} +0 -0
- package/dist/elements/{src/elements/durationConverter.js → durationConverter.js} +0 -0
- package/dist/elements/{src/elements/parseTimeToMs.js → parseTimeToMs.js} +0 -0
- package/dist/{elements/src/gui → gui}/EFScrubber.js +0 -0
- package/dist/{elements/src/gui → gui}/EFTimeDisplay.js +0 -0
- package/dist/{elements/src/gui → gui}/EFToggleLoop.js +1 -1
- /package/dist/{elements/src/gui → gui}/EFTogglePlay.js +0 -0
- /package/dist/{elements/src/gui → gui}/EFWorkbench.js +0 -0
- /package/dist/{elements/src/gui → gui}/TWMixin.js +0 -0
- /package/dist/{elements/src/gui → gui}/apiHostContext.js +0 -0
- /package/dist/{elements/src/gui → gui}/efContext.js +0 -0
- /package/dist/{elements/src/gui → gui}/fetchContext.js +0 -0
- /package/dist/{elements/src/gui → gui}/focusContext.js +0 -0
- /package/dist/{elements/src/gui → gui}/focusedElementContext.js +0 -0
- /package/dist/{elements/src/gui → gui}/playingContext.js +0 -0
- /package/dist/{elements/src/msToTimeCode.js → msToTimeCode.js} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Task } from '@lit/task';
|
|
2
2
|
import { LitElement, PropertyValueMap } from 'lit';
|
|
3
|
-
import { EFAudio } from './EFAudio.
|
|
4
|
-
import { EFVideo } from './EFVideo.
|
|
5
|
-
declare const EFCaptionsActiveWord_base: (new (...args: any[]) => import('./EFTemporal.
|
|
3
|
+
import { EFAudio } from './EFAudio.js';
|
|
4
|
+
import { EFVideo } from './EFVideo.js';
|
|
5
|
+
declare const EFCaptionsActiveWord_base: (new (...args: any[]) => import('./EFTemporal.js').TemporalMixinInterface) & typeof LitElement;
|
|
6
6
|
export declare class EFCaptionsActiveWord extends EFCaptionsActiveWord_base {
|
|
7
7
|
static styles: import('lit').CSSResult[];
|
|
8
8
|
render(): import('lit-html').TemplateResult<1> | undefined;
|
|
@@ -13,7 +13,7 @@ export declare class EFCaptionsActiveWord extends EFCaptionsActiveWord_base {
|
|
|
13
13
|
get startTimeMs(): number;
|
|
14
14
|
get durationMs(): number;
|
|
15
15
|
}
|
|
16
|
-
declare const EFCaptionsSegment_base: (new (...args: any[]) => import('./EFTemporal.
|
|
16
|
+
declare const EFCaptionsSegment_base: (new (...args: any[]) => import('./EFTemporal.js').TemporalMixinInterface) & typeof LitElement;
|
|
17
17
|
export declare class EFCaptionsSegment extends EFCaptionsSegment_base {
|
|
18
18
|
static styles: import('lit').CSSResult[];
|
|
19
19
|
render(): import('lit-html').TemplateResult<1> | undefined;
|
|
@@ -44,7 +44,7 @@ export declare class EFCaptionsAfterActiveWord extends EFCaptionsSegment {
|
|
|
44
44
|
get startTimeMs(): number;
|
|
45
45
|
get durationMs(): number;
|
|
46
46
|
}
|
|
47
|
-
declare const EFCaptions_base: (new (...args: any[]) => import('./EFSourceMixin.
|
|
47
|
+
declare const EFCaptions_base: (new (...args: any[]) => import('./EFSourceMixin.js').EFSourceMixinInterface) & (new (...args: any[]) => import('./EFTemporal.js').TemporalMixinInterface) & (new (...args: any[]) => import('./FetchMixin.js').FetchMixinInterface) & typeof LitElement;
|
|
48
48
|
export declare class EFCaptions extends EFCaptions_base {
|
|
49
49
|
static styles: import('lit').CSSResult[];
|
|
50
50
|
displayMode: "word" | "segment" | "context";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Task } from '@lit/task';
|
|
2
2
|
import { LitElement } from 'lit';
|
|
3
|
-
declare const EFImage_base: (new (...args: any[]) => import('./EFSourceMixin.
|
|
3
|
+
declare const EFImage_base: (new (...args: any[]) => import('./EFSourceMixin.js').EFSourceMixinInterface) & (new (...args: any[]) => import('./FetchMixin.js').FetchMixinInterface) & typeof LitElement;
|
|
4
4
|
export declare class EFImage extends EFImage_base {
|
|
5
5
|
#private;
|
|
6
6
|
static styles: import('lit').CSSResult[];
|
|
@@ -5,12 +5,17 @@ import { VideoAsset } from '../../../assets/src/EncodedAsset.ts';
|
|
|
5
5
|
import { MP4File } from '../../../assets/src/MP4File.ts';
|
|
6
6
|
import type * as MP4Box from "mp4box";
|
|
7
7
|
export declare const deepGetMediaElements: (element: Element, medias?: EFMedia[]) => EFMedia[];
|
|
8
|
-
declare const EFMedia_base: (new (...args: any[]) => import('./EFSourceMixin.
|
|
8
|
+
declare const EFMedia_base: (new (...args: any[]) => import('./EFSourceMixin.js').EFSourceMixinInterface) & (new (...args: any[]) => import('./EFTemporal.js').TemporalMixinInterface) & (new (...args: any[]) => import('./FetchMixin.js').FetchMixinInterface) & typeof LitElement;
|
|
9
9
|
export declare class EFMedia extends EFMedia_base {
|
|
10
10
|
#private;
|
|
11
11
|
static styles: import('lit').CSSResult[];
|
|
12
12
|
currentTimeMs: number;
|
|
13
13
|
efHost?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The unique identifier for the media asset.
|
|
16
|
+
* This property can be set programmatically or via the "asset-id" attribute.
|
|
17
|
+
* @domAttribute "asset-id"
|
|
18
|
+
*/
|
|
14
19
|
set assetId(value: string | null);
|
|
15
20
|
get assetId(): string | null;
|
|
16
21
|
fragmentIndexPath(): string;
|
|
@@ -4,8 +4,8 @@ import { deepArrayEquals } from "@lit/task/deep-equals.js";
|
|
|
4
4
|
import debug from "debug";
|
|
5
5
|
import { css, LitElement } from "lit";
|
|
6
6
|
import { property, state } from "lit/decorators.js";
|
|
7
|
-
import { VideoAsset } from "
|
|
8
|
-
import { MP4File } from "
|
|
7
|
+
import { VideoAsset } from "@editframe/assets/EncodedAsset.js";
|
|
8
|
+
import { MP4File } from "@editframe/assets/MP4File.js";
|
|
9
9
|
import { EF_INTERACTIVE } from "../EF_INTERACTIVE.js";
|
|
10
10
|
import { EF_RENDERING } from "../EF_RENDERING.js";
|
|
11
11
|
import { apiHostContext } from "../gui/apiHostContext.js";
|
|
@@ -279,7 +279,7 @@ class EFMedia extends EFSourceMixin(EFTemporal(FetchMixin(LitElement)), {
|
|
|
279
279
|
const animations = this.getAnimations({ subtree: true });
|
|
280
280
|
this.style.setProperty("--ef-duration", `${this.durationMs}ms`);
|
|
281
281
|
this.style.setProperty(
|
|
282
|
-
"--ef-transition
|
|
282
|
+
"--ef-transition-duration",
|
|
283
283
|
`${this.parentTimegroup?.overlapMs ?? 0}ms`
|
|
284
284
|
);
|
|
285
285
|
this.style.setProperty(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
-
declare const TestTemporal_base: (new (...args: any[]) => import('./EFTemporal.
|
|
2
|
+
declare const TestTemporal_base: (new (...args: any[]) => import('./EFTemporal.js').TemporalMixinInterface) & typeof LitElement;
|
|
3
3
|
declare class TestTemporal extends TestTemporal_base {
|
|
4
4
|
}
|
|
5
5
|
declare global {
|
|
@@ -1,32 +1,175 @@
|
|
|
1
1
|
import { LitElement, ReactiveController } from 'lit';
|
|
2
|
-
import { EFTimegroup } from './EFTimegroup.
|
|
2
|
+
import { EFTimegroup } from './EFTimegroup.js';
|
|
3
3
|
import { Task } from '@lit/task';
|
|
4
4
|
export declare const timegroupContext: {
|
|
5
5
|
__context__: EFTimegroup;
|
|
6
6
|
};
|
|
7
7
|
export declare class TemporalMixinInterface {
|
|
8
8
|
get hasOwnDuration(): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Used to trim the start of the media.
|
|
11
|
+
*
|
|
12
|
+
* This can be set in either seconds or milliseconds.
|
|
13
|
+
*
|
|
14
|
+
* For example, `trimstart="10s"` is equivalent to `trimstart="10000ms"`.
|
|
15
|
+
*
|
|
16
|
+
* @domAttribute "trimstart"
|
|
17
|
+
*/
|
|
9
18
|
get trimStartMs(): number;
|
|
19
|
+
/**
|
|
20
|
+
* Used to trim the end of the media.
|
|
21
|
+
*
|
|
22
|
+
* This can be set in either seconds or milliseconds.
|
|
23
|
+
*
|
|
24
|
+
* For example, `trimend="10s"` is equivalent to `trimend="10000ms"`.
|
|
25
|
+
*
|
|
26
|
+
* @domAttribute "trimend"
|
|
27
|
+
*/
|
|
10
28
|
get trimEndMs(): number;
|
|
11
29
|
set trimStartMs(value: number);
|
|
12
30
|
set trimEndMs(value: number);
|
|
13
31
|
set trimstart(value: string);
|
|
14
32
|
set trimend(value: string);
|
|
33
|
+
/**
|
|
34
|
+
* The source in time of the element.
|
|
35
|
+
*
|
|
36
|
+
* This is an amount of time to trim off the beginning of the media.
|
|
37
|
+
*
|
|
38
|
+
* This can be set in either seconds or milliseconds.
|
|
39
|
+
*
|
|
40
|
+
* For example, `sourcein="10s"` is equivalent to `sourcein="10000ms"`.
|
|
41
|
+
*
|
|
42
|
+
* If the sourcein time is greater than the duration of the media, the media
|
|
43
|
+
* will not be played.
|
|
44
|
+
*
|
|
45
|
+
* If the media is 20 seconds long, and the `sourcein` value is set to `10s`, the
|
|
46
|
+
* media will play for 10 seconds, starting at the 10 second mark.
|
|
47
|
+
*
|
|
48
|
+
* Can be used in conjunction with `sourceout` to create a trimmed media.
|
|
49
|
+
*
|
|
50
|
+
* @domAttribute "sourcein"
|
|
51
|
+
*/
|
|
15
52
|
get sourceInMs(): number;
|
|
53
|
+
/**
|
|
54
|
+
* The source out time of the element.
|
|
55
|
+
*
|
|
56
|
+
* This is the point in time in the media that will be treated as the end of
|
|
57
|
+
* the media.
|
|
58
|
+
*
|
|
59
|
+
* This can be set in either seconds or milliseconds.
|
|
60
|
+
*
|
|
61
|
+
* For example, `sourceout="10s"` is equivalent to `sourceout="10000ms"`.
|
|
62
|
+
*
|
|
63
|
+
* If the sourceout time is greater than the duration of the media, the media
|
|
64
|
+
* will play until the end of the media.
|
|
65
|
+
*
|
|
66
|
+
* If the media is 20 seconds long, and the `sourceout` value is set to `10s`,
|
|
67
|
+
* the media will play for 10 seconds, starting at zero seconds and ending at
|
|
68
|
+
* the 10 second mark.
|
|
69
|
+
*
|
|
70
|
+
* Can be used in conjunction with `sourcein` to create a trimmed media.
|
|
71
|
+
*
|
|
72
|
+
* @domAttribute "sourceout"
|
|
73
|
+
*/
|
|
16
74
|
get sourceOutMs(): number;
|
|
17
75
|
set sourceInMs(value: number);
|
|
18
76
|
set sourceOutMs(value: number);
|
|
19
77
|
set sourcein(value: string);
|
|
20
78
|
set sourceout(value: string);
|
|
79
|
+
/**
|
|
80
|
+
* @domAttribute "duration"
|
|
81
|
+
*/
|
|
21
82
|
get durationMs(): number;
|
|
83
|
+
/**
|
|
84
|
+
* The start time of the element within its root timegroup in milliseconds.
|
|
85
|
+
*
|
|
86
|
+
* This is an absolute time according to the highest scoped timegroup the media element is contained within.
|
|
87
|
+
*
|
|
88
|
+
* The calculated value will depend on the mode of the timegroup and the offset of the media element.
|
|
89
|
+
*
|
|
90
|
+
* If the parent time group is in `sequence` mode, the start time will be the
|
|
91
|
+
* start time of the previous sibling element plus the previous sibling's duration
|
|
92
|
+
* minus the overlap of the previous sibling and the current sibling.
|
|
93
|
+
*
|
|
94
|
+
* If the parent time group is in `contain` or `fixed` mode, the start time will be
|
|
95
|
+
* the start time of the parent time group plus the offset of the media element.
|
|
96
|
+
*/
|
|
22
97
|
get startTimeMs(): number;
|
|
23
|
-
|
|
98
|
+
/**
|
|
99
|
+
* The end time of the element within its root timegroup in milliseconds.
|
|
100
|
+
*
|
|
101
|
+
* This is an absolute time according to the highest scoped timegroup the media
|
|
102
|
+
* element is contained within. Computed by adding the media's duration to its
|
|
103
|
+
* start time.
|
|
104
|
+
*
|
|
105
|
+
* If the media element has been trimmed, its end time will be calculated according it
|
|
106
|
+
* its trimmed duration, not its original duration.
|
|
107
|
+
*/
|
|
24
108
|
get endTimeMs(): number;
|
|
109
|
+
/**
|
|
110
|
+
* The start time of the element within its parent timegroup in milliseconds.
|
|
111
|
+
*
|
|
112
|
+
* This is a relative time according to the closest timegroup the media element
|
|
113
|
+
* is contained within. Unless the media element has been given any kind of specific offset
|
|
114
|
+
* it is common for this time to be zero.
|
|
115
|
+
*/
|
|
116
|
+
get startTimeWithinParentMs(): number;
|
|
117
|
+
/**
|
|
118
|
+
* The current time of the element in milliseconds.
|
|
119
|
+
*
|
|
120
|
+
* This is a relative time according to the closest timegroup the media element
|
|
121
|
+
* is contained within.
|
|
122
|
+
*
|
|
123
|
+
* This is suitable for determining the percentage of the media that has been
|
|
124
|
+
* played.
|
|
125
|
+
*/
|
|
25
126
|
get ownCurrentTimeMs(): number;
|
|
127
|
+
/**
|
|
128
|
+
* The current time of the element in milliseconds, adjusted for trimming.
|
|
129
|
+
*
|
|
130
|
+
* This is suitable for mapping to internal media time codes for audio/video
|
|
131
|
+
* elements.
|
|
132
|
+
*
|
|
133
|
+
* For example, if the media has a `sourcein` value of 10s, when `ownCurrentTimeMs` is 0s,
|
|
134
|
+
* `trimAdjustedOwnCurrentTimeMs` will be 10s.
|
|
135
|
+
*
|
|
136
|
+
* sourcein=10s sourceout=10s
|
|
137
|
+
* / / /
|
|
138
|
+
* |--------|=================|---------|
|
|
139
|
+
* ^
|
|
140
|
+
* |_
|
|
141
|
+
* trimAdjustedOwnCurrentTimeMs === 10s
|
|
142
|
+
* |_
|
|
143
|
+
* ownCurrentTimeMs === 0s
|
|
144
|
+
*/
|
|
26
145
|
get trimAdjustedOwnCurrentTimeMs(): number;
|
|
27
146
|
set duration(value: string);
|
|
28
147
|
get duration(): string;
|
|
148
|
+
/**
|
|
149
|
+
* The offset of the element within its parent timegroup in milliseconds.
|
|
150
|
+
*
|
|
151
|
+
* This can be set in either seconds or milliseconds.
|
|
152
|
+
*
|
|
153
|
+
* For example, `offset="10s"` is equivalent to `offset="10000ms"`.
|
|
154
|
+
*
|
|
155
|
+
* This can be used to create a negative or positive offset for the start time of the media.
|
|
156
|
+
*
|
|
157
|
+
* This will change the start time of the media relative to it's otherwise normal start time.
|
|
158
|
+
*
|
|
159
|
+
* The duration of the element, or it's parent, or the start and end time of it's temporal siblings will not
|
|
160
|
+
* be affected by this offset.
|
|
161
|
+
*
|
|
162
|
+
* @domAttribute "offset"
|
|
163
|
+
*/
|
|
164
|
+
set offset(value: string);
|
|
165
|
+
get offset(): string;
|
|
166
|
+
/**
|
|
167
|
+
* A convenience property for getting the nearest containing timegroup of the media element.
|
|
168
|
+
*/
|
|
29
169
|
parentTimegroup?: EFTimegroup;
|
|
170
|
+
/**
|
|
171
|
+
* A convenience property for getting the root timegroup of the media element.
|
|
172
|
+
*/
|
|
30
173
|
rootTimegroup?: EFTimegroup;
|
|
31
174
|
frameTask: Task<readonly unknown[], unknown>;
|
|
32
175
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LitElement } from 'lit';
|
|
2
|
-
declare const TestContext_base: (new (...args: any[]) => import('../gui/ContextMixin.
|
|
2
|
+
declare const TestContext_base: (new (...args: any[]) => import('../gui/ContextMixin.js').ContextMixinInterface) & typeof LitElement;
|
|
3
3
|
declare class TestContext extends TestContext_base {
|
|
4
4
|
}
|
|
5
|
-
declare const TestTemporal_base: (new (...args: any[]) => import('./EFTemporal.
|
|
5
|
+
declare const TestTemporal_base: (new (...args: any[]) => import('./EFTemporal.js').TemporalMixinInterface) & typeof LitElement;
|
|
6
6
|
declare class TestTemporal extends TestTemporal_base {
|
|
7
7
|
get hasOwnDuration(): boolean;
|
|
8
8
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Task } from '@lit/task';
|
|
2
2
|
import { LitElement, PropertyValueMap } from 'lit';
|
|
3
3
|
export declare const shallowGetTimegroups: (element: Element, groups?: EFTimegroup[]) => EFTimegroup[];
|
|
4
|
-
declare const EFTimegroup_base: (new (...args: any[]) => import('./EFTemporal.
|
|
4
|
+
declare const EFTimegroup_base: (new (...args: any[]) => import('./EFTemporal.js').TemporalMixinInterface) & typeof LitElement;
|
|
5
5
|
export declare class EFTimegroup extends EFTimegroup_base {
|
|
6
6
|
#private;
|
|
7
7
|
static styles: import('lit').CSSResult;
|
|
8
8
|
_timeGroupContext: this;
|
|
9
9
|
mode: "fixed" | "sequence" | "contain";
|
|
10
10
|
overlapMs: number;
|
|
11
|
+
fit: "none" | "contain" | "cover";
|
|
11
12
|
set currentTime(time: number);
|
|
12
13
|
get currentTime(): number;
|
|
13
14
|
get currentTimeMs(): number;
|
|
@@ -15,6 +16,9 @@ export declare class EFTimegroup extends EFTimegroup_base {
|
|
|
15
16
|
render(): import('lit-html').TemplateResult<1>;
|
|
16
17
|
maybeLoadTimeFromLocalStorage(): number;
|
|
17
18
|
connectedCallback(): void;
|
|
19
|
+
disconnectedCallback(): void;
|
|
20
|
+
private get displayedParent();
|
|
21
|
+
private updateScale;
|
|
18
22
|
get storageKey(): string;
|
|
19
23
|
get durationMs(): number;
|
|
20
24
|
/**
|
|
@@ -28,9 +32,10 @@ export declare class EFTimegroup extends EFTimegroup_base {
|
|
|
28
32
|
buffer: import('mp4box').MP4ArrayBuffer;
|
|
29
33
|
mp4File: import('../../../assets/src/MP4File.ts').MP4File;
|
|
30
34
|
}[] | undefined)[]>;
|
|
31
|
-
get childTemporals(): import('./EFTemporal.
|
|
35
|
+
get childTemporals(): import('./EFTemporal.js').TemporalMixinInterface[];
|
|
32
36
|
protected updated(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
|
33
|
-
|
|
37
|
+
private updateAnimations;
|
|
38
|
+
get contextProvider(): import('../gui/ContextMixin.js').ContextMixinInterface | null;
|
|
34
39
|
/**
|
|
35
40
|
* Returns true if the timegroup should be wrapped with a workbench.
|
|
36
41
|
*
|
|
@@ -27,7 +27,7 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
|
|
|
27
27
|
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);
|
|
28
28
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
|
|
29
29
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
30
|
-
var _currentTime, _EFTimegroup_instances, addAudioToContext_fn;
|
|
30
|
+
var _currentTime, _resizeObserver, _EFTimegroup_instances, addAudioToContext_fn;
|
|
31
31
|
const log = debug("ef:elements:EFTimegroup");
|
|
32
32
|
const shallowGetTimegroups = (element, groups = []) => {
|
|
33
33
|
for (const child of Array.from(element.children)) {
|
|
@@ -47,6 +47,8 @@ let EFTimegroup = class extends EFTemporal(LitElement) {
|
|
|
47
47
|
__privateAdd(this, _currentTime, 0);
|
|
48
48
|
this.mode = "sequence";
|
|
49
49
|
this.overlapMs = 0;
|
|
50
|
+
this.fit = "none";
|
|
51
|
+
__privateAdd(this, _resizeObserver);
|
|
50
52
|
this.frameTask = new Task(this, {
|
|
51
53
|
autoRun: EF_INTERACTIVE,
|
|
52
54
|
args: () => [this.ownCurrentTimeMs, this.currentTimeMs],
|
|
@@ -105,6 +107,44 @@ let EFTimegroup = class extends EFTemporal(LitElement) {
|
|
|
105
107
|
if (this.shouldWrapWithWorkbench()) {
|
|
106
108
|
this.wrapWithWorkbench();
|
|
107
109
|
}
|
|
110
|
+
__privateSet(this, _resizeObserver, new ResizeObserver(() => this.updateScale()));
|
|
111
|
+
if (this.parentElement) {
|
|
112
|
+
__privateGet(this, _resizeObserver).observe(this.parentElement);
|
|
113
|
+
}
|
|
114
|
+
this.updateScale();
|
|
115
|
+
requestAnimationFrame(() => this.updateAnimations());
|
|
116
|
+
}
|
|
117
|
+
disconnectedCallback() {
|
|
118
|
+
super.disconnectedCallback();
|
|
119
|
+
__privateGet(this, _resizeObserver)?.disconnect();
|
|
120
|
+
}
|
|
121
|
+
get displayedParent() {
|
|
122
|
+
let displayedParent = this.parentElement;
|
|
123
|
+
while (displayedParent && getComputedStyle(displayedParent).display === "contents") {
|
|
124
|
+
displayedParent = displayedParent.parentElement;
|
|
125
|
+
}
|
|
126
|
+
return displayedParent;
|
|
127
|
+
}
|
|
128
|
+
updateScale() {
|
|
129
|
+
if (this.fit === "none") return;
|
|
130
|
+
const displayedParent = this.displayedParent;
|
|
131
|
+
if (!displayedParent) return;
|
|
132
|
+
const contentWidth = this.clientWidth;
|
|
133
|
+
const contentHeight = this.clientHeight;
|
|
134
|
+
const containerWidth = displayedParent.clientWidth;
|
|
135
|
+
const containerHeight = displayedParent.clientHeight;
|
|
136
|
+
const widthRatio = containerWidth / contentWidth;
|
|
137
|
+
const heightRatio = containerHeight / contentHeight;
|
|
138
|
+
let scale;
|
|
139
|
+
if (this.fit === "contain") {
|
|
140
|
+
scale = heightRatio;
|
|
141
|
+
if (contentWidth * scale > containerWidth) {
|
|
142
|
+
scale = widthRatio;
|
|
143
|
+
}
|
|
144
|
+
} else {
|
|
145
|
+
scale = Math.max(widthRatio, heightRatio);
|
|
146
|
+
}
|
|
147
|
+
this.style.transform = `scale(${scale})`;
|
|
108
148
|
}
|
|
109
149
|
get storageKey() {
|
|
110
150
|
if (!this.id) {
|
|
@@ -158,64 +198,71 @@ let EFTimegroup = class extends EFTemporal(LitElement) {
|
|
|
158
198
|
updated(changedProperties) {
|
|
159
199
|
super.updated(changedProperties);
|
|
160
200
|
if (changedProperties.has("currentTime") || changedProperties.has("ownCurrentTimeMs")) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
201
|
+
this.updateAnimations();
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
updateAnimations() {
|
|
205
|
+
this.style.setProperty(
|
|
206
|
+
"--ef-progress",
|
|
207
|
+
`${Math.max(0, Math.min(1, this.currentTimeMs / this.durationMs)) * 100}%`
|
|
208
|
+
);
|
|
209
|
+
const timelineTimeMs = (this.rootTimegroup ?? this).currentTimeMs;
|
|
210
|
+
if (this.startTimeMs > timelineTimeMs || this.endTimeMs < timelineTimeMs) {
|
|
211
|
+
this.style.display = "none";
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
this.style.display = "";
|
|
215
|
+
const animations = this.getAnimations({ subtree: true });
|
|
216
|
+
this.style.setProperty("--ef-duration", `${this.durationMs}ms`);
|
|
217
|
+
this.style.setProperty(
|
|
218
|
+
"--ef-transition-duration",
|
|
219
|
+
`${this.parentTimegroup?.overlapMs ?? 0}ms`
|
|
220
|
+
);
|
|
221
|
+
this.style.setProperty(
|
|
222
|
+
"--ef-transition-out-start",
|
|
223
|
+
`${this.durationMs - (this.parentTimegroup?.overlapMs ?? 0)}ms`
|
|
224
|
+
);
|
|
225
|
+
for (const animation of animations) {
|
|
226
|
+
if (animation.playState === "running") {
|
|
227
|
+
animation.pause();
|
|
228
|
+
}
|
|
229
|
+
const effect = animation.effect;
|
|
230
|
+
if (!(effect && effect instanceof KeyframeEffect)) {
|
|
164
231
|
return;
|
|
165
232
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
const effect = animation.effect;
|
|
182
|
-
if (!(effect && effect instanceof KeyframeEffect)) {
|
|
233
|
+
const target = effect.target;
|
|
234
|
+
if (!target) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if (target.closest("ef-timegroup") !== this) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
if (isEFTemporal(target)) {
|
|
241
|
+
const timing = effect.getTiming();
|
|
242
|
+
const duration = Number(timing.duration) ?? 0;
|
|
243
|
+
const delay = Number(timing.delay);
|
|
244
|
+
const newTime = Math.floor(
|
|
245
|
+
Math.min(target.ownCurrentTimeMs, duration - 1 + delay)
|
|
246
|
+
);
|
|
247
|
+
if (Number.isNaN(newTime)) {
|
|
183
248
|
return;
|
|
184
249
|
}
|
|
185
|
-
|
|
186
|
-
|
|
250
|
+
animation.currentTime = newTime;
|
|
251
|
+
} else if (target) {
|
|
252
|
+
const nearestTimegroup = target.closest("ef-timegroup");
|
|
253
|
+
if (!nearestTimegroup) {
|
|
187
254
|
return;
|
|
188
255
|
}
|
|
189
|
-
|
|
256
|
+
const timing = effect.getTiming();
|
|
257
|
+
const duration = Number(timing.duration) ?? 0;
|
|
258
|
+
const delay = Number(timing.delay);
|
|
259
|
+
const newTime = Math.floor(
|
|
260
|
+
Math.min(nearestTimegroup.ownCurrentTimeMs, duration - 1 + delay)
|
|
261
|
+
);
|
|
262
|
+
if (Number.isNaN(newTime)) {
|
|
190
263
|
return;
|
|
191
264
|
}
|
|
192
|
-
|
|
193
|
-
const timing = effect.getTiming();
|
|
194
|
-
const duration = Number(timing.duration) ?? 0;
|
|
195
|
-
const delay = Number(timing.delay);
|
|
196
|
-
const newTime = Math.floor(
|
|
197
|
-
Math.min(target.ownCurrentTimeMs, duration - 1 + delay)
|
|
198
|
-
);
|
|
199
|
-
if (Number.isNaN(newTime)) {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
animation.currentTime = newTime;
|
|
203
|
-
} else if (target) {
|
|
204
|
-
const nearestTimegroup = target.closest("ef-timegroup");
|
|
205
|
-
if (!nearestTimegroup) {
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
const timing = effect.getTiming();
|
|
209
|
-
const duration = Number(timing.duration) ?? 0;
|
|
210
|
-
const delay = Number(timing.delay);
|
|
211
|
-
const newTime = Math.floor(
|
|
212
|
-
Math.min(nearestTimegroup.ownCurrentTimeMs, duration - 1 + delay)
|
|
213
|
-
);
|
|
214
|
-
if (Number.isNaN(newTime)) {
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
animation.currentTime = newTime;
|
|
218
|
-
}
|
|
265
|
+
animation.currentTime = newTime;
|
|
219
266
|
}
|
|
220
267
|
}
|
|
221
268
|
}
|
|
@@ -294,6 +341,7 @@ let EFTimegroup = class extends EFTemporal(LitElement) {
|
|
|
294
341
|
}
|
|
295
342
|
};
|
|
296
343
|
_currentTime = /* @__PURE__ */ new WeakMap();
|
|
344
|
+
_resizeObserver = /* @__PURE__ */ new WeakMap();
|
|
297
345
|
_EFTimegroup_instances = /* @__PURE__ */ new WeakSet();
|
|
298
346
|
addAudioToContext_fn = async function(audioContext, fromMs, toMs) {
|
|
299
347
|
await this.waitForMediaDurations();
|
|
@@ -331,8 +379,8 @@ EFTimegroup.styles = css`
|
|
|
331
379
|
display: block;
|
|
332
380
|
width: 100%;
|
|
333
381
|
height: 100%;
|
|
334
|
-
position:
|
|
335
|
-
|
|
382
|
+
position: relative;
|
|
383
|
+
transform-origin: center center;
|
|
336
384
|
}
|
|
337
385
|
`;
|
|
338
386
|
__decorateClass([
|
|
@@ -351,6 +399,9 @@ __decorateClass([
|
|
|
351
399
|
attribute: "overlap"
|
|
352
400
|
})
|
|
353
401
|
], EFTimegroup.prototype, "overlapMs", 2);
|
|
402
|
+
__decorateClass([
|
|
403
|
+
property({ type: String })
|
|
404
|
+
], EFTimegroup.prototype, "fit", 2);
|
|
354
405
|
__decorateClass([
|
|
355
406
|
property({ type: Number })
|
|
356
407
|
], EFTimegroup.prototype, "currentTime", 1);
|
|
@@ -66,8 +66,16 @@ let EFVideo = class extends TWMixin(EFMedia) {
|
|
|
66
66
|
if (!(frame && ctx)) {
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
if (frame?.codedWidth && frame?.codedHeight) {
|
|
70
|
+
if (this.canvasElement.width !== frame.codedWidth || this.canvasElement.height !== frame.codedHeight) {
|
|
71
|
+
this.canvasElement.width = frame.codedWidth;
|
|
72
|
+
this.canvasElement.height = frame.codedHeight;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (frame.format === null) {
|
|
76
|
+
console.warn("Frame format is null", frame);
|
|
77
|
+
return seekToMs;
|
|
78
|
+
}
|
|
71
79
|
ctx.drawImage(
|
|
72
80
|
frame,
|
|
73
81
|
0,
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { EFAudio } from './EFAudio.
|
|
1
|
+
import { EFAudio } from './EFAudio.js';
|
|
2
2
|
import { Task } from '@lit/task';
|
|
3
3
|
import { LitElement, PropertyValueMap } from 'lit';
|
|
4
4
|
import { Ref } from 'lit/directives/ref.js';
|
|
5
|
-
import { EFVideo } from './EFVideo.
|
|
6
|
-
declare const EFWaveform_base: (new (...args: any[]) => import('./EFTemporal.
|
|
5
|
+
import { EFVideo } from './EFVideo.js';
|
|
6
|
+
declare const EFWaveform_base: (new (...args: any[]) => import('./EFTemporal.js').TemporalMixinInterface) & typeof LitElement;
|
|
7
7
|
export declare class EFWaveform extends EFWaveform_base {
|
|
8
8
|
static styles: import('lit').CSSResult[];
|
|
9
9
|
canvasRef: Ref<HTMLCanvasElement>;
|
|
10
10
|
private ctx;
|
|
11
|
+
private resizeObserver?;
|
|
12
|
+
private mutationObserver?;
|
|
11
13
|
createRenderRoot(): this;
|
|
12
14
|
render(): import('lit-html').TemplateResult<1>;
|
|
13
15
|
mode: "roundBars" | "bars" | "bricks" | "equalizer" | "curve" | "line" | "pixel" | "wave";
|
|
@@ -15,6 +17,8 @@ export declare class EFWaveform extends EFWaveform_base {
|
|
|
15
17
|
targetSelector: string;
|
|
16
18
|
set target(value: string);
|
|
17
19
|
connectedCallback(): void;
|
|
20
|
+
disconnectedCallback(): void;
|
|
21
|
+
private resizeCanvas;
|
|
18
22
|
protected initCanvas(): CanvasRenderingContext2D | null;
|
|
19
23
|
protected drawBars(ctx: CanvasRenderingContext2D, frequencyData: Uint8Array): void;
|
|
20
24
|
protected drawBricks(ctx: CanvasRenderingContext2D, frequencyData: Uint8Array): void;
|
|
@@ -24,7 +28,6 @@ export declare class EFWaveform extends EFWaveform_base {
|
|
|
24
28
|
protected drawCurve(ctx: CanvasRenderingContext2D, frequencyData: Uint8Array): void;
|
|
25
29
|
protected drawPixel(ctx: CanvasRenderingContext2D, frequencyData: Uint8Array): void;
|
|
26
30
|
protected drawWave(ctx: CanvasRenderingContext2D, frequencyData: Uint8Array): void;
|
|
27
|
-
private lastFrameTime;
|
|
28
31
|
frameTask: Task<readonly [import('@lit/task').TaskStatus], void>;
|
|
29
32
|
get durationMs(): number;
|
|
30
33
|
get targetElement(): EFAudio | EFVideo;
|