@editframe/elements 0.55.1 → 0.56.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/dist/elements/EFTemporal.d.ts +2 -0
- package/dist/elements/EFTemporal.js +12 -0
- package/dist/elements/EFTemporal.js.map +1 -1
- package/dist/elements/EFTimegroup.d.ts +3 -5
- package/dist/elements/EFTimegroup.js +3 -35
- package/dist/elements/EFTimegroup.js.map +1 -1
- package/dist/elements/EFVideo.js +1 -47
- package/dist/elements/EFVideo.js.map +1 -1
- package/dist/gui/ContextMixin.d.ts +2 -0
- package/dist/gui/ContextMixin.js +44 -0
- package/dist/gui/ContextMixin.js.map +1 -1
- package/dist/gui/Controllable.d.ts +2 -0
- package/dist/gui/Controllable.js +6 -0
- package/dist/gui/Controllable.js.map +1 -1
- package/dist/gui/EFControls.d.ts +2 -0
- package/dist/gui/EFControls.js +14 -1
- package/dist/gui/EFControls.js.map +1 -1
- package/dist/gui/EFFullscreen.d.ts +38 -0
- package/dist/gui/EFFullscreen.js +50 -0
- package/dist/gui/EFFullscreen.js.map +1 -0
- package/dist/gui/EFMute.d.ts +40 -0
- package/dist/gui/EFMute.js +41 -0
- package/dist/gui/EFMute.js.map +1 -0
- package/dist/gui/EFPIP.d.ts +43 -0
- package/dist/gui/EFPIP.js +89 -0
- package/dist/gui/EFPIP.js.map +1 -0
- package/dist/gui/EFResolution.d.ts +47 -0
- package/dist/gui/EFResolution.js +203 -0
- package/dist/gui/EFResolution.js.map +1 -0
- package/dist/gui/EFVolume.d.ts +44 -0
- package/dist/gui/EFVolume.js +125 -0
- package/dist/gui/EFVolume.js.map +1 -0
- package/dist/gui/PlaybackController.d.ts +5 -1
- package/dist/gui/PlaybackController.js +50 -1
- package/dist/gui/PlaybackController.js.map +1 -1
- package/dist/gui/icons.js +5 -1
- package/dist/gui/icons.js.map +1 -1
- package/dist/gui/volumeContext.d.ts +10 -0
- package/dist/gui/volumeContext.js +8 -0
- package/dist/gui/volumeContext.js.map +1 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/preview/renderElementToCanvas.js +1 -1
- package/dist/preview/renderTimegroupToCanvas.js +1 -1
- package/dist/preview/renderTimegroupToVideo.js +1 -1
- package/dist/preview/rendering/serializeTimelineDirect.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
package/dist/gui/Controllable.js
CHANGED
|
@@ -44,6 +44,12 @@ function createDirectTemporalSubscription(target, callbacks) {
|
|
|
44
44
|
case "currentTimeMs":
|
|
45
45
|
callbacks.onCurrentTimeMsChange(event.value);
|
|
46
46
|
break;
|
|
47
|
+
case "volume":
|
|
48
|
+
callbacks.onVolumeChange?.(event.value);
|
|
49
|
+
break;
|
|
50
|
+
case "muted":
|
|
51
|
+
callbacks.onMutedChange?.(event.value);
|
|
52
|
+
break;
|
|
47
53
|
}
|
|
48
54
|
};
|
|
49
55
|
controller.addListener(listener);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Controllable.js","names":[],"sources":["../../src/gui/Controllable.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Controllable.js","names":[],"sources":["../../src/gui/Controllable.ts"],"mappings":";;;AAmBA,SAAgB,eAAe,OAA4C;AACzE,KAAI,CAAC,SAAS,OAAO,UAAU,SAC7B,QAAO;AAGT,KAAI,eAAe,MAAM,CACvB,QAAO;AAGT,KAAI,aAAa,MAAM,CAErB,QADiB,MACD,uBAAuB,KAAA;AAGzC,QAAO;;;;;;;;;AA0BT,SAAgB,oBAAoB,QAAyC;AAC3E,KAAI,CAAC,OAAQ,QAAO;AAEpB,KAAI,eAAe,OAAO,CACxB,QAAO;AAGT,KAAI,aAAa,OAAO;MACL,OAGJ,mBACX,QAAO;;AAIX,QAAO;;;;;;AA6BT,SAAgB,iCACd,QACA,WAC0B;CAC1B,MAAM,aAAa,OAAO;AAG1B,WAAU,gBAAgB,WAAW,QAAQ;AAC7C,WAAU,aAAa,WAAW,KAAK;AACvC,WAAU,sBAAsB,WAAW,cAAc;AACzD,WAAU,mBAAmB,OAAO,WAAW;AAC/C,WAAU,uBAAuB,OAAO;CAGxC,MAAM,YAAY,UAAyC;AACzD,UAAQ,MAAM,UAAd;GACE,KAAK;AACH,cAAU,gBAAgB,MAAM,MAAiB;AACjD;GACF,KAAK;AACH,cAAU,aAAa,MAAM,MAAiB;AAC9C;GACF,KAAK;AACH,cAAU,sBAAsB,MAAM,MAAgB;AACtD;GACF,KAAK;AACH,cAAU,iBAAiB,MAAM,MAAgB;AACjD;GACF,KAAK;AACH,cAAU,gBAAgB,MAAM,MAAiB;AACjD;;;AAGN,YAAW,YAAY,SAAS;CAGhC,MAAM,mBAAmB,IAAI,uBAAuB;AAClD,YAAU,mBAAmB,OAAO,WAAW;GAC/C;AACF,kBAAiB,QAAQ,QAAQ;EAC/B,YAAY;EACZ,iBAAiB;GAAC;GAAY;GAAa;GAAW;GAAY;GAAY;EAC9E,SAAS;EACV,CAAC;CAIF,IAAI,oBAAoB,OAAO;CAC/B,IAAI,uBAA8D;AAIlE,KAAI,sBAAsB,EACxB,wBAAuB,kBAAkB;EACvC,MAAM,kBAAkB,OAAO;AAC/B,MAAI,oBAAoB,mBAAmB;AACzC,uBAAoB;AACpB,aAAU,mBAAmB,gBAAgB;AAE7C,OAAI,kBAAkB,KAAK,sBAAsB;AAC/C,kBAAc,qBAAqB;AACnC,2BAAuB;;;IAG1B,IAAI;AAGT,QAAO,EACL,mBAAmB;AACjB,aAAW,eAAe,SAAS;AACnC,mBAAiB,YAAY;AAC7B,MAAI,qBACF,eAAc,qBAAqB;IAGxC"}
|
package/dist/gui/EFControls.d.ts
CHANGED
|
@@ -41,6 +41,8 @@ declare class EFControls extends LitElement {
|
|
|
41
41
|
durationMs: number;
|
|
42
42
|
targetTemporal: TemporalMixinInterface | null;
|
|
43
43
|
focusedElement?: HTMLElement;
|
|
44
|
+
volume: number;
|
|
45
|
+
muted: boolean;
|
|
44
46
|
focusContext: FocusContext;
|
|
45
47
|
updated(changedProperties: PropertyValueMap<this>): void;
|
|
46
48
|
disconnectedCallback(): void;
|
package/dist/gui/EFControls.js
CHANGED
|
@@ -4,6 +4,7 @@ import { __decorate } from "../_virtual/_@oxc-project_runtime@0.122.0/helpers/de
|
|
|
4
4
|
import { currentTimeContext } from "./currentTimeContext.js";
|
|
5
5
|
import { durationContext } from "./durationContext.js";
|
|
6
6
|
import { loopContext, playingContext } from "./playingContext.js";
|
|
7
|
+
import { mutedContext, volumeContext } from "./volumeContext.js";
|
|
7
8
|
import { isEFTemporal } from "../elements/EFTemporal.js";
|
|
8
9
|
import { focusContext } from "./focusContext.js";
|
|
9
10
|
import { focusedElementContext } from "./focusedElementContext.js";
|
|
@@ -34,7 +35,9 @@ const proxiedContexts = [
|
|
|
34
35
|
[(proxy, value) => proxy.durationMs = value, durationContext],
|
|
35
36
|
[(proxy, value) => proxy.targetTemporal = value, targetTemporalContext],
|
|
36
37
|
[(proxy, value) => proxy.focusedElement = value, focusedElementContext],
|
|
37
|
-
[(proxy, value) => proxy.focusContext.focusedElement = value, focusContext]
|
|
38
|
+
[(proxy, value) => proxy.focusContext.focusedElement = value, focusContext],
|
|
39
|
+
[(proxy, value) => proxy.volume = value, volumeContext],
|
|
40
|
+
[(proxy, value) => proxy.muted = value, mutedContext]
|
|
38
41
|
];
|
|
39
42
|
createContext("test");
|
|
40
43
|
let EFControls = class EFControls extends LitElement {
|
|
@@ -47,6 +50,8 @@ let EFControls = class EFControls extends LitElement {
|
|
|
47
50
|
this.currentTimeMs = 0;
|
|
48
51
|
this.durationMs = 0;
|
|
49
52
|
this.targetTemporal = null;
|
|
53
|
+
this.volume = 1;
|
|
54
|
+
this.muted = false;
|
|
50
55
|
this.focusContext = this;
|
|
51
56
|
}
|
|
52
57
|
static {
|
|
@@ -161,6 +166,12 @@ let EFControls = class EFControls extends LitElement {
|
|
|
161
166
|
},
|
|
162
167
|
onFocusedElementChange: (value) => {
|
|
163
168
|
this.focusedElement = value;
|
|
169
|
+
},
|
|
170
|
+
onVolumeChange: (value) => {
|
|
171
|
+
this.volume = value;
|
|
172
|
+
},
|
|
173
|
+
onMutedChange: (value) => {
|
|
174
|
+
this.muted = value;
|
|
164
175
|
}
|
|
165
176
|
});
|
|
166
177
|
}
|
|
@@ -185,6 +196,8 @@ __decorate([provide({ context: currentTimeContext }), state()], EFControls.proto
|
|
|
185
196
|
__decorate([provide({ context: durationContext }), state()], EFControls.prototype, "durationMs", void 0);
|
|
186
197
|
__decorate([provide({ context: targetTemporalContext }), state()], EFControls.prototype, "targetTemporal", void 0);
|
|
187
198
|
__decorate([provide({ context: focusedElementContext }), state()], EFControls.prototype, "focusedElement", void 0);
|
|
199
|
+
__decorate([provide({ context: volumeContext }), state()], EFControls.prototype, "volume", void 0);
|
|
200
|
+
__decorate([provide({ context: mutedContext }), state()], EFControls.prototype, "muted", void 0);
|
|
188
201
|
__decorate([provide({ context: focusContext })], EFControls.prototype, "focusContext", void 0);
|
|
189
202
|
EFControls = __decorate([customElement("ef-controls")], EFControls);
|
|
190
203
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EFControls.js","names":["#subscribeAbortController","#contextUnsubscribeMap","#directTemporalSubscription","#subscribeToContextProvider","#subscribeToDirectTemporal","#waitForTemporalToInitialize","#unsubscribe","#subscribe","#resubscribe"],"sources":["../../src/gui/EFControls.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EFControls.js","names":["#subscribeAbortController","#contextUnsubscribeMap","#directTemporalSubscription","#subscribeToContextProvider","#subscribeToDirectTemporal","#waitForTemporalToInitialize","#unsubscribe","#subscribe","#resubscribe"],"sources":["../../src/gui/EFControls.ts"],"mappings":";;;;;;;;;;;;;;;;;AAqBA,mBAAmB;AAEnB,IAAM,sBAAN,cAAkC,MAAM;CAMtC,YACE,SACA,eACA,UACA,WACA;AACA,QAAM,mBAAmB;GAAE,SAAS;GAAM,UAAU;GAAM,CAAC;AA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,EAAA;YAGP,QAAQ,EAAE,SAAS,eAAe,CAAC,EACnC,OAAO,CAAA,EAAA,WAAA,WAAA,UAAA,KAAA,EAAA;YAGP,QAAQ,EAAE,SAAS,cAAc,CAAC,EAClC,OAAO,CAAA,EAAA,WAAA,WAAA,SAAA,KAAA,EAAA;YAGP,QAAQ,EAAE,SAAS,cAAc,CAAC,CAAA,EAAA,WAAA,WAAA,gBAAA,KAAA,EAAA;yBAzDpC,cAAc,cAAc,CAAA,EAAA,WAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { TemplateResult as TemplateResult$1 } from "../node_modules/lit-html/development/lit-html.js";
|
|
2
|
+
import * as _$lit from "lit";
|
|
3
|
+
import { LitElement } from "lit";
|
|
4
|
+
|
|
5
|
+
//#region src/gui/EFFullscreen.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* A fullscreen toggle that enters/exits the browser Fullscreen API on a target element.
|
|
8
|
+
* The `target` attribute accepts the `id` of the element to make fullscreen.
|
|
9
|
+
* If omitted, defaults to `document.documentElement`.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* ```html
|
|
13
|
+
* <ef-fullscreen target="my-container">
|
|
14
|
+
* <button slot="enter">Enter Fullscreen</button>
|
|
15
|
+
* <button slot="exit">Exit Fullscreen</button>
|
|
16
|
+
* </ef-fullscreen>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
declare class EFFullscreen extends LitElement {
|
|
20
|
+
static styles: _$lit.CSSResult[];
|
|
21
|
+
/** ID of the element to make fullscreen. Defaults to document.documentElement. */
|
|
22
|
+
target: string;
|
|
23
|
+
private isFullscreen;
|
|
24
|
+
private get targetElement();
|
|
25
|
+
private handleFullscreenChange;
|
|
26
|
+
connectedCallback(): void;
|
|
27
|
+
disconnectedCallback(): void;
|
|
28
|
+
private toggle;
|
|
29
|
+
render(): TemplateResult$1<1>;
|
|
30
|
+
}
|
|
31
|
+
declare global {
|
|
32
|
+
interface HTMLElementTagNameMap {
|
|
33
|
+
"ef-fullscreen": EFFullscreen;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { EFFullscreen };
|
|
38
|
+
//# sourceMappingURL=EFFullscreen.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { __decorate } from "../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js";
|
|
2
|
+
import { LitElement, css, html } from "lit";
|
|
3
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
4
|
+
//#region src/gui/EFFullscreen.ts
|
|
5
|
+
let EFFullscreen = class EFFullscreen extends LitElement {
|
|
6
|
+
constructor(..._args) {
|
|
7
|
+
super(..._args);
|
|
8
|
+
this.target = "";
|
|
9
|
+
this.isFullscreen = false;
|
|
10
|
+
this.handleFullscreenChange = () => {
|
|
11
|
+
this.isFullscreen = !!document.fullscreenElement;
|
|
12
|
+
};
|
|
13
|
+
this.toggle = async () => {
|
|
14
|
+
if (document.fullscreenElement) await document.exitFullscreen();
|
|
15
|
+
else await this.targetElement.requestFullscreen();
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
static {
|
|
19
|
+
this.styles = [css`
|
|
20
|
+
:host {}
|
|
21
|
+
`];
|
|
22
|
+
}
|
|
23
|
+
get targetElement() {
|
|
24
|
+
if (this.target) return document.getElementById(this.target) ?? document.documentElement;
|
|
25
|
+
return document.documentElement;
|
|
26
|
+
}
|
|
27
|
+
connectedCallback() {
|
|
28
|
+
super.connectedCallback();
|
|
29
|
+
document.addEventListener("fullscreenchange", this.handleFullscreenChange);
|
|
30
|
+
this.isFullscreen = !!document.fullscreenElement;
|
|
31
|
+
}
|
|
32
|
+
disconnectedCallback() {
|
|
33
|
+
super.disconnectedCallback();
|
|
34
|
+
document.removeEventListener("fullscreenchange", this.handleFullscreenChange);
|
|
35
|
+
}
|
|
36
|
+
render() {
|
|
37
|
+
return html`
|
|
38
|
+
<div @click=${this.toggle}>
|
|
39
|
+
${this.isFullscreen ? html`<slot name="exit"></slot>` : html`<slot name="enter"></slot>`}
|
|
40
|
+
</div>
|
|
41
|
+
`;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
__decorate([property({ type: String })], EFFullscreen.prototype, "target", void 0);
|
|
45
|
+
__decorate([state()], EFFullscreen.prototype, "isFullscreen", void 0);
|
|
46
|
+
EFFullscreen = __decorate([customElement("ef-fullscreen")], EFFullscreen);
|
|
47
|
+
//#endregion
|
|
48
|
+
export { EFFullscreen };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=EFFullscreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EFFullscreen.js","names":[],"sources":["../../src/gui/EFFullscreen.ts"],"mappings":";;;;AAiBO,IAAA,eAAA,MAAM,qBAAqB,WAAW;;;gBASlC;sBAGc;sCASgB;AACrC,QAAK,eAAe,CAAC,CAAC,SAAS;;gBAchB,YAAY;AAC3B,OAAI,SAAS,kBACX,OAAM,SAAS,gBAAgB;OAE/B,OAAM,KAAK,cAAc,mBAAmB;;;;gBAvChC,CACd,GAAG;;MAGJ;;CASD,IAAY,gBAAyB;AACnC,MAAI,KAAK,OACP,QAAO,SAAS,eAAe,KAAK,OAAO,IAAI,SAAS;AAE1D,SAAO,SAAS;;CAOlB,oBAAoB;AAClB,QAAM,mBAAmB;AACzB,WAAS,iBAAiB,oBAAoB,KAAK,uBAAuB;AAC1E,OAAK,eAAe,CAAC,CAAC,SAAS;;CAGjC,uBAAuB;AACrB,QAAM,sBAAsB;AAC5B,WAAS,oBAAoB,oBAAoB,KAAK,uBAAuB;;CAW/E,SAAS;AACP,SAAO,IAAI;oBACK,KAAK,OAAO;UACtB,KAAK,eAAe,IAAI,8BAA8B,IAAI,6BAA6B;;;;;YAvC9F,SAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,EAAA,aAAA,WAAA,UAAA,KAAA,EAAA;YAG1B,OAAO,CAAA,EAAA,aAAA,WAAA,gBAAA,KAAA,EAAA;2BAZT,cAAc,gBAAgB,CAAA,EAAA,aAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { TemplateResult as TemplateResult$1 } from "../node_modules/lit-html/development/lit-html.js";
|
|
2
|
+
import { ControllableInterface } from "./Controllable.js";
|
|
3
|
+
import * as _$lit from "lit";
|
|
4
|
+
import { LitElement } from "lit";
|
|
5
|
+
|
|
6
|
+
//#region src/gui/EFMute.d.ts
|
|
7
|
+
declare const EFMute_base: (new (...args: any[]) => {
|
|
8
|
+
target: string;
|
|
9
|
+
targetElement: ControllableInterface | null;
|
|
10
|
+
effectiveContext: ControllableInterface | null;
|
|
11
|
+
}) & typeof LitElement;
|
|
12
|
+
/**
|
|
13
|
+
* A mute/unmute toggle that swaps between named slots based on the muted state.
|
|
14
|
+
* Must be a descendant of `ef-controls` or `ef-preview`, or have a `target` attribute.
|
|
15
|
+
*
|
|
16
|
+
* Usage:
|
|
17
|
+
* ```html
|
|
18
|
+
* <ef-controls target="my-preview">
|
|
19
|
+
* <ef-mute>
|
|
20
|
+
* <button slot="unmuted">🔊</button>
|
|
21
|
+
* <button slot="muted">🔇</button>
|
|
22
|
+
* </ef-mute>
|
|
23
|
+
* </ef-controls>
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
declare class EFMute extends EFMute_base {
|
|
27
|
+
#private;
|
|
28
|
+
static styles: _$lit.CSSResult[];
|
|
29
|
+
private contextMuted;
|
|
30
|
+
get context(): ControllableInterface | null;
|
|
31
|
+
render(): TemplateResult$1<1>;
|
|
32
|
+
}
|
|
33
|
+
declare global {
|
|
34
|
+
interface HTMLElementTagNameMap {
|
|
35
|
+
"ef-mute": EFMute;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { EFMute };
|
|
40
|
+
//# sourceMappingURL=EFMute.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { efContext } from "./efContext.js";
|
|
2
|
+
import { __decorate } from "../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js";
|
|
3
|
+
import { mutedContext } from "./volumeContext.js";
|
|
4
|
+
import { TargetOrContextMixin } from "./TargetOrContextMixin.js";
|
|
5
|
+
import { consume } from "@lit/context";
|
|
6
|
+
import { LitElement, css, html } from "lit";
|
|
7
|
+
import { customElement, state } from "lit/decorators.js";
|
|
8
|
+
//#region src/gui/EFMute.ts
|
|
9
|
+
let EFMute = class EFMute extends TargetOrContextMixin(LitElement, efContext) {
|
|
10
|
+
constructor(..._args) {
|
|
11
|
+
super(..._args);
|
|
12
|
+
this.contextMuted = false;
|
|
13
|
+
}
|
|
14
|
+
static {
|
|
15
|
+
this.styles = [css`
|
|
16
|
+
:host {}
|
|
17
|
+
`];
|
|
18
|
+
}
|
|
19
|
+
get context() {
|
|
20
|
+
return this.effectiveContext;
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
return html`
|
|
24
|
+
<div @click=${this.#toggle}>
|
|
25
|
+
${this.contextMuted ? html`<slot name="muted"></slot>` : html`<slot name="unmuted"></slot>`}
|
|
26
|
+
</div>
|
|
27
|
+
`;
|
|
28
|
+
}
|
|
29
|
+
#toggle = () => {
|
|
30
|
+
if (this.context) this.context.muted = !this.context.muted;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
__decorate([consume({
|
|
34
|
+
context: mutedContext,
|
|
35
|
+
subscribe: true
|
|
36
|
+
}), state()], EFMute.prototype, "contextMuted", void 0);
|
|
37
|
+
EFMute = __decorate([customElement("ef-mute")], EFMute);
|
|
38
|
+
//#endregion
|
|
39
|
+
export { EFMute };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=EFMute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EFMute.js","names":["#toggle"],"sources":["../../src/gui/EFMute.ts"],"mappings":";;;;;;;;AAwBO,IAAA,SAAA,MAAM,eAAe,qBAAqB,YAAY,UAAU,CAAC;;;sBAS/C;;;gBARP,CACd,GAAG;;MAGJ;;CAMD,IAAI,UAAwC;AAC1C,SAAO,KAAK;;CAGd,SAAS;AACP,SAAO,IAAI;oBACK,MAAA,OAAa;UACvB,KAAK,eAAe,IAAI,+BAA+B,IAAI,+BAA+B;;;;CAKlG,gBAAgB;AACd,MAAI,KAAK,QACP,MAAK,QAAQ,QAAQ,CAAC,KAAK,QAAQ;;;YAlBtC,QAAQ;CAAE,SAAS;CAAc,WAAW;CAAM,CAAC,EACnD,OAAO,CAAA,EAAA,OAAA,WAAA,gBAAA,KAAA,EAAA;qBATT,cAAc,UAAU,CAAA,EAAA,OAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { TemplateResult as TemplateResult$1 } from "../node_modules/lit-html/development/lit-html.js";
|
|
2
|
+
import * as _$lit from "lit";
|
|
3
|
+
import { LitElement } from "lit";
|
|
4
|
+
|
|
5
|
+
//#region src/gui/EFPIP.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* A Picture-in-Picture toggle.
|
|
8
|
+
*
|
|
9
|
+
* The `target` attribute accepts the `id` of either:
|
|
10
|
+
* - A native `<video>` element — PiP is requested directly.
|
|
11
|
+
* - A `<canvas>` element — a hidden `<video>` is created via `captureStream()` and used for PiP.
|
|
12
|
+
* - A container element — the first `<video>` or `<canvas>` descendant is used.
|
|
13
|
+
*
|
|
14
|
+
* Usage:
|
|
15
|
+
* ```html
|
|
16
|
+
* <ef-pip target="my-canvas">
|
|
17
|
+
* <button slot="enter">PiP</button>
|
|
18
|
+
* <button slot="exit">Exit PiP</button>
|
|
19
|
+
* </ef-pip>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare class EFPIP extends LitElement {
|
|
23
|
+
#private;
|
|
24
|
+
static styles: _$lit.CSSResult[];
|
|
25
|
+
/** ID of a <video>, <canvas>, or container element to use for PiP. */
|
|
26
|
+
target: string;
|
|
27
|
+
private isPiP;
|
|
28
|
+
private resolveTargetVideo;
|
|
29
|
+
private handleEnterPiP;
|
|
30
|
+
private handleLeavePiP;
|
|
31
|
+
private toggle;
|
|
32
|
+
connectedCallback(): void;
|
|
33
|
+
disconnectedCallback(): void;
|
|
34
|
+
render(): TemplateResult$1<1>;
|
|
35
|
+
}
|
|
36
|
+
declare global {
|
|
37
|
+
interface HTMLElementTagNameMap {
|
|
38
|
+
"ef-pip": EFPIP;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { EFPIP };
|
|
43
|
+
//# sourceMappingURL=EFPIP.d.ts.map
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { __decorate } from "../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js";
|
|
2
|
+
import { LitElement, css, html } from "lit";
|
|
3
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
4
|
+
//#region src/gui/EFPIP.ts
|
|
5
|
+
let EFPIP = class EFPIP extends LitElement {
|
|
6
|
+
constructor(..._args) {
|
|
7
|
+
super(..._args);
|
|
8
|
+
this.target = "";
|
|
9
|
+
this.isPiP = false;
|
|
10
|
+
this.handleEnterPiP = () => {
|
|
11
|
+
this.isPiP = true;
|
|
12
|
+
};
|
|
13
|
+
this.handleLeavePiP = () => {
|
|
14
|
+
this.isPiP = false;
|
|
15
|
+
};
|
|
16
|
+
this.toggle = async () => {
|
|
17
|
+
if (document.pictureInPictureElement) {
|
|
18
|
+
await document.exitPictureInPicture();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const video = this.resolveTargetVideo();
|
|
22
|
+
if (!video) return;
|
|
23
|
+
video.addEventListener("enterpictureinpicture", this.handleEnterPiP, { once: false });
|
|
24
|
+
video.addEventListener("leavepictureinpicture", this.handleLeavePiP, { once: false });
|
|
25
|
+
if (video.paused) await video.play().catch(() => {});
|
|
26
|
+
await video.requestPictureInPicture();
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
static {
|
|
30
|
+
this.styles = [css`
|
|
31
|
+
:host {}
|
|
32
|
+
`];
|
|
33
|
+
}
|
|
34
|
+
/** Hidden video element created from a canvas capture stream. */
|
|
35
|
+
#captureVideo = null;
|
|
36
|
+
resolveTargetVideo() {
|
|
37
|
+
const root = this.target ? document.getElementById(this.target) : null;
|
|
38
|
+
if (!root) return null;
|
|
39
|
+
if (root instanceof HTMLVideoElement) return root;
|
|
40
|
+
if (root instanceof HTMLCanvasElement) return this.#getOrCreateCaptureVideo(root);
|
|
41
|
+
const video = root.querySelector("video");
|
|
42
|
+
if (video) return video;
|
|
43
|
+
const canvas = root.querySelector("canvas");
|
|
44
|
+
if (canvas) return this.#getOrCreateCaptureVideo(canvas);
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
#getOrCreateCaptureVideo(canvas) {
|
|
48
|
+
if (!this.#captureVideo) {
|
|
49
|
+
const video = document.createElement("video");
|
|
50
|
+
video.style.cssText = "position:absolute;width:1px;height:1px;opacity:0;pointer-events:none";
|
|
51
|
+
video.muted = true;
|
|
52
|
+
video.autoplay = true;
|
|
53
|
+
const stream = canvas.captureStream?.();
|
|
54
|
+
if (stream) video.srcObject = stream;
|
|
55
|
+
document.body.appendChild(video);
|
|
56
|
+
this.#captureVideo = video;
|
|
57
|
+
}
|
|
58
|
+
return this.#captureVideo;
|
|
59
|
+
}
|
|
60
|
+
#teardownCaptureVideo() {
|
|
61
|
+
if (this.#captureVideo) {
|
|
62
|
+
this.#captureVideo.srcObject = null;
|
|
63
|
+
this.#captureVideo.remove();
|
|
64
|
+
this.#captureVideo = null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
connectedCallback() {
|
|
68
|
+
super.connectedCallback();
|
|
69
|
+
this.isPiP = !!document.pictureInPictureElement;
|
|
70
|
+
}
|
|
71
|
+
disconnectedCallback() {
|
|
72
|
+
super.disconnectedCallback();
|
|
73
|
+
this.#teardownCaptureVideo();
|
|
74
|
+
}
|
|
75
|
+
render() {
|
|
76
|
+
return html`
|
|
77
|
+
<div @click=${this.toggle}>
|
|
78
|
+
${this.isPiP ? html`<slot name="exit"></slot>` : html`<slot name="enter"></slot>`}
|
|
79
|
+
</div>
|
|
80
|
+
`;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
__decorate([property({ type: String })], EFPIP.prototype, "target", void 0);
|
|
84
|
+
__decorate([state()], EFPIP.prototype, "isPiP", void 0);
|
|
85
|
+
EFPIP = __decorate([customElement("ef-pip")], EFPIP);
|
|
86
|
+
//#endregion
|
|
87
|
+
export { EFPIP };
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=EFPIP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EFPIP.js","names":["#getOrCreateCaptureVideo","#captureVideo","#teardownCaptureVideo"],"sources":["../../src/gui/EFPIP.ts"],"mappings":";;;;AAoBO,IAAA,QAAA,MAAM,cAAc,WAAW;;;gBAS3B;eAGO;8BAmDe;AAC7B,QAAK,QAAQ;;8BAGgB;AAC7B,QAAK,QAAQ;;gBAGE,YAAY;AAC3B,OAAI,SAAS,yBAAyB;AACpC,UAAM,SAAS,sBAAsB;AACrC;;GAGF,MAAM,QAAQ,KAAK,oBAAoB;AACvC,OAAI,CAAC,MAAO;AAEZ,SAAM,iBAAiB,yBAAyB,KAAK,gBAAgB,EAAE,MAAM,OAAO,CAAC;AACrF,SAAM,iBAAiB,yBAAyB,KAAK,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAGrF,OAAI,MAAM,OACR,OAAM,MAAM,MAAM,CAAC,YAAY,GAAG;AAGpC,SAAM,MAAM,yBAAyB;;;;gBAvFvB,CACd,GAAG;;MAGJ;;;CAUD,gBAAyC;CAEzC,qBAAsD;EACpD,MAAM,OAAO,KAAK,SAAS,SAAS,eAAe,KAAK,OAAO,GAAG;AAClE,MAAI,CAAC,KAAM,QAAO;AAElB,MAAI,gBAAgB,iBAClB,QAAO;AAGT,MAAI,gBAAgB,kBAClB,QAAO,MAAA,wBAA8B,KAAK;EAI5C,MAAM,QAAQ,KAAK,cAAc,QAAQ;AACzC,MAAI,MAAO,QAAO;EAClB,MAAM,SAAS,KAAK,cAAc,SAAS;AAC3C,MAAI,OAAQ,QAAO,MAAA,wBAA8B,OAAO;AAExD,SAAO;;CAGT,yBAAyB,QAA6C;AACpE,MAAI,CAAC,MAAA,cAAoB;GACvB,MAAM,QAAQ,SAAS,cAAc,QAAQ;AAC7C,SAAM,MAAM,UAAU;AACtB,SAAM,QAAQ;AACd,SAAM,WAAW;GAEjB,MAAM,SAAU,OAAe,iBAAiB;AAChD,OAAI,OACF,OAAM,YAAY;AAEpB,YAAS,KAAK,YAAY,MAAM;AAChC,SAAA,eAAqB;;AAEvB,SAAO,MAAA;;CAGT,wBAAwB;AACtB,MAAI,MAAA,cAAoB;AACtB,SAAA,aAAmB,YAAY;AAC/B,SAAA,aAAmB,QAAQ;AAC3B,SAAA,eAAqB;;;CAgCzB,oBAAoB;AAClB,QAAM,mBAAmB;AACzB,OAAK,QAAQ,CAAC,CAAC,SAAS;;CAG1B,uBAAuB;AACrB,QAAM,sBAAsB;AAC5B,QAAA,sBAA4B;;CAG9B,SAAS;AACP,SAAO,IAAI;oBACK,KAAK,OAAO;UACtB,KAAK,QAAQ,IAAI,8BAA8B,IAAI,6BAA6B;;;;;YAhGvF,SAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,EAAA,MAAA,WAAA,UAAA,KAAA,EAAA;YAG1B,OAAO,CAAA,EAAA,MAAA,WAAA,SAAA,KAAA,EAAA;oBAZT,cAAc,SAAS,CAAA,EAAA,MAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { TemplateResult as TemplateResult$1 } from "../node_modules/lit-html/development/lit-html.js";
|
|
2
|
+
import * as _$lit from "lit";
|
|
3
|
+
import { LitElement } from "lit";
|
|
4
|
+
|
|
5
|
+
//#region src/gui/EFResolution.d.ts
|
|
6
|
+
interface ResolutionChangeDetail {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A resolution picker for an `ef-timegroup` (or any element whose dimensions
|
|
12
|
+
* are controlled by inline CSS `width` / `height`).
|
|
13
|
+
*
|
|
14
|
+
* The `target` attribute accepts the `id` of the element to resize.
|
|
15
|
+
* Dispatches a `resolution-change` custom event with `{ width, height }` detail.
|
|
16
|
+
*
|
|
17
|
+
* Usage:
|
|
18
|
+
* ```html
|
|
19
|
+
* <ef-resolution target="my-timegroup"></ef-resolution>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare class EFResolution extends LitElement {
|
|
23
|
+
#private;
|
|
24
|
+
static styles: _$lit.CSSResult[];
|
|
25
|
+
/** ID of the target element whose CSS width/height to change. */
|
|
26
|
+
target: string;
|
|
27
|
+
private selectedPreset;
|
|
28
|
+
private customWidth;
|
|
29
|
+
private customHeight;
|
|
30
|
+
private isCustom;
|
|
31
|
+
private get targetElement();
|
|
32
|
+
connectedCallback(): void;
|
|
33
|
+
private handlePresetChange;
|
|
34
|
+
private handleCustomWidth;
|
|
35
|
+
private handleCustomHeight;
|
|
36
|
+
private handleCustomApply;
|
|
37
|
+
private handleCustomKeydown;
|
|
38
|
+
render(): TemplateResult$1<1>;
|
|
39
|
+
}
|
|
40
|
+
declare global {
|
|
41
|
+
interface HTMLElementTagNameMap {
|
|
42
|
+
"ef-resolution": EFResolution;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { EFResolution, ResolutionChangeDetail };
|
|
47
|
+
//# sourceMappingURL=EFResolution.d.ts.map
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { __decorate } from "../_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js";
|
|
2
|
+
import { LitElement, css, html } from "lit";
|
|
3
|
+
import { customElement, property, state } from "lit/decorators.js";
|
|
4
|
+
//#region src/gui/EFResolution.ts
|
|
5
|
+
const PRESETS = [
|
|
6
|
+
{
|
|
7
|
+
label: "HD (1920×1080)",
|
|
8
|
+
width: 1920,
|
|
9
|
+
height: 1080
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
label: "720p (1280×720)",
|
|
13
|
+
width: 1280,
|
|
14
|
+
height: 720
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
label: "4K (3840×2160)",
|
|
18
|
+
width: 3840,
|
|
19
|
+
height: 2160
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
label: "Vertical (1080×1920)",
|
|
23
|
+
width: 1080,
|
|
24
|
+
height: 1920
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: "Square (1080×1080)",
|
|
28
|
+
width: 1080,
|
|
29
|
+
height: 1080
|
|
30
|
+
}
|
|
31
|
+
];
|
|
32
|
+
const CUSTOM_VALUE = "__custom__";
|
|
33
|
+
let EFResolution = class EFResolution extends LitElement {
|
|
34
|
+
constructor(..._args) {
|
|
35
|
+
super(..._args);
|
|
36
|
+
this.target = "";
|
|
37
|
+
this.selectedPreset = PRESETS[0].label;
|
|
38
|
+
this.customWidth = 1920;
|
|
39
|
+
this.customHeight = 1080;
|
|
40
|
+
this.isCustom = false;
|
|
41
|
+
this.handlePresetChange = (e) => {
|
|
42
|
+
const value = e.target.value;
|
|
43
|
+
if (value === CUSTOM_VALUE) {
|
|
44
|
+
this.selectedPreset = CUSTOM_VALUE;
|
|
45
|
+
this.isCustom = true;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const preset = PRESETS.find((p) => p.label === value);
|
|
49
|
+
if (!preset) return;
|
|
50
|
+
this.selectedPreset = preset.label;
|
|
51
|
+
this.isCustom = false;
|
|
52
|
+
this.#applyDimensions(preset.width, preset.height);
|
|
53
|
+
};
|
|
54
|
+
this.handleCustomWidth = (e) => {
|
|
55
|
+
const input = e.target;
|
|
56
|
+
this.customWidth = Number.parseInt(input.value, 10) || this.customWidth;
|
|
57
|
+
};
|
|
58
|
+
this.handleCustomHeight = (e) => {
|
|
59
|
+
const input = e.target;
|
|
60
|
+
this.customHeight = Number.parseInt(input.value, 10) || this.customHeight;
|
|
61
|
+
};
|
|
62
|
+
this.handleCustomApply = () => {
|
|
63
|
+
if (this.customWidth > 0 && this.customHeight > 0) this.#applyDimensions(this.customWidth, this.customHeight);
|
|
64
|
+
};
|
|
65
|
+
this.handleCustomKeydown = (e) => {
|
|
66
|
+
if (e.key === "Enter") this.handleCustomApply();
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
static {
|
|
70
|
+
this.styles = [css`
|
|
71
|
+
:host {
|
|
72
|
+
--ef-resolution-font-size: 12px;
|
|
73
|
+
--ef-resolution-color: var(--ef-color-text, #fff);
|
|
74
|
+
--ef-resolution-border-color: var(--ef-color-border, rgba(255, 255, 255, 0.2));
|
|
75
|
+
--ef-resolution-bg: var(--ef-color-surface, rgba(0, 0, 0, 0.6));
|
|
76
|
+
display: inline-flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
gap: 6px;
|
|
79
|
+
font-size: var(--ef-resolution-font-size);
|
|
80
|
+
color: var(--ef-resolution-color);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
select,
|
|
84
|
+
input[type="number"] {
|
|
85
|
+
background: var(--ef-resolution-bg);
|
|
86
|
+
border: 1px solid var(--ef-resolution-border-color);
|
|
87
|
+
border-radius: 3px;
|
|
88
|
+
color: inherit;
|
|
89
|
+
font-size: inherit;
|
|
90
|
+
padding: 2px 4px;
|
|
91
|
+
outline: none;
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
select {
|
|
96
|
+
min-width: 130px;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
input[type="number"] {
|
|
100
|
+
width: 60px;
|
|
101
|
+
cursor: text;
|
|
102
|
+
-moz-appearance: textfield;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
input[type="number"]::-webkit-inner-spin-button,
|
|
106
|
+
input[type="number"]::-webkit-outer-spin-button {
|
|
107
|
+
-webkit-appearance: none;
|
|
108
|
+
margin: 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.custom-inputs {
|
|
112
|
+
display: contents;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.sep {
|
|
116
|
+
opacity: 0.5;
|
|
117
|
+
}
|
|
118
|
+
`];
|
|
119
|
+
}
|
|
120
|
+
get targetElement() {
|
|
121
|
+
return this.target ? document.getElementById(this.target) : null;
|
|
122
|
+
}
|
|
123
|
+
connectedCallback() {
|
|
124
|
+
super.connectedCallback();
|
|
125
|
+
const el = this.targetElement;
|
|
126
|
+
if (el) {
|
|
127
|
+
const w = el.offsetWidth || 1920;
|
|
128
|
+
const h = el.offsetHeight || 1080;
|
|
129
|
+
this.#syncFromDimensions(w, h);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
#syncFromDimensions(width, height) {
|
|
133
|
+
const match = PRESETS.find((p) => p.width === width && p.height === height);
|
|
134
|
+
if (match) {
|
|
135
|
+
this.selectedPreset = match.label;
|
|
136
|
+
this.isCustom = false;
|
|
137
|
+
} else {
|
|
138
|
+
this.customWidth = width;
|
|
139
|
+
this.customHeight = height;
|
|
140
|
+
this.selectedPreset = CUSTOM_VALUE;
|
|
141
|
+
this.isCustom = true;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
#applyDimensions(width, height) {
|
|
145
|
+
const el = this.targetElement;
|
|
146
|
+
if (el) {
|
|
147
|
+
el.style.width = `${width}px`;
|
|
148
|
+
el.style.height = `${height}px`;
|
|
149
|
+
}
|
|
150
|
+
this.dispatchEvent(new CustomEvent("resolution-change", {
|
|
151
|
+
detail: {
|
|
152
|
+
width,
|
|
153
|
+
height
|
|
154
|
+
},
|
|
155
|
+
bubbles: true,
|
|
156
|
+
composed: true
|
|
157
|
+
}));
|
|
158
|
+
}
|
|
159
|
+
render() {
|
|
160
|
+
return html`
|
|
161
|
+
<select .value=${this.selectedPreset} @change=${this.handlePresetChange}>
|
|
162
|
+
${PRESETS.map((p) => html`<option value=${p.label} ?selected=${this.selectedPreset === p.label}>
|
|
163
|
+
${p.label}
|
|
164
|
+
</option>`)}
|
|
165
|
+
<option value=${CUSTOM_VALUE} ?selected=${this.isCustom}>Custom</option>
|
|
166
|
+
</select>
|
|
167
|
+
|
|
168
|
+
${this.isCustom ? html`
|
|
169
|
+
<span class="custom-inputs">
|
|
170
|
+
<input
|
|
171
|
+
type="number"
|
|
172
|
+
min="1"
|
|
173
|
+
max="7680"
|
|
174
|
+
.value=${String(this.customWidth)}
|
|
175
|
+
@change=${this.handleCustomWidth}
|
|
176
|
+
@keydown=${this.handleCustomKeydown}
|
|
177
|
+
aria-label="Width"
|
|
178
|
+
/>
|
|
179
|
+
<span class="sep">×</span>
|
|
180
|
+
<input
|
|
181
|
+
type="number"
|
|
182
|
+
min="1"
|
|
183
|
+
max="7680"
|
|
184
|
+
.value=${String(this.customHeight)}
|
|
185
|
+
@change=${this.handleCustomHeight}
|
|
186
|
+
@keydown=${this.handleCustomKeydown}
|
|
187
|
+
aria-label="Height"
|
|
188
|
+
/>
|
|
189
|
+
</span>
|
|
190
|
+
` : html``}
|
|
191
|
+
`;
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
__decorate([property({ type: String })], EFResolution.prototype, "target", void 0);
|
|
195
|
+
__decorate([state()], EFResolution.prototype, "selectedPreset", void 0);
|
|
196
|
+
__decorate([state()], EFResolution.prototype, "customWidth", void 0);
|
|
197
|
+
__decorate([state()], EFResolution.prototype, "customHeight", void 0);
|
|
198
|
+
__decorate([state()], EFResolution.prototype, "isCustom", void 0);
|
|
199
|
+
EFResolution = __decorate([customElement("ef-resolution")], EFResolution);
|
|
200
|
+
//#endregion
|
|
201
|
+
export { EFResolution };
|
|
202
|
+
|
|
203
|
+
//# sourceMappingURL=EFResolution.js.map
|