@editframe/elements 0.7.0-beta.10 → 0.7.0-beta.12

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.
Files changed (99) hide show
  1. package/dist/EF_INTERACTIVE.d.ts +1 -0
  2. package/dist/{lib/av → assets/dist}/EncodedAsset.js +1 -1
  3. package/dist/{packages/elements/src/elements → elements}/EFAudio.d.ts +2 -2
  4. package/dist/{packages/elements/src/elements → elements}/EFCaptions.d.ts +4 -4
  5. package/dist/{packages/elements/src/elements → elements}/EFImage.d.ts +3 -3
  6. package/dist/{packages/elements/src/elements → elements}/EFMedia.d.ts +3 -3
  7. package/dist/{packages/elements/src/elements → elements}/EFTemporal.d.ts +1 -1
  8. package/dist/{packages/elements/src/elements → elements}/EFTimegroup.browsertest.d.ts +1 -1
  9. package/dist/{packages/elements/src/elements → elements}/EFTimegroup.d.ts +3 -3
  10. package/dist/{packages/elements/src/elements → elements}/EFVideo.d.ts +3 -3
  11. package/dist/{packages/elements/src/elements → elements}/EFWaveform.d.ts +3 -3
  12. package/dist/{packages/elements/src/elements → elements}/TimegroupController.d.ts +1 -1
  13. package/dist/{packages/elements → elements}/src/EF_FRAMEGEN.js +4 -3
  14. package/dist/elements/src/EF_INTERACTIVE.js +7 -0
  15. package/dist/{packages/elements → elements}/src/elements/EFMedia.js +2 -2
  16. package/dist/{packages/elements → elements}/src/elements/EFTemporal.js +37 -2
  17. package/dist/{packages/elements → elements}/src/gui/EFFilmstrip.js +3 -3
  18. package/dist/{packages/elements → elements}/src/gui/EFWorkbench.js +1 -2
  19. package/dist/{packages/elements → elements}/src/gui/TWMixin.js +10 -2
  20. package/dist/{packages/elements → elements}/src/index.js +3 -1
  21. package/dist/{packages/elements/src/elements → elements}/util.d.ts +1 -1
  22. package/dist/{packages/elements/src/gui → gui}/EFFilmstrip.d.ts +10 -10
  23. package/dist/{packages/elements/src/gui → gui}/EFWorkbench.d.ts +3 -3
  24. package/dist/index.d.ts +10 -0
  25. package/dist/msToTimeCode.d.ts +1 -0
  26. package/dist/style.css +9 -0
  27. package/package.json +6 -9
  28. package/src/elements/EFAudio.ts +1 -1
  29. package/src/elements/EFCaptions.ts +7 -7
  30. package/src/elements/EFImage.ts +3 -3
  31. package/src/elements/EFMedia.ts +8 -8
  32. package/src/elements/EFSourceMixin.ts +1 -1
  33. package/src/elements/EFTemporal.ts +42 -5
  34. package/src/elements/EFTimegroup.browsertest.ts +3 -3
  35. package/src/elements/EFTimegroup.ts +4 -4
  36. package/src/elements/EFVideo.ts +2 -2
  37. package/src/elements/EFWaveform.ts +6 -6
  38. package/src/elements/FetchMixin.ts +1 -1
  39. package/src/elements/TimegroupController.ts +1 -1
  40. package/src/elements/durationConverter.ts +1 -1
  41. package/src/elements/util.ts +1 -1
  42. package/src/gui/EFFilmstrip.ts +17 -13
  43. package/src/gui/EFWorkbench.ts +4 -5
  44. package/src/gui/TWMixin.ts +10 -3
  45. package/dist/lib/av/EncodedAsset.cjs +0 -577
  46. package/dist/lib/av/MP4File.cjs +0 -187
  47. package/dist/lib/av/msToTimeCode.cjs +0 -15
  48. package/dist/lib/util/awaitMicrotask.cjs +0 -4
  49. package/dist/lib/util/awaitMicrotask.js +0 -4
  50. package/dist/lib/util/memoize.cjs +0 -14
  51. package/dist/packages/elements/src/EF_FRAMEGEN.cjs +0 -197
  52. package/dist/packages/elements/src/EF_INTERACTIVE.cjs +0 -4
  53. package/dist/packages/elements/src/EF_INTERACTIVE.d.ts +0 -1
  54. package/dist/packages/elements/src/EF_INTERACTIVE.js +0 -4
  55. package/dist/packages/elements/src/elements/CrossUpdateController.cjs +0 -16
  56. package/dist/packages/elements/src/elements/EFAudio.cjs +0 -53
  57. package/dist/packages/elements/src/elements/EFCaptions.cjs +0 -164
  58. package/dist/packages/elements/src/elements/EFImage.cjs +0 -79
  59. package/dist/packages/elements/src/elements/EFMedia.cjs +0 -336
  60. package/dist/packages/elements/src/elements/EFSourceMixin.cjs +0 -55
  61. package/dist/packages/elements/src/elements/EFTemporal.cjs +0 -199
  62. package/dist/packages/elements/src/elements/EFTimegroup.cjs +0 -352
  63. package/dist/packages/elements/src/elements/EFVideo.cjs +0 -109
  64. package/dist/packages/elements/src/elements/EFWaveform.cjs +0 -242
  65. package/dist/packages/elements/src/elements/FetchMixin.cjs +0 -28
  66. package/dist/packages/elements/src/elements/TimegroupController.cjs +0 -20
  67. package/dist/packages/elements/src/elements/durationConverter.cjs +0 -8
  68. package/dist/packages/elements/src/elements/parseTimeToMs.cjs +0 -12
  69. package/dist/packages/elements/src/elements/util.cjs +0 -11
  70. package/dist/packages/elements/src/gui/EFFilmstrip.cjs +0 -825
  71. package/dist/packages/elements/src/gui/EFWorkbench.cjs +0 -214
  72. package/dist/packages/elements/src/gui/TWMixin.cjs +0 -28
  73. package/dist/packages/elements/src/gui/TWMixin.css.cjs +0 -3
  74. package/dist/packages/elements/src/index.cjs +0 -50
  75. package/dist/packages/elements/src/index.d.ts +0 -10
  76. package/dist/{packages/elements/src/EF_FRAMEGEN.d.ts → EF_FRAMEGEN.d.ts} +0 -0
  77. package/dist/{lib/av → assets/dist}/MP4File.js +0 -0
  78. package/dist/{lib/util → assets/dist}/memoize.js +0 -0
  79. package/dist/{packages/elements/src/elements → elements}/CrossUpdateController.d.ts +0 -0
  80. package/dist/{packages/elements/src/elements → elements}/EFSourceMixin.d.ts +0 -0
  81. package/dist/{packages/elements/src/elements → elements}/FetchMixin.d.ts +0 -0
  82. package/dist/{packages/elements/src/elements → elements}/durationConverter.d.ts +0 -0
  83. package/dist/{packages/elements/src/elements → elements}/parseTimeToMs.d.ts +0 -0
  84. package/dist/{packages/elements → elements}/src/elements/CrossUpdateController.js +0 -0
  85. package/dist/{packages/elements → elements}/src/elements/EFAudio.js +0 -0
  86. package/dist/{packages/elements → elements}/src/elements/EFCaptions.js +1 -1
  87. /package/dist/{packages/elements → elements}/src/elements/EFImage.js +0 -0
  88. /package/dist/{packages/elements → elements}/src/elements/EFSourceMixin.js +0 -0
  89. /package/dist/{packages/elements → elements}/src/elements/EFTimegroup.js +0 -0
  90. /package/dist/{packages/elements → elements}/src/elements/EFVideo.js +0 -0
  91. /package/dist/{packages/elements → elements}/src/elements/EFWaveform.js +0 -0
  92. /package/dist/{packages/elements → elements}/src/elements/FetchMixin.js +0 -0
  93. /package/dist/{packages/elements → elements}/src/elements/TimegroupController.js +0 -0
  94. /package/dist/{packages/elements → elements}/src/elements/durationConverter.js +0 -0
  95. /package/dist/{packages/elements → elements}/src/elements/parseTimeToMs.js +0 -0
  96. /package/dist/{packages/elements → elements}/src/elements/util.js +0 -0
  97. /package/dist/{packages/elements → elements}/src/gui/TWMixin.css.js +0 -0
  98. /package/dist/{lib/av → elements/src}/msToTimeCode.js +0 -0
  99. /package/dist/{packages/elements/src/gui → gui}/TWMixin.d.ts +0 -0
