| 49 | classes: string[]; |
| 50 | |
| 51 | constructor([show, type, background, ...classes]: string[]) { |
| 52 | super(); |
| 53 | this.background = background; |
| 54 | this.property = 'background-image'; |
| 55 | if (typeof this.engine.asset('scenes', background) !== 'undefined') { |
| 56 | this.value = `url(${this.engine.setting('AssetsPath').root}/${this.engine.setting('AssetsPath').scenes}/${this.engine.asset('scenes', background)})`; |
| 57 | } else { |
| 58 | const rest = [background, ...classes].join(' '); |
| 59 | if (classes.indexOf('with') > -1) { |
| 60 | this.value = Text.prefix('with', rest); |
| 61 | } else { |
| 62 | this.value = rest; |
| 63 | } |
| 64 | |
| 65 | const isColorProperty = ['#', 'rgb', 'hsl'].findIndex((color) => { |
| 66 | return this.value.indexOf(color) === 0; |
| 67 | }) > -1; |
| 68 | |
| 69 | const isNamed = this.value.indexOf(' ') > -1 ? false : new RegExp(/\w+/).test(this.value) && !(new RegExp(/(url|gradient)\(/).test(this.value)); |
| 70 | |
| 71 | if (isColorProperty === true || isNamed === true) { |
| 72 | this.property = 'background-color'; |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | this.classes = ['animated', ...classes]; |
| 77 | } |
| 78 | |
| 79 | override async willApply(): Promise<void> { |
| 80 | const background = this.engine.element().find('[data-ui="background"]'); |