UNPKG

@manuth/woltlab-compiler

Version:

A compiler for generating WoltLab-Package `.tar` Archives and other WoltLab-Package Components

197 lines 5.58 kB
import { Component } from "../../../PackageSystem/Component.js"; import { FileDescriptor } from "../../../PackageSystem/FileDescriptor.js"; import { ImageDirectoryDescriptor } from "./ImageDirectoryDescriptor.js"; /** * Represents a theme. */ export class Theme extends Component { /** * Initializes a new instance of the {@link Theme `Theme`} class. * * @param instruction * The instruction of the theme. * * @param options * The options of the theme. */ constructor(instruction, options) { super({ DisplayName: options.DisplayName, Version: options.Version, Author: options.Author, CreationDate: options.CreationDate, Description: options.Description, License: options.License }); /** * The thumbnail of the theme. */ this.thumbnail = null; /** * The high resolution version of the thumbnail. */ this.highResThumbnail = null; /** * The path to the default cover-photo for user-profiles. */ this.coverPhoto = null; /** * The custom `scss`-code of the theme. */ this.customSCSS = null; /** * The variable-overrides of special `scss`-variables. */ this.scssOverride = null; /** * The variables of the theme. */ this.variables = new Map(); /** * The image-directory provided by the theme. */ this.images = null; this.instruction = instruction; this.Name = options.Name; if ((options.Thumbnail !== null) && (options.Thumbnail !== undefined)) { this.Thumbnail = new FileDescriptor(typeof options.Thumbnail === "string" ? { Source: options.Thumbnail } : options.Thumbnail); } if ((options.HighResThumbnail !== null) && (options.HighResThumbnail !== undefined)) { this.HighResThumbnail = new FileDescriptor(typeof options.HighResThumbnail === "string" ? { Source: options.HighResThumbnail } : options.HighResThumbnail); } if ((options.CoverPhoto !== null) && (options.CoverPhoto !== undefined)) { this.CoverPhoto = new FileDescriptor(typeof options.CoverPhoto === "string" ? { Source: options.CoverPhoto } : options.CoverPhoto); } if ((options.CustomScss !== null) && (options.CustomScss !== undefined)) { this.CustomScss = options.CustomScss; } if ((options.ScssOverride !== null) && (options.ScssOverride !== undefined)) { this.ScssOverride = options.ScssOverride; } if ((options.Variables !== null) && (options.Variables !== undefined)) { for (let entry of Object.entries(options.Variables)) { this.Variables.set(entry[0], entry[1]); } } if ((options.Images !== null) && (options.Images !== undefined)) { this.images = new ImageDirectoryDescriptor(options.Images); } } /** * Gets or sets the name of the theme. */ get Name() { return this.name; } /** * @inheritdoc */ set Name(value) { this.name = value; } /** * @inheritdoc */ get Version() { return super.Version; } /** * @inheritdoc */ set Version(value) { super.Version = value; } /** * @inheritdoc */ get Author() { var _a, _b, _c, _d, _e; return (_e = (_a = super.Author) !== null && _a !== void 0 ? _a : (_d = (_c = (_b = this.Instruction) === null || _b === void 0 ? void 0 : _b.Collection) === null || _c === void 0 ? void 0 : _c.Package) === null || _d === void 0 ? void 0 : _d.Author) !== null && _e !== void 0 ? _e : null; } /** * Gets or sets the thumbnail of the theme. */ get Thumbnail() { return this.thumbnail; } /** * @inheritdoc */ set Thumbnail(value) { this.thumbnail = value; } /** * Gets or sets the high resolution version of the thumbnail. */ get HighResThumbnail() { return this.highResThumbnail; } /** * @inheritdoc */ set HighResThumbnail(value) { this.highResThumbnail = value; } /** * Gets the instruction which contains this theme. */ get Instruction() { return this.instruction; } /** * Gets or sets the path to the default cover-photo for user-profiles. */ get CoverPhoto() { return this.coverPhoto; } /** * @inheritdoc */ set CoverPhoto(value) { this.coverPhoto = value; } /** * Gets or sets the `scss`-code of the theme. */ get CustomScss() { return this.customSCSS; } /** * @inheritdoc */ set CustomScss(value) { this.customSCSS = value; } /** * Gets or sets the variable-overrides of special `scss`-variables. */ get ScssOverride() { return this.scssOverride; } /** * @inheritdoc */ set ScssOverride(value) { this.scssOverride = value; } /** * Gets the variables of the theme. */ get Variables() { return this.variables; } /** * Gets the image-directory of the theme. */ get Images() { return this.images; } } //# sourceMappingURL=Theme.js.map