@editframe/elements 0.5.0-beta.9 → 0.6.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/lib/av/EncodedAsset.cjs +561 -0
- package/dist/lib/av/{EncodedAsset.mjs → EncodedAsset.js} +18 -13
- package/dist/lib/av/MP4File.cjs +182 -0
- package/dist/lib/av/{MP4File.mjs → MP4File.js} +14 -9
- package/dist/lib/av/msToTimeCode.cjs +15 -0
- package/dist/lib/util/awaitMicrotask.cjs +8 -0
- package/dist/lib/util/memoize.cjs +14 -0
- package/dist/packages/elements/src/EF_FRAMEGEN.cjs +197 -0
- package/dist/packages/elements/src/EF_FRAMEGEN.d.ts +45 -0
- package/dist/packages/elements/src/{EF_FRAMEGEN.mjs → EF_FRAMEGEN.js} +21 -7
- package/dist/packages/elements/src/EF_INTERACTIVE.cjs +4 -0
- package/dist/packages/elements/src/EF_INTERACTIVE.d.ts +1 -0
- package/dist/packages/elements/src/elements/CrossUpdateController.cjs +16 -0
- package/dist/packages/elements/src/elements/CrossUpdateController.d.ts +9 -0
- package/dist/packages/elements/src/elements/EFAudio.cjs +53 -0
- package/dist/packages/elements/src/elements/EFAudio.d.ts +10 -0
- package/dist/packages/elements/src/elements/{EFAudio.mjs → EFAudio.js} +1 -1
- package/dist/packages/elements/src/elements/EFCaptions.cjs +171 -0
- package/dist/packages/elements/src/elements/EFCaptions.d.ts +39 -0
- package/dist/packages/elements/src/elements/{EFCaptions.mjs → EFCaptions.js} +13 -13
- package/dist/packages/elements/src/elements/EFImage.cjs +79 -0
- package/dist/packages/elements/src/elements/EFImage.d.ts +14 -0
- package/dist/packages/elements/src/elements/{EFImage.mjs → EFImage.js} +6 -4
- package/dist/packages/elements/src/elements/EFMedia.cjs +334 -0
- package/dist/packages/elements/src/elements/EFMedia.d.ts +61 -0
- package/dist/packages/elements/src/elements/{EFMedia.mjs → EFMedia.js} +29 -18
- package/dist/packages/elements/src/elements/EFSourceMixin.cjs +55 -0
- package/dist/packages/elements/src/elements/EFSourceMixin.d.ts +12 -0
- package/dist/packages/elements/src/elements/{EFSourceMixin.mjs → EFSourceMixin.js} +1 -1
- package/dist/packages/elements/src/elements/EFTemporal.cjs +198 -0
- package/dist/packages/elements/src/elements/EFTemporal.d.ts +36 -0
- package/dist/packages/elements/src/elements/{EFTemporal.mjs → EFTemporal.js} +4 -7
- package/dist/packages/elements/src/elements/EFTimegroup.browsertest.d.ts +12 -0
- package/dist/packages/elements/src/elements/EFTimegroup.cjs +343 -0
- package/dist/packages/elements/src/elements/EFTimegroup.d.ts +39 -0
- package/dist/packages/elements/src/elements/{EFTimegroup.mjs → EFTimegroup.js} +23 -22
- package/dist/packages/elements/src/elements/EFTimeline.cjs +15 -0
- package/dist/packages/elements/src/elements/EFTimeline.d.ts +3 -0
- package/dist/packages/elements/src/elements/{EFTimeline.mjs → EFTimeline.js} +5 -2
- package/dist/packages/elements/src/elements/EFVideo.cjs +110 -0
- package/dist/packages/elements/src/elements/EFVideo.d.ts +14 -0
- package/dist/packages/elements/src/elements/{EFVideo.mjs → EFVideo.js} +2 -2
- package/dist/packages/elements/src/elements/EFWaveform.cjs +235 -0
- package/dist/packages/elements/src/elements/EFWaveform.d.ts +28 -0
- package/dist/packages/elements/src/elements/{EFWaveform.mjs → EFWaveform.js} +14 -14
- package/dist/packages/elements/src/elements/FetchMixin.cjs +28 -0
- package/dist/packages/elements/src/elements/FetchMixin.d.ts +8 -0
- package/dist/packages/elements/src/elements/{FetchMixin.mjs → FetchMixin.js} +1 -1
- package/dist/packages/elements/src/elements/TimegroupController.cjs +20 -0
- package/dist/packages/elements/src/elements/TimegroupController.d.ts +14 -0
- package/dist/packages/elements/src/elements/durationConverter.cjs +8 -0
- package/dist/packages/elements/src/elements/durationConverter.d.ts +4 -0
- package/dist/packages/elements/src/elements/{durationConverter.mjs → durationConverter.js} +1 -1
- package/dist/packages/elements/src/elements/parseTimeToMs.cjs +12 -0
- package/dist/packages/elements/src/elements/parseTimeToMs.d.ts +1 -0
- package/dist/packages/elements/src/elements/parseTimeToMs.js +12 -0
- package/dist/packages/elements/src/elements/util.cjs +11 -0
- package/dist/packages/elements/src/elements/util.d.ts +4 -0
- package/dist/packages/elements/src/elements/{util.mjs → util.js} +1 -1
- package/dist/packages/elements/src/gui/EFFilmstrip.cjs +675 -0
- package/dist/packages/elements/src/gui/EFFilmstrip.d.ts +138 -0
- package/dist/packages/elements/src/gui/{EFFilmstrip.mjs → EFFilmstrip.js} +48 -34
- package/dist/packages/elements/src/gui/EFWorkbench.cjs +199 -0
- package/dist/packages/elements/src/gui/EFWorkbench.d.ts +44 -0
- package/dist/packages/elements/src/gui/{EFWorkbench.mjs → EFWorkbench.js} +26 -27
- package/dist/packages/elements/src/gui/TWMixin.cjs +28 -0
- package/dist/packages/elements/src/gui/TWMixin.css.cjs +3 -0
- package/dist/packages/elements/src/gui/TWMixin.d.ts +3 -0
- package/dist/packages/elements/src/gui/{TWMixin.mjs → TWMixin.js} +4 -3
- package/dist/packages/elements/src/index.cjs +47 -0
- package/dist/packages/elements/src/index.d.ts +10 -0
- package/dist/packages/elements/src/index.js +23 -0
- package/package.json +18 -4
- package/dist/packages/elements/src/elements/parseTimeToMs.mjs +0 -13
- package/dist/packages/elements/src/elements.mjs +0 -12
- /package/dist/lib/av/{msToTimeCode.mjs → msToTimeCode.js} +0 -0
- /package/dist/lib/util/{awaitMicrotask.mjs → awaitMicrotask.js} +0 -0
- /package/dist/lib/util/{memoize.mjs → memoize.js} +0 -0
- /package/dist/packages/elements/src/{EF_INTERACTIVE.mjs → EF_INTERACTIVE.js} +0 -0
- /package/dist/packages/elements/src/elements/{CrossUpdateController.mjs → CrossUpdateController.js} +0 -0
- /package/dist/packages/elements/src/elements/{TimegroupController.mjs → TimegroupController.js} +0 -0
- /package/dist/packages/elements/src/gui/{TWMixin.css.mjs → TWMixin.css.js} +0 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { EFTimegroup } from '../elements/EFTimegroup';
|
|
2
|
+
import { LitElement, nothing, TemplateResult, ReactiveController, PropertyValueMap } from 'lit';
|
|
3
|
+
import { TemporalMixinInterface } from '../elements/EFTemporal';
|
|
4
|
+
import { TimegroupController } from '../elements/TimegroupController';
|
|
5
|
+
import { FocusContext } from './EFWorkbench';
|
|
6
|
+
|
|
7
|
+
declare class ElementFilmstripController implements ReactiveController {
|
|
8
|
+
private host;
|
|
9
|
+
private filmstrip;
|
|
10
|
+
constructor(host: LitElement, filmstrip: FilmstripItem);
|
|
11
|
+
remove(): void;
|
|
12
|
+
hostDisconnected(): void;
|
|
13
|
+
hostUpdated(): void;
|
|
14
|
+
}
|
|
15
|
+
declare const FilmstripItem_base: typeof LitElement;
|
|
16
|
+
declare class FilmstripItem extends FilmstripItem_base {
|
|
17
|
+
static styles: import('lit').CSSResult[];
|
|
18
|
+
focusContext?: FocusContext;
|
|
19
|
+
focusedElement?: HTMLElement | null;
|
|
20
|
+
get isFocused(): boolean;
|
|
21
|
+
element: TemporalMixinInterface & LitElement;
|
|
22
|
+
pixelsPerMs: number;
|
|
23
|
+
get styles(): {
|
|
24
|
+
position: string;
|
|
25
|
+
left: string;
|
|
26
|
+
width: string;
|
|
27
|
+
};
|
|
28
|
+
render(): TemplateResult<1>;
|
|
29
|
+
renderChildren(): Array<TemplateResult<1> | typeof nothing> | typeof nothing;
|
|
30
|
+
contents(): TemplateResult<1>;
|
|
31
|
+
animations(): (TemplateResult<1> | typeof nothing)[];
|
|
32
|
+
protected filmstripController?: ElementFilmstripController;
|
|
33
|
+
update(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
34
|
+
}
|
|
35
|
+
export declare class EFAudioFilmstrip extends FilmstripItem {
|
|
36
|
+
contents(): TemplateResult<1>;
|
|
37
|
+
}
|
|
38
|
+
export declare class EFVideoFilmstrip extends FilmstripItem {
|
|
39
|
+
contents(): TemplateResult<1>;
|
|
40
|
+
}
|
|
41
|
+
export declare class EFCaptionsFilmstrip extends FilmstripItem {
|
|
42
|
+
contents(): TemplateResult<1>;
|
|
43
|
+
}
|
|
44
|
+
export declare class EFWaveformFilmstrip extends FilmstripItem {
|
|
45
|
+
contents(): TemplateResult<1>;
|
|
46
|
+
renderChildren(): typeof nothing;
|
|
47
|
+
}
|
|
48
|
+
export declare class EFImageFilmstrip extends FilmstripItem {
|
|
49
|
+
contents(): TemplateResult<1>;
|
|
50
|
+
}
|
|
51
|
+
export declare class EFTimegroupFilmstrip extends FilmstripItem {
|
|
52
|
+
contents(): TemplateResult<1>;
|
|
53
|
+
}
|
|
54
|
+
export declare class EFHTMLFilmstrip extends FilmstripItem {
|
|
55
|
+
contents(): TemplateResult<1>;
|
|
56
|
+
}
|
|
57
|
+
declare const EFHierarchyItem_base: typeof LitElement;
|
|
58
|
+
declare class EFHierarchyItem<ElementType extends HTMLElement = HTMLElement> extends EFHierarchyItem_base {
|
|
59
|
+
element: ElementType;
|
|
60
|
+
focusContext?: FocusContext;
|
|
61
|
+
focusedElement?: HTMLElement | null;
|
|
62
|
+
get icon(): TemplateResult<1> | string;
|
|
63
|
+
get isFocused(): boolean;
|
|
64
|
+
displayLabel(): TemplateResult<1> | string | typeof nothing;
|
|
65
|
+
render(): TemplateResult<1>;
|
|
66
|
+
renderChildren(): Array<TemplateResult<1>> | typeof nothing;
|
|
67
|
+
}
|
|
68
|
+
declare class EFTimegroupHierarchyItem extends EFHierarchyItem<EFTimegroup> {
|
|
69
|
+
get icon(): string;
|
|
70
|
+
displayLabel(): string | TemplateResult<1> | typeof nothing;
|
|
71
|
+
}
|
|
72
|
+
declare class EFAudioHierarchyItem extends EFHierarchyItem {
|
|
73
|
+
get icon(): string;
|
|
74
|
+
displayLabel(): string;
|
|
75
|
+
}
|
|
76
|
+
declare class EFVideoHierarchyItem extends EFHierarchyItem {
|
|
77
|
+
get icon(): string;
|
|
78
|
+
displayLabel(): string;
|
|
79
|
+
}
|
|
80
|
+
declare class EFCaptionsHierarchyItem extends EFHierarchyItem {
|
|
81
|
+
get icon(): string;
|
|
82
|
+
}
|
|
83
|
+
declare class EFCaptionsActiveWordHierarchyItem extends EFHierarchyItem {
|
|
84
|
+
get icon(): string;
|
|
85
|
+
}
|
|
86
|
+
declare class EFWaveformHierarchyItem extends EFHierarchyItem {
|
|
87
|
+
get icon(): string;
|
|
88
|
+
renderChildren(): typeof nothing;
|
|
89
|
+
}
|
|
90
|
+
declare class EFImageHierarchyItem extends EFHierarchyItem {
|
|
91
|
+
get icon(): string;
|
|
92
|
+
displayLabel(): string;
|
|
93
|
+
}
|
|
94
|
+
declare class EFHTMLHierarchyItem extends EFHierarchyItem {
|
|
95
|
+
get icon(): TemplateResult<1>;
|
|
96
|
+
}
|
|
97
|
+
declare const EFFilmStrip_base: typeof LitElement;
|
|
98
|
+
export declare class EFFilmStrip extends EFFilmStrip_base {
|
|
99
|
+
#private;
|
|
100
|
+
pixelsPerMs: number;
|
|
101
|
+
currentTimeMs: number;
|
|
102
|
+
targetSelector: string;
|
|
103
|
+
scrubbing: boolean;
|
|
104
|
+
playing: boolean;
|
|
105
|
+
timegroupController?: TimegroupController;
|
|
106
|
+
connectedCallback(): void;
|
|
107
|
+
advancePlayhead: (tick?: DOMHighResTimeStamp) => void;
|
|
108
|
+
scrub(e: MouseEvent): void;
|
|
109
|
+
startScrub(e: MouseEvent): void;
|
|
110
|
+
scrollScrub(e: WheelEvent): void;
|
|
111
|
+
gutterRef: import('lit-html/directives/ref').Ref<HTMLDivElement>;
|
|
112
|
+
get gutter(): HTMLDivElement | undefined;
|
|
113
|
+
render(): TemplateResult<1>;
|
|
114
|
+
update(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
115
|
+
updated(changes: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
|
116
|
+
get target(): EFTimegroup | undefined;
|
|
117
|
+
}
|
|
118
|
+
declare global {
|
|
119
|
+
interface HTMLElementTagNameMap {
|
|
120
|
+
"ef-filmstrip": EFFilmStrip;
|
|
121
|
+
"ef-timegroup-hierarchy-item": EFTimegroupHierarchyItem;
|
|
122
|
+
"ef-audio-hierarchy-item": EFAudioHierarchyItem;
|
|
123
|
+
"ef-video-hierarchy-item": EFVideoHierarchyItem;
|
|
124
|
+
"ef-captions-hierarchy-item": EFCaptionsHierarchyItem;
|
|
125
|
+
"ef-captions-active-word-hierarchy-item": EFCaptionsActiveWordHierarchyItem;
|
|
126
|
+
"ef-waveform-hierarchy-item": EFWaveformHierarchyItem;
|
|
127
|
+
"ef-image-hierarchy-item": EFImageHierarchyItem;
|
|
128
|
+
"ef-html-hierarchy-item": EFHTMLHierarchyItem;
|
|
129
|
+
"ef-timegroup-filmstrip": EFTimegroupFilmstrip;
|
|
130
|
+
"ef-audio-filmstrip": EFAudioFilmstrip;
|
|
131
|
+
"ef-video-filmstrip": EFVideoFilmstrip;
|
|
132
|
+
"ef-captions-filmstrip": EFCaptionsFilmstrip;
|
|
133
|
+
"ef-waveform-filmstrip": EFWaveformFilmstrip;
|
|
134
|
+
"ef-image-filmstrip": EFImageFilmstrip;
|
|
135
|
+
"ef-html-filmstrip": EFHTMLFilmstrip;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
export {};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { EFTimegroup } from "../elements/EFTimegroup.
|
|
1
|
+
import { EFTimegroup } from "../elements/EFTimegroup.js";
|
|
2
2
|
import { css, html, nothing, LitElement } from "lit";
|
|
3
3
|
import { property, customElement, state, eventOptions } from "lit/decorators.js";
|
|
4
4
|
import { styleMap } from "lit/directives/style-map.js";
|
|
5
5
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
6
|
-
import { EFImage } from "../elements/EFImage.
|
|
7
|
-
import { EFAudio } from "../elements/EFAudio.
|
|
8
|
-
import { EFVideo } from "../elements/EFVideo.
|
|
9
|
-
import { EFCaptions, EFCaptionsActiveWord } from "../elements/EFCaptions.
|
|
10
|
-
import { EFWaveform } from "../elements/EFWaveform.
|
|
11
|
-
import { TimegroupController } from "../elements/TimegroupController.
|
|
6
|
+
import { EFImage } from "../elements/EFImage.js";
|
|
7
|
+
import { EFAudio } from "../elements/EFAudio.js";
|
|
8
|
+
import { EFVideo } from "../elements/EFVideo.js";
|
|
9
|
+
import { EFCaptions, EFCaptionsActiveWord } from "../elements/EFCaptions.js";
|
|
10
|
+
import { EFWaveform } from "../elements/EFWaveform.js";
|
|
11
|
+
import { TimegroupController } from "../elements/TimegroupController.js";
|
|
12
12
|
import { consume } from "@lit/context";
|
|
13
|
-
import { focusContext, focusedElement } from "./EFWorkbench.
|
|
14
|
-
import { TWMixin } from "./TWMixin.
|
|
15
|
-
import { msToTimeCode } from "../../../../lib/av/msToTimeCode.
|
|
13
|
+
import { focusContext, focusedElement } from "./EFWorkbench.js";
|
|
14
|
+
import { TWMixin } from "./TWMixin.js";
|
|
15
|
+
import { msToTimeCode } from "../../../../lib/av/msToTimeCode.js";
|
|
16
16
|
var __defProp = Object.defineProperty;
|
|
17
17
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
18
18
|
var __typeError = (msg) => {
|
|
@@ -126,7 +126,9 @@ class FilmstripItem extends TWMixin(LitElement) {
|
|
|
126
126
|
return nothing;
|
|
127
127
|
}
|
|
128
128
|
const properties = new Set(Object.keys(firstKeyframe));
|
|
129
|
-
|
|
129
|
+
for (const key of CommonEffectKeys) {
|
|
130
|
+
properties.delete(key);
|
|
131
|
+
}
|
|
130
132
|
return html`<div
|
|
131
133
|
class="relative h-[5px] bg-blue-500 opacity-50"
|
|
132
134
|
label="animation"
|
|
@@ -135,9 +137,7 @@ class FilmstripItem extends TWMixin(LitElement) {
|
|
|
135
137
|
width: `${this.pixelsPerMs * Number(duration)}px`
|
|
136
138
|
})}
|
|
137
139
|
>
|
|
138
|
-
<!-- <div class="text-nowrap">${Array.from(properties).join(
|
|
139
|
-
" "
|
|
140
|
-
)}</div> -->
|
|
140
|
+
<!-- <div class="text-nowrap">${Array.from(properties).join(" ")}</div> -->
|
|
141
141
|
${effect.getKeyframes().map((keyframe) => {
|
|
142
142
|
return html`<div
|
|
143
143
|
class="absolute top-0 h-full w-1 bg-red-500"
|
|
@@ -387,35 +387,40 @@ const renderHierarchyChildren = (children) => {
|
|
|
387
387
|
return html`<ef-timegroup-hierarchy-item
|
|
388
388
|
.element=${child}
|
|
389
389
|
></ef-timegroup-hierarchy-item>`;
|
|
390
|
-
}
|
|
390
|
+
}
|
|
391
|
+
if (child instanceof EFImage) {
|
|
391
392
|
return html`<ef-image-hierarchy-item
|
|
392
393
|
.element=${child}
|
|
393
394
|
></ef-image-hierarchy-item>`;
|
|
394
|
-
}
|
|
395
|
+
}
|
|
396
|
+
if (child instanceof EFAudio) {
|
|
395
397
|
return html`<ef-audio-hierarchy-item
|
|
396
398
|
.element=${child}
|
|
397
399
|
></ef-audio-hierarchy-item>`;
|
|
398
|
-
}
|
|
400
|
+
}
|
|
401
|
+
if (child instanceof EFVideo) {
|
|
399
402
|
return html`<ef-video-hierarchy-item
|
|
400
403
|
.element=${child}
|
|
401
404
|
></ef-video-hierarchy-item>`;
|
|
402
|
-
}
|
|
405
|
+
}
|
|
406
|
+
if (child instanceof EFCaptions) {
|
|
403
407
|
return html`<ef-captions-hierarchy-item
|
|
404
408
|
.element=${child}
|
|
405
409
|
></ef-captions-hierarchy-item>`;
|
|
406
|
-
}
|
|
410
|
+
}
|
|
411
|
+
if (child instanceof EFCaptionsActiveWord) {
|
|
407
412
|
return html`<ef-captions-active-word-hierarchy-item
|
|
408
413
|
.element=${child}
|
|
409
414
|
></ef-captions-active-word-hierarchy-item>`;
|
|
410
|
-
}
|
|
415
|
+
}
|
|
416
|
+
if (child instanceof EFWaveform) {
|
|
411
417
|
return html`<ef-waveform-hierarchy-item
|
|
412
418
|
.element=${child}
|
|
413
419
|
></ef-waveform-hierarchy-item>`;
|
|
414
|
-
}
|
|
415
|
-
|
|
420
|
+
}
|
|
421
|
+
return html`<ef-html-hierarchy-item
|
|
416
422
|
.element=${child}
|
|
417
423
|
></ef-html-hierarchy-item>`;
|
|
418
|
-
}
|
|
419
424
|
});
|
|
420
425
|
};
|
|
421
426
|
const renderFilmStripChildren = (children, pixelsPerMs) => {
|
|
@@ -426,37 +431,41 @@ const renderFilmStripChildren = (children, pixelsPerMs) => {
|
|
|
426
431
|
.pixelsPerMs=${pixelsPerMs}
|
|
427
432
|
>
|
|
428
433
|
</ef-timegroup-filmstrip>`;
|
|
429
|
-
}
|
|
434
|
+
}
|
|
435
|
+
if (child instanceof EFImage) {
|
|
430
436
|
return html`<ef-image-filmstrip
|
|
431
437
|
.element=${child}
|
|
432
438
|
.pixelsPerMs=${pixelsPerMs}
|
|
433
439
|
></ef-image-filmstrip>`;
|
|
434
|
-
}
|
|
440
|
+
}
|
|
441
|
+
if (child instanceof EFAudio) {
|
|
435
442
|
return html`<ef-audio-filmstrip
|
|
436
443
|
.element=${child}
|
|
437
444
|
.pixelsPerMs=${pixelsPerMs}
|
|
438
445
|
></ef-audio-filmstrip>`;
|
|
439
|
-
}
|
|
446
|
+
}
|
|
447
|
+
if (child instanceof EFVideo) {
|
|
440
448
|
return html`<ef-video-filmstrip
|
|
441
449
|
.element=${child}
|
|
442
450
|
.pixelsPerMs=${pixelsPerMs}
|
|
443
451
|
></ef-video-filmstrip>`;
|
|
444
|
-
}
|
|
452
|
+
}
|
|
453
|
+
if (child instanceof EFCaptions) {
|
|
445
454
|
return html`<ef-captions-filmstrip
|
|
446
455
|
.element=${child}
|
|
447
456
|
.pixelsPerMs=${pixelsPerMs}
|
|
448
457
|
></ef-captions-filmstrip>`;
|
|
449
|
-
}
|
|
458
|
+
}
|
|
459
|
+
if (child instanceof EFWaveform) {
|
|
450
460
|
return html`<ef-waveform-filmstrip
|
|
451
461
|
.element=${child}
|
|
452
462
|
.pixelsPerMs=${pixelsPerMs}
|
|
453
463
|
></ef-waveform-filmstrip>`;
|
|
454
|
-
}
|
|
455
|
-
|
|
464
|
+
}
|
|
465
|
+
return html`<ef-html-filmstrip
|
|
456
466
|
.element=${child}
|
|
457
467
|
.pixelsPerMs=${pixelsPerMs}
|
|
458
468
|
></ef-html-filmstrip>`;
|
|
459
|
-
}
|
|
460
469
|
});
|
|
461
470
|
};
|
|
462
471
|
let EFFilmStrip = class extends TWMixin(LitElement) {
|
|
@@ -532,7 +541,7 @@ let EFFilmStrip = class extends TWMixin(LitElement) {
|
|
|
532
541
|
scrollScrub(e) {
|
|
533
542
|
if (this.target && this.gutter && !this.playing) {
|
|
534
543
|
e.preventDefault();
|
|
535
|
-
if (this.gutterRef.value.scrollLeft === 0 && e.deltaX < 0) {
|
|
544
|
+
if (this.gutterRef.value && this.gutterRef.value.scrollLeft === 0 && e.deltaX < 0) {
|
|
536
545
|
this.gutter.scrollBy(0, e.deltaY);
|
|
537
546
|
return;
|
|
538
547
|
}
|
|
@@ -566,12 +575,16 @@ let EFFilmStrip = class extends TWMixin(LitElement) {
|
|
|
566
575
|
step="0.001"
|
|
567
576
|
@input=${(e) => {
|
|
568
577
|
const target2 = e.target;
|
|
569
|
-
this.pixelsPerMs = parseFloat(target2.value);
|
|
578
|
+
this.pixelsPerMs = Number.parseFloat(target2.value);
|
|
570
579
|
}}
|
|
571
580
|
/>
|
|
572
581
|
<code>${msToTimeCode(this.currentTimeMs, true)} </code> /
|
|
573
582
|
<code>${msToTimeCode(target?.durationMs ?? 0, true)}</code>
|
|
574
|
-
${this.playing ? html`<button @click=${() =>
|
|
583
|
+
${this.playing ? html`<button @click=${() => {
|
|
584
|
+
this.playing = false;
|
|
585
|
+
}}>⏸️</button>` : html`<button @click=${() => {
|
|
586
|
+
this.playing = true;
|
|
587
|
+
}}>▶️</button>`}
|
|
575
588
|
</div>
|
|
576
589
|
<div class="z-10 pl-1 pr-1 pt-2 shadow shadow-slate-600">
|
|
577
590
|
${renderHierarchyChildren(Array.from(target?.children ?? []))}
|
|
@@ -627,6 +640,7 @@ let EFFilmStrip = class extends TWMixin(LitElement) {
|
|
|
627
640
|
}
|
|
628
641
|
throw new Error("Invalid target, must be an EFTimegroup element");
|
|
629
642
|
}
|
|
643
|
+
return void 0;
|
|
630
644
|
}
|
|
631
645
|
};
|
|
632
646
|
_lastTick = /* @__PURE__ */ new WeakMap();
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const context = require("@lit/context");
|
|
4
|
+
const lit = require("lit");
|
|
5
|
+
const task = require("@lit/task");
|
|
6
|
+
const decorators_js = require("lit/decorators.js");
|
|
7
|
+
const ref_js = require("lit/directives/ref.js");
|
|
8
|
+
const awaitMicrotask = require("../../../../lib/util/awaitMicrotask.cjs");
|
|
9
|
+
const EFTemporal = require("../elements/EFTemporal.cjs");
|
|
10
|
+
const TWMixin = require("./TWMixin.cjs");
|
|
11
|
+
const EFTimegroup = require("../elements/EFTimegroup.cjs");
|
|
12
|
+
var __defProp = Object.defineProperty;
|
|
13
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
14
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
15
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
16
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
17
|
+
if (decorator = decorators[i])
|
|
18
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
19
|
+
if (kind && result) __defProp(target, key, result);
|
|
20
|
+
return result;
|
|
21
|
+
};
|
|
22
|
+
const focusContext = context.createContext(null);
|
|
23
|
+
const focusedElement = context.createContext(null);
|
|
24
|
+
const fetchContext = context.createContext(fetch);
|
|
25
|
+
const apiHostContext = context.createContext(null);
|
|
26
|
+
exports.EFWorkbench = class EFWorkbench extends TWMixin.TWMixin(lit.LitElement) {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
this.stageRef = ref_js.createRef();
|
|
30
|
+
this.canvasRef = ref_js.createRef();
|
|
31
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
32
|
+
if (this.isConnected && !this.rendering) {
|
|
33
|
+
const canvasElement = this.canvasRef.value;
|
|
34
|
+
const stageElement = this.stageRef.value;
|
|
35
|
+
if (stageElement && canvasElement) {
|
|
36
|
+
const stageWidth = stageElement.clientWidth;
|
|
37
|
+
const stageHeight = stageElement.clientHeight;
|
|
38
|
+
const canvasWidth = canvasElement.clientWidth;
|
|
39
|
+
const canvasHeight = canvasElement.clientHeight;
|
|
40
|
+
const stageRatio = stageWidth / stageHeight;
|
|
41
|
+
const canvasRatio = canvasWidth / canvasHeight;
|
|
42
|
+
if (stageRatio > canvasRatio) {
|
|
43
|
+
const scale = stageHeight / canvasHeight;
|
|
44
|
+
canvasElement.style.transform = `scale(${scale})`;
|
|
45
|
+
} else {
|
|
46
|
+
const scale = stageWidth / canvasWidth;
|
|
47
|
+
canvasElement.style.transform = `scale(${scale})`;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
this.focusContext = this;
|
|
53
|
+
this.focusedElement = null;
|
|
54
|
+
this.fetch = (path, init = {}) => {
|
|
55
|
+
init.headers ||= {};
|
|
56
|
+
Object.assign(init.headers, {
|
|
57
|
+
"Content-Type": "application/json"
|
|
58
|
+
});
|
|
59
|
+
const bearerToken = this.apiToken;
|
|
60
|
+
if (bearerToken) {
|
|
61
|
+
Object.assign(init.headers, {
|
|
62
|
+
Authorization: `Bearer ${bearerToken}`
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return fetch(path, init);
|
|
66
|
+
};
|
|
67
|
+
this.apiHost = "";
|
|
68
|
+
this.rendering = false;
|
|
69
|
+
this.focusOverlay = ref_js.createRef();
|
|
70
|
+
this.drawOverlays = () => {
|
|
71
|
+
const focusOverlay = this.focusOverlay.value;
|
|
72
|
+
if (focusOverlay) {
|
|
73
|
+
if (this.focusedElement) {
|
|
74
|
+
focusOverlay.style.display = "block";
|
|
75
|
+
const rect = this.focusedElement.getBoundingClientRect();
|
|
76
|
+
Object.assign(focusOverlay.style, {
|
|
77
|
+
position: "absolute",
|
|
78
|
+
top: `${rect.top}px`,
|
|
79
|
+
left: `${rect.left}px`,
|
|
80
|
+
width: `${rect.width}px`,
|
|
81
|
+
height: `${rect.height}px`
|
|
82
|
+
});
|
|
83
|
+
requestAnimationFrame(this.drawOverlays);
|
|
84
|
+
} else {
|
|
85
|
+
focusOverlay.style.display = "none";
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
connectedCallback() {
|
|
91
|
+
super.connectedCallback();
|
|
92
|
+
this.resizeObserver.observe(this);
|
|
93
|
+
}
|
|
94
|
+
disconnectedCallback() {
|
|
95
|
+
super.disconnectedCallback();
|
|
96
|
+
this.resizeObserver.unobserve(this);
|
|
97
|
+
}
|
|
98
|
+
handleStageWheel(event) {
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
}
|
|
101
|
+
update(changedProperties) {
|
|
102
|
+
super.update(changedProperties);
|
|
103
|
+
if (changedProperties.has("focusedElement")) {
|
|
104
|
+
this.drawOverlays();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
render() {
|
|
108
|
+
if (this.rendering) {
|
|
109
|
+
return lit.html`
|
|
110
|
+
<slot
|
|
111
|
+
${ref_js.ref(this.canvasRef)}
|
|
112
|
+
class="fixed inset-0 h-full w-full"
|
|
113
|
+
name="canvas"
|
|
114
|
+
></slot>
|
|
115
|
+
`;
|
|
116
|
+
}
|
|
117
|
+
return lit.html`
|
|
118
|
+
<div
|
|
119
|
+
class="grid h-full w-full"
|
|
120
|
+
style="gridTemplateRows: 1fr 200px; gridTemplateColumns: 100%;"
|
|
121
|
+
>
|
|
122
|
+
<div
|
|
123
|
+
${ref_js.ref(this.stageRef)}
|
|
124
|
+
class="relative grid h-full w-full place-content-center place-items-center overflow-hidden"
|
|
125
|
+
@wheel=${this.handleStageWheel}
|
|
126
|
+
>
|
|
127
|
+
<slot
|
|
128
|
+
${ref_js.ref(this.canvasRef)}
|
|
129
|
+
class="inline-block"
|
|
130
|
+
name="canvas"
|
|
131
|
+
></slot>
|
|
132
|
+
<div
|
|
133
|
+
class="border border-blue-500 bg-blue-200 bg-opacity-20"
|
|
134
|
+
${ref_js.ref(this.focusOverlay)}
|
|
135
|
+
></div>
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
<slot class="overflow" name="timeline"></slot>
|
|
139
|
+
</div>
|
|
140
|
+
`;
|
|
141
|
+
}
|
|
142
|
+
async stepThrough() {
|
|
143
|
+
const stepDurationMs = 1e3 / 30;
|
|
144
|
+
const timegroups = EFTimegroup.shallowGetTimegroups(this);
|
|
145
|
+
const firstGroup = timegroups[0];
|
|
146
|
+
if (!firstGroup) {
|
|
147
|
+
throw new Error("No temporal elements found");
|
|
148
|
+
}
|
|
149
|
+
firstGroup.currentTimeMs = 0;
|
|
150
|
+
const temporals = EFTemporal.deepGetTemporalElements(this);
|
|
151
|
+
const busyTasks = temporals.filter((temporal) => temporal.frameTask.status < task.TaskStatus.COMPLETE).map((temporal) => temporal.frameTask);
|
|
152
|
+
await Promise.all(busyTasks.map((task2) => task2.taskComplete));
|
|
153
|
+
while (firstGroup.currentTimeMs < firstGroup.durationMs) {
|
|
154
|
+
firstGroup.currentTimeMs += stepDurationMs;
|
|
155
|
+
await awaitMicrotask.awaitMicrotask();
|
|
156
|
+
const busyTasks2 = temporals.filter((temporal) => temporal.frameTask.status < task.TaskStatus.COMPLETE).map((temporal) => temporal.frameTask);
|
|
157
|
+
await Promise.all(busyTasks2.map((task2) => task2.taskComplete));
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
exports.EFWorkbench.styles = [
|
|
162
|
+
lit.css`
|
|
163
|
+
:host {
|
|
164
|
+
display: block;
|
|
165
|
+
width: 100%;
|
|
166
|
+
height: 100%;
|
|
167
|
+
}
|
|
168
|
+
`
|
|
169
|
+
];
|
|
170
|
+
__decorateClass([
|
|
171
|
+
decorators_js.eventOptions({ passive: false, capture: true })
|
|
172
|
+
], exports.EFWorkbench.prototype, "handleStageWheel", 1);
|
|
173
|
+
__decorateClass([
|
|
174
|
+
context.provide({ context: focusContext })
|
|
175
|
+
], exports.EFWorkbench.prototype, "focusContext", 2);
|
|
176
|
+
__decorateClass([
|
|
177
|
+
context.provide({ context: focusedElement }),
|
|
178
|
+
decorators_js.state()
|
|
179
|
+
], exports.EFWorkbench.prototype, "focusedElement", 2);
|
|
180
|
+
__decorateClass([
|
|
181
|
+
context.provide({ context: fetchContext })
|
|
182
|
+
], exports.EFWorkbench.prototype, "fetch", 2);
|
|
183
|
+
__decorateClass([
|
|
184
|
+
decorators_js.property({ type: String })
|
|
185
|
+
], exports.EFWorkbench.prototype, "apiToken", 2);
|
|
186
|
+
__decorateClass([
|
|
187
|
+
context.provide({ context: apiHostContext }),
|
|
188
|
+
decorators_js.property({ type: String })
|
|
189
|
+
], exports.EFWorkbench.prototype, "apiHost", 2);
|
|
190
|
+
__decorateClass([
|
|
191
|
+
decorators_js.property({ type: Boolean })
|
|
192
|
+
], exports.EFWorkbench.prototype, "rendering", 2);
|
|
193
|
+
exports.EFWorkbench = __decorateClass([
|
|
194
|
+
decorators_js.customElement("ef-workbench")
|
|
195
|
+
], exports.EFWorkbench);
|
|
196
|
+
exports.apiHostContext = apiHostContext;
|
|
197
|
+
exports.fetchContext = fetchContext;
|
|
198
|
+
exports.focusContext = focusContext;
|
|
199
|
+
exports.focusedElement = focusedElement;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { LitElement, PropertyValueMap } from 'lit';
|
|
2
|
+
|
|
3
|
+
export interface FocusContext {
|
|
4
|
+
focusedElement: HTMLElement | null;
|
|
5
|
+
}
|
|
6
|
+
export declare const focusContext: {
|
|
7
|
+
__context__: FocusContext;
|
|
8
|
+
};
|
|
9
|
+
export declare const focusedElement: {
|
|
10
|
+
__context__: HTMLElement | null;
|
|
11
|
+
};
|
|
12
|
+
export declare const fetchContext: {
|
|
13
|
+
__context__: typeof fetch;
|
|
14
|
+
};
|
|
15
|
+
export declare const apiHostContext: {
|
|
16
|
+
__context__: string;
|
|
17
|
+
};
|
|
18
|
+
declare const EFWorkbench_base: typeof LitElement;
|
|
19
|
+
export declare class EFWorkbench extends EFWorkbench_base {
|
|
20
|
+
static styles: import('lit').CSSResult[];
|
|
21
|
+
stageRef: import('lit-html/directives/ref').Ref<HTMLDivElement>;
|
|
22
|
+
canvasRef: import('lit-html/directives/ref').Ref<HTMLSlotElement>;
|
|
23
|
+
resizeObserver: ResizeObserver;
|
|
24
|
+
connectedCallback(): void;
|
|
25
|
+
disconnectedCallback(): void;
|
|
26
|
+
handleStageWheel(event: WheelEvent): void;
|
|
27
|
+
focusContext: this;
|
|
28
|
+
focusedElement: HTMLElement | null;
|
|
29
|
+
fetch: (path: URL | RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
30
|
+
apiToken?: string;
|
|
31
|
+
apiHost: string;
|
|
32
|
+
rendering: boolean;
|
|
33
|
+
focusOverlay: import('lit-html/directives/ref').Ref<HTMLDivElement>;
|
|
34
|
+
protected update(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
|
35
|
+
drawOverlays: () => void;
|
|
36
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
37
|
+
stepThrough(): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
declare global {
|
|
40
|
+
interface HTMLElementTagNameMap {
|
|
41
|
+
"ef-workbench": EFWorkbench;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createContext, provide } from "@lit/context";
|
|
2
|
-
import { css,
|
|
2
|
+
import { css, html, LitElement } from "lit";
|
|
3
3
|
import { TaskStatus } from "@lit/task";
|
|
4
4
|
import { eventOptions, state, property, customElement } from "lit/decorators.js";
|
|
5
5
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
6
|
-
import { awaitMicrotask } from "../../../../lib/util/awaitMicrotask.
|
|
7
|
-
import { deepGetTemporalElements } from "../elements/EFTemporal.
|
|
8
|
-
import { TWMixin } from "./TWMixin.
|
|
9
|
-
import { shallowGetTimegroups } from "../elements/EFTimegroup.
|
|
6
|
+
import { awaitMicrotask } from "../../../../lib/util/awaitMicrotask.js";
|
|
7
|
+
import { deepGetTemporalElements } from "../elements/EFTemporal.js";
|
|
8
|
+
import { TWMixin } from "./TWMixin.js";
|
|
9
|
+
import { shallowGetTimegroups } from "../elements/EFTimegroup.js";
|
|
10
10
|
var __defProp = Object.defineProperty;
|
|
11
11
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
12
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
@@ -111,32 +111,31 @@ let EFWorkbench = class extends TWMixin(LitElement) {
|
|
|
111
111
|
name="canvas"
|
|
112
112
|
></slot>
|
|
113
113
|
`;
|
|
114
|
-
}
|
|
115
|
-
|
|
114
|
+
}
|
|
115
|
+
return html`
|
|
116
|
+
<div
|
|
117
|
+
class="grid h-full w-full"
|
|
118
|
+
style="gridTemplateRows: 1fr 200px; gridTemplateColumns: 100%;"
|
|
119
|
+
>
|
|
116
120
|
<div
|
|
117
|
-
|
|
118
|
-
|
|
121
|
+
${ref(this.stageRef)}
|
|
122
|
+
class="relative grid h-full w-full place-content-center place-items-center overflow-hidden"
|
|
123
|
+
@wheel=${this.handleStageWheel}
|
|
119
124
|
>
|
|
125
|
+
<slot
|
|
126
|
+
${ref(this.canvasRef)}
|
|
127
|
+
class="inline-block"
|
|
128
|
+
name="canvas"
|
|
129
|
+
></slot>
|
|
120
130
|
<div
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
>
|
|
125
|
-
<slot
|
|
126
|
-
${ref(this.canvasRef)}
|
|
127
|
-
class="inline-block"
|
|
128
|
-
name="canvas"
|
|
129
|
-
></slot>
|
|
130
|
-
<div
|
|
131
|
-
class="border border-blue-500 bg-blue-200 bg-opacity-20"
|
|
132
|
-
${ref(this.focusOverlay)}
|
|
133
|
-
></div>
|
|
134
|
-
</div>
|
|
135
|
-
|
|
136
|
-
<slot class="overflow" name="timeline"></slot>
|
|
131
|
+
class="border border-blue-500 bg-blue-200 bg-opacity-20"
|
|
132
|
+
${ref(this.focusOverlay)}
|
|
133
|
+
></div>
|
|
137
134
|
</div>
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
|
|
136
|
+
<slot class="overflow" name="timeline"></slot>
|
|
137
|
+
</div>
|
|
138
|
+
`;
|
|
140
139
|
}
|
|
141
140
|
async stepThrough() {
|
|
142
141
|
const stepDurationMs = 1e3 / 30;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const TWMixin$1 = require("./TWMixin.css.cjs");
|
|
4
|
+
const twSheet = new CSSStyleSheet();
|
|
5
|
+
twSheet.replaceSync(TWMixin$1);
|
|
6
|
+
function TWMixin(Base) {
|
|
7
|
+
class TWElement extends Base {
|
|
8
|
+
createRenderRoot() {
|
|
9
|
+
const renderRoot = super.createRenderRoot();
|
|
10
|
+
if (!(renderRoot instanceof ShadowRoot)) {
|
|
11
|
+
throw new Error(
|
|
12
|
+
"TWMixin can only be applied to elements with shadow roots"
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
if (renderRoot?.adoptedStyleSheets) {
|
|
16
|
+
renderRoot.adoptedStyleSheets = [
|
|
17
|
+
twSheet,
|
|
18
|
+
...renderRoot.adoptedStyleSheets
|
|
19
|
+
];
|
|
20
|
+
} else {
|
|
21
|
+
renderRoot.adoptedStyleSheets = [twSheet];
|
|
22
|
+
}
|
|
23
|
+
return renderRoot;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return TWElement;
|
|
27
|
+
}
|
|
28
|
+
exports.TWMixin = TWMixin;
|