web: Add changes to make shadow template one tsx element

This commit is contained in:
Daniel Jacobs 2024-07-17 16:17:32 -04:00 committed by Nathan Adams
parent f56c43882f
commit 1275656b9e
3 changed files with 596 additions and 709 deletions

View File

@ -3,7 +3,7 @@ interface Error {
} }
interface SVGSVGElement { interface SVGSVGElement {
xmlns?: string; xmlns?: string;
"xmlns:xlink"?: string; scale?: string | number;
} }
interface SVGPathElement { interface SVGPathElement {
fill?: string; fill?: string;
@ -17,10 +17,7 @@ interface SVGTextElement {
interface SVGCircleElement { interface SVGCircleElement {
fill?: string; fill?: string;
} }
interface SVGUseElement {
"xlink:href"?: string;
}
interface HTMLInputElement { interface HTMLInputElement {
autoCapitalize?: string; autocapitalize?: string;
autoComplete?: string; autocorrect?: string;
} }

View File

@ -1,6 +1,6 @@
import type { RuffleHandle, ZipWriter } from "../dist/ruffle_web"; import type { RuffleHandle, ZipWriter } from "../dist/ruffle_web";
import { createRuffleBuilder } from "./load-ruffle"; import { createRuffleBuilder } from "./load-ruffle";
import { applyStaticStyles, ruffleShadowTemplate } from "./shadow-template"; import { ruffleShadowTemplate } from "./shadow-template";
import { lookupElement } from "./internal/register-element"; import { lookupElement } from "./internal/register-element";
import { DEFAULT_CONFIG } from "./config"; import { DEFAULT_CONFIG } from "./config";
import type { DataLoadOptions, URLLoadOptions } from "./load-options"; import type { DataLoadOptions, URLLoadOptions } from "./load-options";
@ -119,7 +119,6 @@ class Point {
export class RufflePlayer extends HTMLElement { export class RufflePlayer extends HTMLElement {
private readonly shadow: ShadowRoot; private readonly shadow: ShadowRoot;
private readonly dynamicStyles: HTMLStyleElement; private readonly dynamicStyles: HTMLStyleElement;
private readonly staticStyles: HTMLStyleElement;
private readonly container: HTMLElement; private readonly container: HTMLElement;
private readonly playButton: HTMLElement; private readonly playButton: HTMLElement;
private readonly unmuteOverlay: HTMLElement; private readonly unmuteOverlay: HTMLElement;
@ -231,9 +230,6 @@ export class RufflePlayer extends HTMLElement {
this.dynamicStyles = this.shadow.getElementById( this.dynamicStyles = this.shadow.getElementById(
"dynamic-styles", "dynamic-styles",
) as HTMLStyleElement; ) as HTMLStyleElement;
this.staticStyles = this.shadow.getElementById(
"static-styles",
) as HTMLStyleElement;
this.container = this.shadow.getElementById("container")!; this.container = this.shadow.getElementById("container")!;
this.playButton = this.shadow.getElementById("play-button")!; this.playButton = this.shadow.getElementById("play-button")!;
this.playButton.addEventListener("click", () => this.play()); this.playButton.addEventListener("click", () => this.play());
@ -529,7 +525,6 @@ export class RufflePlayer extends HTMLElement {
*/ */
connectedCallback(): void { connectedCallback(): void {
this.updateStyles(); this.updateStyles();
applyStaticStyles(this.staticStyles);
} }
/** /**

File diff suppressed because it is too large Load Diff