@editframe/elements 0.15.0-beta.11 → 0.15.0-beta.13

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.
@@ -19,7 +19,7 @@ export declare class EFMedia extends EFMedia_base {
19
19
  get assetId(): string | null;
20
20
  fragmentIndexPath(): string;
21
21
  fragmentTrackPath(trackId: string): string;
22
- trackFragmentIndexLoader: Task<readonly [string, typeof fetch], Record<number, TrackFragmentIndex>>;
22
+ trackFragmentIndexLoader: Task<readonly [string, typeof fetch], Record<number, TrackFragmentIndex> | undefined>;
23
23
  initSegmentsLoader: Task<readonly [Record<number, TrackFragmentIndex> | undefined, string, typeof fetch], {
24
24
  trackId: string;
25
25
  buffer: MP4Box.MP4ArrayBuffer;
@@ -70,8 +70,13 @@ const _EFMedia = class _EFMedia2 extends EFTargetable(
70
70
  this.trackFragmentIndexLoader = new Task(this, {
71
71
  args: () => [this.fragmentIndexPath(), this.fetch],
72
72
  task: async ([fragmentIndexPath, fetch], { signal }) => {
73
- const response = await fetch(fragmentIndexPath, { signal });
74
- return await response.json();
73
+ try {
74
+ const response = await fetch(fragmentIndexPath, { signal });
75
+ return await response.json();
76
+ } catch (error) {
77
+ log("Failed to load track fragment index", error);
78
+ return void 0;
79
+ }
75
80
  },
76
81
  onComplete: () => {
77
82
  this.requestUpdate("ownCurrentTimeMs");
@@ -27,7 +27,7 @@ export declare class EFTimegroup extends EFTimegroup_base {
27
27
  * that caused issues with constructing audio data. We had negative durations
28
28
  * in calculations and it was not clear why.
29
29
  */
30
- waitForMediaDurations(): Promise<Record<number, import('../../../assets/src/index.ts').TrackFragmentIndex>[]>;
30
+ waitForMediaDurations(): Promise<(Record<number, import('../../../assets/src/index.ts').TrackFragmentIndex> | undefined)[]>;
31
31
  get childTemporals(): import('./EFTemporal.js').TemporalMixinInterface[];
32
32
  protected updated(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
33
33
  private updateAnimations;
@@ -18,13 +18,25 @@ function TWMixin(Base) {
18
18
  "twSheet not found. Probable cause: CSSStyleSheet not supported in this environment"
19
19
  );
20
20
  }
21
+ const constructorStylesheets = [];
22
+ const constructorStyles = "styles" in this.constructor && this.constructor.styles || [];
23
+ if (Array.isArray(constructorStyles)) {
24
+ for (const item of constructorStyles) {
25
+ if (item.styleSheet) {
26
+ constructorStylesheets.push(item.styleSheet);
27
+ }
28
+ }
29
+ } else if (constructorStyles.styleSheet) {
30
+ constructorStylesheets.push(constructorStyles.styleSheet);
31
+ }
21
32
  if (renderRoot?.adoptedStyleSheets) {
22
33
  renderRoot.adoptedStyleSheets = [
23
34
  twSheet,
24
- ...renderRoot.adoptedStyleSheets
35
+ ...renderRoot.adoptedStyleSheets,
36
+ ...constructorStylesheets
25
37
  ];
26
38
  } else {
27
- renderRoot.adoptedStyleSheets = [twSheet];
39
+ renderRoot.adoptedStyleSheets = [twSheet, ...constructorStylesheets];
28
40
  }
29
41
  return renderRoot;
30
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editframe/elements",
3
- "version": "0.15.0-beta.11",
3
+ "version": "0.15.0-beta.13",
4
4
  "description": "",
5
5
  "exports": {
6
6
  ".": {
@@ -27,7 +27,7 @@
27
27
  "license": "UNLICENSED",
28
28
  "dependencies": {
29
29
  "@bramus/style-observer": "^1.3.0",
30
- "@editframe/assets": "0.15.0-beta.11",
30
+ "@editframe/assets": "0.15.0-beta.13",
31
31
  "@lit/context": "^1.1.2",
32
32
  "@lit/task": "^1.0.1",
33
33
  "d3": "^7.9.0",
@@ -126,8 +126,14 @@ export class EFMedia extends EFTargetable(
126
126
  public trackFragmentIndexLoader = new Task(this, {
127
127
  args: () => [this.fragmentIndexPath(), this.fetch] as const,
128
128
  task: async ([fragmentIndexPath, fetch], { signal }) => {
129
- const response = await fetch(fragmentIndexPath, { signal });
130
- return (await response.json()) as Record<number, TrackFragmentIndex>;
129
+ try {
130
+ const response = await fetch(fragmentIndexPath, { signal });
131
+
132
+ return (await response.json()) as Record<number, TrackFragmentIndex>;
133
+ } catch (error) {
134
+ log("Failed to load track fragment index", error);
135
+ return undefined;
136
+ }
131
137
  },
132
138
  onComplete: () => {
133
139
  this.requestUpdate("ownCurrentTimeMs");
@@ -1,4 +1,4 @@
1
- import type { LitElement } from "lit";
1
+ import type { CSSResult, LitElement } from "lit";
2
2
  // @ts-expect-error cannot figure out how to declare this module as a string
3
3
  import twStyle from "./TWMixin.css?inline";
4
4
 
@@ -21,13 +21,30 @@ export function TWMixin<T extends new (...args: any[]) => LitElement>(Base: T) {
21
21
  "twSheet not found. Probable cause: CSSStyleSheet not supported in this environment",
22
22
  );
23
23
  }
24
+
25
+ const constructorStylesheets: CSSStyleSheet[] = [];
26
+ const constructorStyles = (("styles" in this.constructor &&
27
+ this.constructor.styles) ||
28
+ []) as CSSResult | CSSResult[];
29
+
30
+ if (Array.isArray(constructorStyles)) {
31
+ for (const item of constructorStyles) {
32
+ if (item.styleSheet) {
33
+ constructorStylesheets.push(item.styleSheet);
34
+ }
35
+ }
36
+ } else if (constructorStyles.styleSheet) {
37
+ constructorStylesheets.push(constructorStyles.styleSheet);
38
+ }
39
+
24
40
  if (renderRoot?.adoptedStyleSheets) {
25
41
  renderRoot.adoptedStyleSheets = [
26
42
  twSheet,
27
43
  ...renderRoot.adoptedStyleSheets,
44
+ ...constructorStylesheets,
28
45
  ];
29
46
  } else {
30
- renderRoot.adoptedStyleSheets = [twSheet];
47
+ renderRoot.adoptedStyleSheets = [twSheet, ...constructorStylesheets];
31
48
  }
32
49
  return renderRoot;
33
50
  }