@@ -0,0 +1 @@
1
+ export declare let EF_INTERACTIVE: boolean;
@@ -1,6 +1,6 @@
1
1
  import * as MP4Box from "mp4box";
2
2
  import debug from "debug";
3
- import { memoize } from "../util/memoize.js";
3
+ import { memoize } from "./memoize.js";
4
4
  import { MP4File } from "./MP4File.js";
5
5
  var __defProp = Object.defineProperty;
6
6
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -1,8 +1,8 @@
1
- import { EFMedia } from './EFMedia';
1
+ import { EFMedia } from './EFMedia.ts';
2
2
  import { Task } from '@lit/task';
3
3
 
4
4
  export declare class EFAudio extends EFMedia {
5
- audioElementRef: import('lit-html/directives/ref').Ref<HTMLAudioElement>;
5
+ audioElementRef: import('lit-html/directives/ref.js').Ref<HTMLAudioElement>;
6
6
  src: string;
7
7
  render(): import('lit-html').TemplateResult<1>;
8
8
  get audioElement(): HTMLAudioElement | undefined;
@@ -1,9 +1,9 @@
1
- import { EFAudio } from './EFAudio';
2
1
  import { LitElement, PropertyValueMap } from 'lit';
3
2
  import { Task } from '@lit/task';
4
- import { EFVideo } from './EFVideo';
3
+ import { EFVideo } from './EFVideo.ts';
4
+ import { EFAudio } from './EFAudio.ts';
5
5
 
6
- declare const EFCaptionsActiveWord_base: (new (...args: any[]) => import('./EFTemporal').TemporalMixinInterface) & typeof LitElement;
6
+ declare const EFCaptionsActiveWord_base: (new (...args: any[]) => import('./EFTemporal.ts').TemporalMixinInterface) & typeof LitElement;
7
7
  export declare class EFCaptionsActiveWord extends EFCaptionsActiveWord_base {
8
8
  static styles: import('lit').CSSResult[];
9
9
  render(): import('lit-html').TemplateResult<1>;
@@ -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 EFCaptions_base: (new (...args: any[]) => import('./EFSourceMixin').EFSourceMixinInterface) & (new (...args: any[]) => import('./EFTemporal').TemporalMixinInterface) & (new (...args: any[]) => import('./FetchMixin').FetchMixinInterface) & typeof LitElement;
16
+ declare const EFCaptions_base: (new (...args: any[]) => import('./EFSourceMixin.ts').EFSourceMixinInterface) & (new (...args: any[]) => import('./EFTemporal.ts').TemporalMixinInterface) & (new (...args: any[]) => import('./FetchMixin.ts').FetchMixinInterface) & typeof LitElement;
17
17
  export declare class EFCaptions extends EFCaptions_base {
18
18
  static styles: import('lit').CSSResult[];
19
19
  target: null;
@@ -1,11 +1,11 @@
1
1
  import { Task } from '@lit/task';
2
2
  import { LitElement } from 'lit';
3
3
 
4
- declare const EFImage_base: (new (...args: any[]) => import('./EFSourceMixin').EFSourceMixinInterface) & (new (...args: any[]) => import('./FetchMixin').FetchMixinInterface) & typeof LitElement;
4
+ declare const EFImage_base: (new (...args: any[]) => import('./EFSourceMixin.ts').EFSourceMixinInterface) & (new (...args: any[]) => import('./FetchMixin.ts').FetchMixinInterface) & typeof LitElement;
5
5
  export declare class EFImage extends EFImage_base {
6
6
  static styles: import('lit').CSSResult[];
7
- imageRef: import('lit-html/directives/ref').Ref<HTMLImageElement>;
8
- canvasRef: import('lit-html/directives/ref').Ref<HTMLCanvasElement>;
7
+ imageRef: import('lit-html/directives/ref.js').Ref<HTMLImageElement>;
8
+ canvasRef: import('lit-html/directives/ref.js').Ref<HTMLCanvasElement>;
9
9
  render(): import('lit-html').TemplateResult<1>;
10
10
  assetPath(): string;
11
11
  fetchImage: Task<readonly [string, typeof fetch], void>;
@@ -1,12 +1,12 @@
1
1
  import { LitElement, PropertyValueMap } from 'lit';
2
2
  import { Task } from '@lit/task';
3
3
  import { TrackFragmentIndex, TrackSegment } from '../../../assets/src';
4
- import { MP4File } from '../../../../lib/av/MP4File';
5
- import { VideoAsset } from '../../../../lib/av/EncodedAsset';
4
+ import { MP4File } from '../../../assets/MP4File.js/src';
5
+ import { VideoAsset } from '../../../assets/EncodedAsset.js/src';
6
6
 
7
7
  import type * as MP4Box from "mp4box";
8
8
  export declare const deepGetMediaElements: (element: Element, medias?: EFMedia[]) => EFMedia[];
9
- declare const EFMedia_base: (new (...args: any[]) => import('./EFSourceMixin').EFSourceMixinInterface) & (new (...args: any[]) => import('./EFTemporal').TemporalMixinInterface) & (new (...args: any[]) => import('./FetchMixin').FetchMixinInterface) & typeof LitElement;
9
+ declare const EFMedia_base: (new (...args: any[]) => import('./EFSourceMixin.ts').EFSourceMixinInterface) & (new (...args: any[]) => import('./EFTemporal.ts').TemporalMixinInterface) & (new (...args: any[]) => import('./FetchMixin.ts').FetchMixinInterface) & typeof LitElement;
10
10
  export declare class EFMedia extends EFMedia_base {
11
11
  #private;
12
12
  static styles: import('lit').CSSResult[];
@@ -1,5 +1,5 @@
1
1
  import { LitElement, ReactiveController } from 'lit';
2
- import { EFTimegroup } from './EFTimegroup';
2
+ import { EFTimegroup } from './EFTimegroup.ts';
3
3
  import { Task } from '@lit/task';
4
4
 
5
5
  export declare const timegroupContext: {
@@ -1,6 +1,6 @@
1
1
  import { LitElement } from 'lit';
2
2
 
3
- declare const TestTemporal_base: (new (...args: any[]) => import('./EFTemporal').TemporalMixinInterface) & typeof LitElement;
3
+ declare const TestTemporal_base: (new (...args: any[]) => import('./EFTemporal.ts').TemporalMixinInterface) & typeof LitElement;
4
4
  declare class TestTemporal extends TestTemporal_base {
5
5
  get hasOwnDuration(): boolean;
6
6
  }
@@ -2,7 +2,7 @@ import { LitElement, PropertyValueMap } from 'lit';
2
2
  import { Task } from '@lit/task';
3
3
 
4
4
  export declare const shallowGetTimegroups: (element: Element, groups?: EFTimegroup[]) => EFTimegroup[];
5
- declare const EFTimegroup_base: (new (...args: any[]) => import('./EFTemporal').TemporalMixinInterface) & typeof LitElement;
5
+ declare const EFTimegroup_base: (new (...args: any[]) => import('./EFTemporal.ts').TemporalMixinInterface) & typeof LitElement;
6
6
  export declare class EFTimegroup extends EFTimegroup_base {
7
7
  #private;
8
8
  static styles: import('lit').CSSResult;
@@ -20,8 +20,8 @@ export declare class EFTimegroup extends EFTimegroup_base {
20
20
  get crossoverStartMs(): number;
21
21
  get crossoverEndMs(): number;
22
22
  get durationMs(): number;
23
- waitForMediaDurations(): Promise<Record<number, import('../../../assets/src').TrackFragmentIndex>[]>;
24
- get childTemporals(): import('./EFTemporal').TemporalMixinInterface[];
23
+ waitForMediaDurations(): Promise<Record<number, import('packages/assets/dist/Probe.js').TrackFragmentIndex>[]>;
24
+ get childTemporals(): import('./EFTemporal.ts').TemporalMixinInterface[];
25
25
  protected updated(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
26
26
  shouldWrapWithWorkbench(): boolean;
27
27
  wrapWithWorkbench(): void;
@@ -1,14 +1,14 @@
1
1
  import { Task } from '@lit/task';
2
- import { EFMedia } from './EFMedia';
2
+ import { EFMedia } from './EFMedia.ts';
3
3
 
4
4
  declare const EFVideo_base: typeof EFMedia;
5
5
  export declare class EFVideo extends EFVideo_base {
6
6
  #private;
7
7
  static styles: import('lit').CSSResult[];
8
- canvasRef: import('lit-html/directives/ref').Ref<HTMLCanvasElement>;
8
+ canvasRef: import('lit-html/directives/ref.js').Ref<HTMLCanvasElement>;
9
9
  render(): import('lit-html').TemplateResult<1>;
10
10
  get canvasElement(): HTMLCanvasElement | undefined;
11
11
  frameTask: Task<readonly [import('@lit/task').TaskStatus, import('@lit/task').TaskStatus, import('@lit/task').TaskStatus, import('@lit/task').TaskStatus, import('@lit/task').TaskStatus, import('@lit/task').TaskStatus], void>;
12
- paintTask: Task<readonly [import('../../../../lib/av/EncodedAsset').VideoAsset | undefined, number], number | undefined>;
12
+ paintTask: Task<readonly [import('packages/assets/dist/EncodedAsset.js').VideoAsset | undefined, number], number | undefined>;
13
13
  }
14
14
  export {};
@@ -1,10 +1,10 @@
1
- import { EFAudio } from './EFAudio';
1
+ import { EFAudio } from './EFAudio.ts';
2
2
  import { LitElement } from 'lit';
3
- import { EFVideo } from './EFVideo';
3
+ import { EFVideo } from './EFVideo.ts';
4
4
  import { Task } from '@lit/task';
5
5
  import { Ref } from 'lit/directives/ref.js';
6
6
 
7
- declare const EFWaveform_base: (new (...args: any[]) => import('./EFTemporal').TemporalMixinInterface) & typeof LitElement;
7
+ declare const EFWaveform_base: (new (...args: any[]) => import('./EFTemporal.ts').TemporalMixinInterface) & typeof LitElement;
8
8
  export declare class EFWaveform extends EFWaveform_base {
9
9
  static styles: never[];
10
10
  svgRef: Ref<SVGElement>;
@@ -1,5 +1,5 @@
1
1
  import { ReactiveController, LitElement } from 'lit';
2
- import { EFTimegroup } from './EFTimegroup';
2
+ import { EFTimegroup } from './EFTimegroup.ts';
3
3
 
4
4
  export declare class TimegroupController implements ReactiveController {
5
5
  private host;
@@ -1,6 +1,5 @@
1
1
  import debug from "debug";
2
2
  import { TaskStatus } from "@lit/task";
3
- import { awaitMicrotask } from "../../../lib/util/awaitMicrotask.js";
4
3
  import { deepGetElementsWithFrameTasks } from "./elements/EFTemporal.js";
5
4
  import { shallowGetTimegroups } from "./elements/EFTimegroup.js";
6
5
  const log = debug("ef:elements:EF_FRAMEGEN");
@@ -136,7 +135,7 @@ class EfFramegen {
136
135
  log("Awaiting initialBusyTasks");
137
136
  await this.initialBusyTasks;
138
137
  log("Awaiting microtask");
139
- await awaitMicrotask();
138
+ await new Promise(queueMicrotask);
140
139
  log("Awaiting frame tasks");
141
140
  const now = performance.now();
142
141
  await Promise.all(
@@ -191,7 +190,9 @@ class EfFramegen {
191
190
  }
192
191
  }
193
192
  }
194
- window.EF_FRAMEGEN = new EfFramegen();
193
+ if (typeof window !== "undefined") {
194
+ window.EF_FRAMEGEN = new EfFramegen();
195
+ }
195
196
  export {
196
197
  EfFramegen
197
198
  };
@@ -0,0 +1,7 @@
1
+ let EF_INTERACTIVE = false;
2
+ if (typeof window !== "undefined") {
3
+ EF_INTERACTIVE = !window.location?.search.includes("EF_NONINTERACTIVE");
4
+ }
5
+ export {
6
+ EF_INTERACTIVE
7
+ };
@@ -4,9 +4,9 @@ import { deepArrayEquals } from "@lit/task/deep-equals.js";
4
4
  import { Task } from "@lit/task";
5
5
  import { consume } from "@lit/context";
6
6
  import debug from "debug";
7
- import { MP4File } from "../../../../lib/av/MP4File.js";
7
+ import { MP4File } from "../../../assets/dist/MP4File.js";
8
+ import { VideoAsset } from "../../../assets/dist/EncodedAsset.js";
8
9
  import { EFTemporal } from "./EFTemporal.js";
9
- import { VideoAsset } from "../../../../lib/av/EncodedAsset.js";
10
10
  import { FetchMixin } from "./FetchMixin.js";
11
11
  import { apiHostContext } from "../gui/EFWorkbench.js";
12
12
  import { EFSourceMixin } from "./EFSourceMixin.js";
@@ -36,7 +36,19 @@ const deepGetElementsWithFrameTasks = (element, elements = []) => {
36
36
  }
37
37
  return elements;
38
38
  };
39
+ let temporalCache;
40
+ const resetTemporalCache = () => {
41
+ temporalCache = /* @__PURE__ */ new Map();
42
+ if (typeof requestAnimationFrame !== "undefined") {
43
+ requestAnimationFrame(resetTemporalCache);
44
+ }
45
+ };
46
+ resetTemporalCache();
39
47
  const shallowGetTemporalElements = (element, temporals = []) => {
48
+ const cachedResult = temporalCache.get(element);
49
+ if (cachedResult) {
50
+ return cachedResult;
51
+ }
40
52
  for (const child of element.children) {
41
53
  if (isEFTemporal(child)) {
42
54
  temporals.push(child);
@@ -44,6 +56,7 @@ const shallowGetTemporalElements = (element, temporals = []) => {
44
56
  shallowGetTemporalElements(child, temporals);
45
57
  }
46
58
  }
59
+ temporalCache.set(element, temporals);
47
60
  return temporals;
48
61
  };
49
62
  class OwnCurrentTimeController {
@@ -59,6 +72,14 @@ class OwnCurrentTimeController {
59
72
  this.host.removeController(this);
60
73
  }
61
74
  }
75
+ let startTimeMsCache = /* @__PURE__ */ new WeakMap();
76
+ const resetStartTimeMsCache = () => {
77
+ startTimeMsCache = /* @__PURE__ */ new WeakMap();
78
+ if (typeof requestAnimationFrame !== "undefined") {
79
+ requestAnimationFrame(resetStartTimeMsCache);
80
+ }
81
+ };
82
+ resetStartTimeMsCache();
62
83
  const EFTemporal = (superClass) => {
63
84
  class TemporalMixinClass extends superClass {
64
85
  constructor() {
@@ -123,27 +144,41 @@ const EFTemporal = (superClass) => {
123
144
  return this.startTimeMs - this.parentTemporal.startTimeMs;
124
145
  }
125
146
  get startTimeMs() {
147
+ const cachedStartTime = startTimeMsCache.get(this);
148
+ if (cachedStartTime !== void 0) {
149
+ return cachedStartTime;
150
+ }
126
151
  const parentTimegroup = this.parentTimegroup;
127
152
  if (!parentTimegroup) {
153
+ startTimeMsCache.set(this, 0);
128
154
  return 0;
129
155
  }
130
156
  switch (parentTimegroup.mode) {
131
157
  case "sequence": {
132
158
  const siblingTemorals = shallowGetTemporalElements(parentTimegroup);
133
- const ownIndex = siblingTemorals.indexOf(
159
+ const ownIndex = siblingTemorals?.indexOf(
134
160
  this
135
161
  );
136
162
  if (ownIndex === 0) {
163
+ startTimeMsCache.set(this, parentTimegroup.startTimeMs);
137
164
  return parentTimegroup.startTimeMs;
138
165
  }
139
- const previous = siblingTemorals[ownIndex - 1];
166
+ const previous = siblingTemorals?.[(ownIndex ?? 0) - 1];
140
167
  if (!previous) {
141
168
  throw new Error("Previous temporal element not found");
142
169
  }
170
+ startTimeMsCache.set(
171
+ this,
172
+ previous.startTimeMs + previous.durationMs
173
+ );
143
174
  return previous.startTimeMs + previous.durationMs;
144
175
  }
145
176
  case "contain":
146
177
  case "fixed":
178
+ startTimeMsCache.set(
179
+ this,
180
+ parentTimegroup.startTimeMs + this.offsetMs
181
+ );
147
182
  return parentTimegroup.startTimeMs + this.offsetMs;
148
183
  default:
149
184
  throw new Error(`Invalid time mode: ${parentTimegroup.mode}`);
@@ -12,7 +12,7 @@ import { TimegroupController } from "../elements/TimegroupController.js";
12
12
  import { consume } from "@lit/context";
13
13
  import { focusContext, focusedElement } from "./EFWorkbench.js";
14
14
  import { TWMixin } from "./TWMixin.js";
15
- import { msToTimeCode } from "../../../../lib/av/msToTimeCode.js";
15
+ import { msToTimeCode } from "../msToTimeCode.js";
16
16
  var __defProp = Object.defineProperty;
17
17
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
18
18
  var __typeError = (msg) => {
@@ -168,7 +168,7 @@ __decorateClass([
168
168
  consume({ context: focusedElement, subscribe: true })
169
169
  ], FilmstripItem.prototype, "focusedElement", 2);
170
170
  __decorateClass([
171
- property({ type: HTMLElement, attribute: false })
171
+ property({ type: Object, attribute: false })
172
172
  ], FilmstripItem.prototype, "element", 2);
173
173
  __decorateClass([
174
174
  property({ type: Number })
@@ -292,7 +292,7 @@ let EFHierarchyItem = class extends TWMixin(LitElement) {
292
292
  }
293
293
  };
294
294
  __decorateClass([
295
- property({ type: HTMLElement, attribute: false })
295
+ property({ type: Object, attribute: false })
296
296
  ], EFHierarchyItem.prototype, "element", 2);
297
297
  __decorateClass([
298
298
  consume({ context: focusContext })
@@ -3,7 +3,6 @@ import { css, html, LitElement } from "lit";
3
3
  import { TaskStatus } from "@lit/task";
4
4
  import { state, eventOptions, property, customElement } from "lit/decorators.js";
5
5
  import { createRef, ref } from "lit/directives/ref.js";
6
- import { awaitMicrotask } from "../../../../lib/util/awaitMicrotask.js";
7
6
  import { deepGetTemporalElements } from "../elements/EFTemporal.js";
8
7
  import { TWMixin } from "./TWMixin.js";
9
8
  import { shallowGetTimegroups } from "../elements/EFTimegroup.js";
@@ -161,7 +160,7 @@ let EFWorkbench = class extends TWMixin(LitElement) {
161
160
  await Promise.all(busyTasks.map((task) => task.taskComplete));
162
161
  for (let i = 0; i < frameCount; i++) {
163
162
  firstGroup.currentTimeMs = i * stepDurationMs;
164
- await awaitMicrotask();
163
+ await new Promise(queueMicrotask);
165
164
  const busyTasks2 = temporals.filter((temporal) => temporal.frameTask.status < TaskStatus.COMPLETE).map((temporal) => temporal.frameTask);
166
165
  await Promise.all(busyTasks2.map((task) => task.taskComplete));
167
166
  await new Promise((resolve) => requestAnimationFrame(resolve));
@@ -1,6 +1,9 @@
1
1
  import twStyle from "./TWMixin.css.js";
2
- const twSheet = new CSSStyleSheet();
3
- twSheet.replaceSync(twStyle);
2
+ let twSheet = null;
3
+ if (typeof window !== "undefined") {
4
+ twSheet = new CSSStyleSheet();
5
+ twSheet.replaceSync(twStyle);
6
+ }
4
7
  function TWMixin(Base) {
5
8
  class TWElement extends Base {
6
9
  createRenderRoot() {
@@ -10,6 +13,11 @@ function TWMixin(Base) {
10
13
  "TWMixin can only be applied to elements with shadow roots"
11
14
  );
12
15
  }
16
+ if (!twSheet) {
17
+ throw new Error(
18
+ "twSheet not found. Probable cause: CSSStyleSheet not supported in this environment"
19
+ );
20
+ }
13
21
  if (renderRoot?.adoptedStyleSheets) {
14
22
  renderRoot.adoptedStyleSheets = [
15
23
  twSheet,
@@ -9,7 +9,9 @@ import { EFWaveform } from "./elements/EFWaveform.js";
9
9
  import { EFWorkbench } from "./gui/EFWorkbench.js";
10
10
  import { EFFilmstrip } from "./gui/EFFilmstrip.js";
11
11
  import "./EF_FRAMEGEN.js";
12
- window.EF_REGISTERED = true;
12
+ if (typeof window !== "undefined") {
13
+ window.EF_REGISTERED = true;
14
+ }
13
15
  export {
14
16
  EFAudio,
15
17
  EFCaptions,
@@ -1,4 +1,4 @@
1
- import { EFTimegroup } from './EFTimegroup';
1
+ import { EFTimegroup } from './EFTimegroup.ts';
2
2
 
3
3
  export declare const getRootTimeGroup: (element: Element) => EFTimegroup | null;
4
4
  export declare const getStartTimeMs: (element: Element) => number;
@@ -1,11 +1,11 @@
1
- import { EFTimegroup } from '../elements/EFTimegroup';
1
+ import { EFTimegroup } from '../elements/EFTimegroup.ts';
2
2
  import { LitElement, nothing, TemplateResult, ReactiveController, PropertyValueMap } from 'lit';
3
- import { EFImage } from '../elements/EFImage';
4
- import { EFAudio } from '../elements/EFAudio';
5
- import { EFVideo } from '../elements/EFVideo';
6
- import { TemporalMixinInterface } from '../elements/EFTemporal';
7
- import { TimegroupController } from '../elements/TimegroupController';
8
- import { FocusContext } from './EFWorkbench';
3
+ import { EFImage } from '../elements/EFImage.ts';
4
+ import { EFAudio } from '../elements/EFAudio.ts';
5
+ import { EFVideo } from '../elements/EFVideo.ts';
6
+ import { TemporalMixinInterface } from '../elements/EFTemporal.ts';
7
+ import { TimegroupController } from '../elements/TimegroupController.ts';
8
+ import { FocusContext } from './EFWorkbench.ts';
9
9
 
10
10
  declare class ElementFilmstripController implements ReactiveController {
11
11
  private host;
@@ -115,9 +115,9 @@ export declare class EFFilmstrip extends EFFilmstrip_base {
115
115
  scrub(e: MouseEvent): void;
116
116
  startScrub(e: MouseEvent): void;
117
117
  scrollScrub(e: WheelEvent): void;
118
- gutterRef: import('lit-html/directives/ref').Ref<HTMLDivElement>;
119
- hierarchyRef: import('lit-html/directives/ref').Ref<HTMLDivElement>;
120
- playheadRef: import('lit-html/directives/ref').Ref<HTMLDivElement>;
118
+ gutterRef: import('lit-html/directives/ref.js').Ref<HTMLDivElement>;
119
+ hierarchyRef: import('lit-html/directives/ref.js').Ref<HTMLDivElement>;
120
+ playheadRef: import('lit-html/directives/ref.js').Ref<HTMLDivElement>;
121
121
  get gutter(): HTMLDivElement | undefined;
122
122
  render(): TemplateResult<1>;
123
123
  update(changedProperties: Map<string | number | symbol, unknown>): void;
@@ -18,8 +18,8 @@ export declare const apiHostContext: {
18
18
  declare const EFWorkbench_base: typeof LitElement;
19
19
  export declare class EFWorkbench extends EFWorkbench_base {
20
20
  static styles: import('lit').CSSResult[];
21
- stageRef: import('lit-html/directives/ref').Ref<HTMLDivElement>;
22
- canvasRef: import('lit-html/directives/ref').Ref<HTMLSlotElement>;
21
+ stageRef: import('lit-html/directives/ref.js').Ref<HTMLDivElement>;
22
+ canvasRef: import('lit-html/directives/ref.js').Ref<HTMLSlotElement>;
23
23
  stageScale: number;
24
24
  setStageScale: () => void;
25
25
  connectedCallback(): void;
@@ -31,7 +31,7 @@ export declare class EFWorkbench extends EFWorkbench_base {
31
31
  apiToken?: string;
32
32
  apiHost: string;
33
33
  rendering: boolean;
34
- focusOverlay: import('lit-html/directives/ref').Ref<HTMLDivElement>;
34
+ focusOverlay: import('lit-html/directives/ref.js').Ref<HTMLDivElement>;
35
35
  update(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
36
36
  drawOverlays: () => void;
37
37
  render(): import('lit-html').TemplateResult<1>;
@@ -0,0 +1,10 @@
1
+
2
+ export { EFTimegroup } from './elements/EFTimegroup.ts';
3
+ export { EFImage } from './elements/EFImage.ts';
4
+ export type { EFMedia } from './elements/EFMedia.ts';
5
+ export { EFAudio } from './elements/EFAudio.ts';
6
+ export { EFVideo } from './elements/EFVideo.ts';
7
+ export { EFCaptions, EFCaptionsActiveWord } from './elements/EFCaptions.ts';
8
+ export { EFWaveform } from './elements/EFWaveform.ts';
9
+ export { EFWorkbench } from './gui/EFWorkbench.ts';
10
+ export { EFFilmstrip } from './gui/EFFilmstrip.ts';
@@ -0,0 +1 @@
1
+ export declare const msToTimeCode: (ms: number, subSecond?: boolean) => string;
package/dist/style.css CHANGED
@@ -740,6 +740,7 @@ video {
740
740
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
741
741
  transition-duration: 150ms;
742
742
  }
743
+
743
744
  html {
744
745
  height: 100%;
745
746
  width: 100%;
@@ -750,6 +751,7 @@ body {
750
751
  --tw-bg-opacity: 1;
751
752
  background-color: rgb(0 0 0 / var(--tw-bg-opacity));
752
753
  }
754
+
753
755
  :root {
754
756
  font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
755
757
  line-height: 1.5;
@@ -761,30 +763,37 @@ body {
761
763
  -moz-osx-font-smoothing: grayscale;
762
764
  -webkit-text-size-adjust: 100%;
763
765
  }
766
+
764
767
  .hover\:bg-blue-400:hover {
765
768
  --tw-bg-opacity: 1;
766
769
  background-color: rgb(96 165 250 / var(--tw-bg-opacity));
767
770
  }
771
+
768
772
  .hover\:bg-slate-400:hover {
769
773
  --tw-bg-opacity: 1;
770
774
  background-color: rgb(148 163 184 / var(--tw-bg-opacity));
771
775
  }
776
+
772
777
  .peer:hover ~ .peer-hover\:border-slate-400 {
773
778
  --tw-border-opacity: 1;
774
779
  border-color: rgb(148 163 184 / var(--tw-border-opacity));
775
780
  }
781
+
776
782
  .peer:hover ~ .peer-hover\:bg-slate-300 {
777
783
  --tw-bg-opacity: 1;
778
784
  background-color: rgb(203 213 225 / var(--tw-bg-opacity));
779
785
  }
786
+
780
787
  .data-\[focused\]\:bg-slate-400[data-focused] {
781
788
  --tw-bg-opacity: 1;
782
789
  background-color: rgb(148 163 184 / var(--tw-bg-opacity));
783
790
  }
791
+
784
792
  .peer[data-focused] ~ .peer-data-\[focused\]\:border-slate-400 {
785
793
  --tw-border-opacity: 1;
786
794
  border-color: rgb(148 163 184 / var(--tw-border-opacity));
787
795
  }
796
+
788
797
  .peer[data-focused] ~ .peer-data-\[focused\]\:bg-slate-300 {
789
798
  --tw-bg-opacity: 1;
790
799
  background-color: rgb(203 213 225 / var(--tw-bg-opacity));
package/package.json CHANGED
@@ -1,16 +1,12 @@
1
1
  {
2
2
  "name": "@editframe/elements",
3
- "version": "0.7.0-beta.10",
3
+ "version": "0.7.0-beta.12",
4
4
  "description": "",
5
5
  "exports": {
6
6
  ".": {
7
7
  "import": {
8
- "default": "./dist/packages/elements/src/index.js",
9
- "types": "./dist/packages/elements/src/index.d.ts"
10
- },
11
- "require": {
12
- "default": "./dist/packages/elements/src/index.cjs",
13
- "types": "./dist/packages/elements/src/index.d.ts"
8
+ "types": "./dist/index.d.ts",
9
+ "default": "./dist/elements/src/index.js"
14
10
  }
15
11
  },
16
12
  "./styles.css": "./dist/style.css"
@@ -24,7 +20,7 @@
24
20
  "author": "",
25
21
  "license": "UNLICENSED",
26
22
  "dependencies": {
27
- "@editframe/assets": "0.7.0-beta.10",
23
+ "@editframe/assets": "0.7.0-beta.12",
28
24
  "@lit/context": "^1.1.2",
29
25
  "@lit/task": "^1.0.1",
30
26
  "d3": "^7.9.0",
@@ -35,9 +31,10 @@
35
31
  "devDependencies": {
36
32
  "@types/d3": "^7.4.3",
37
33
  "@types/dom-webcodecs": "^0.1.11",
38
- "@types/node": "^20.14.9",
34
+ "@types/node": "^20.14.13",
39
35
  "autoprefixer": "^10.4.19",
40
36
  "rollup-plugin-tsconfig-paths": "^1.5.2",
37
+ "typescript": "^5.5.4",
41
38
  "vite-plugin-dts": "^3.9.1",
42
39
  "vite-tsconfig-paths": "^4.3.2"
43
40
  }
@@ -1,7 +1,7 @@
1
1
  import { html } from "lit";
2
2
  import { createRef, ref } from "lit/directives/ref.js";
3
3
  import { customElement, property } from "lit/decorators.js";
4
- import { EFMedia } from "./EFMedia";
4
+ import { EFMedia } from "./EFMedia.ts";
5
5
  import { Task } from "@lit/task";
6
6
 
7
7
  @customElement("ef-audio")
@@ -1,13 +1,13 @@
1
- import { EFAudio } from "./EFAudio";
2
1
  import { LitElement, type PropertyValueMap, html, css } from "lit";
3
2
  import { Task } from "@lit/task";
4
3
  import { customElement, property } from "lit/decorators.js";
5
- import { EFVideo } from "./EFVideo";
6
- import { EFTemporal } from "./EFTemporal";
7
- import { CrossUpdateController } from "./CrossUpdateController";
8
- import { FetchMixin } from "./FetchMixin";
9
- import { EFSourceMixin } from "./EFSourceMixin";
10
- import { EF_INTERACTIVE } from "../EF_INTERACTIVE";
4
+ import { EFVideo } from "./EFVideo.ts";
5
+ import { EFAudio } from "./EFAudio.ts";
6
+ import { EFTemporal } from "./EFTemporal.ts";
7
+ import { CrossUpdateController } from "./CrossUpdateController.ts";
8
+ import { FetchMixin } from "./FetchMixin.ts";
9
+ import { EFSourceMixin } from "./EFSourceMixin.ts";
10
+ import { EF_INTERACTIVE } from "../EF_INTERACTIVE.ts";
11
11
 
12
12
  interface Word {
13
13
  text: string;
@@ -2,9 +2,9 @@ import { Task } from "@lit/task";
2
2
  import { LitElement, html, css } from "lit";
3
3
  import { customElement } from "lit/decorators.js";
4
4
  import { createRef, ref } from "lit/directives/ref.js";
5
- import { FetchMixin } from "./FetchMixin";
6
- import { EFSourceMixin } from "./EFSourceMixin";
7
- import { EF_INTERACTIVE } from "../EF_INTERACTIVE";
5
+ import { FetchMixin } from "./FetchMixin.ts";
6
+ import { EFSourceMixin } from "./EFSourceMixin.ts";
7
+ import { EF_INTERACTIVE } from "../EF_INTERACTIVE.ts";
8
8
 
9
9
  @customElement("ef-image")
10
10
  export class EFImage extends EFSourceMixin(FetchMixin(LitElement), {
@@ -8,14 +8,14 @@ import debug from "debug";
8
8
 
9
9
  import type { TrackFragmentIndex, TrackSegment } from "@editframe/assets";
10
10
 
11
- import { MP4File } from "@/av/MP4File";
12
- import { EFTemporal } from "./EFTemporal";
13
- import { VideoAsset } from "@/av/EncodedAsset";
14
- import { FetchMixin } from "./FetchMixin";
15
- import { apiHostContext } from "../gui/EFWorkbench";
16
- import { EFSourceMixin } from "./EFSourceMixin";
17
- import { getStartTimeMs } from "./util";
18
- import { EF_INTERACTIVE } from "../EF_INTERACTIVE";
11
+ import { MP4File } from "@editframe/assets/MP4File.js";
12
+ import { VideoAsset } from "@editframe/assets/EncodedAsset.js";
13
+ import { EFTemporal } from "./EFTemporal.ts";
14
+ import { FetchMixin } from "./FetchMixin.ts";
15
+ import { apiHostContext } from "../gui/EFWorkbench.ts";
16
+ import { EFSourceMixin } from "./EFSourceMixin.ts";
17
+ import { getStartTimeMs } from "./util.ts";
18
+ import { EF_INTERACTIVE } from "../EF_INTERACTIVE.ts";
19
19
 
20
20
  const log = debug("ef:elements:EFMedia");
21
21
 
@@ -1,6 +1,6 @@
1
1
  import { consume } from "@lit/context";
2
2
  import type { LitElement } from "lit";
3
- import { apiHostContext } from "../gui/EFWorkbench";
3
+ import { apiHostContext } from "../gui/EFWorkbench.ts";
4
4
  import { state } from "lit/decorators/state.js";
5
5
  import { Task } from "@lit/task";
6
6
  import { property } from "lit/decorators/property.js";