color-theme-generator
Version:
Generates random color themes that are based in color theory.
51 lines (50 loc) • 2.59 kB
JavaScript
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _Style_instances, _Style_property, _Style_value, _Style_setProperty, _Style_setValue;
export class Style {
constructor(property, value) {
_Style_instances.add(this);
/**
* The CSS property that the object represents.
*/
_Style_property.set(this, void 0);
/**
* The value of the objects property.
*/
_Style_value.set(this, void 0);
__classPrivateFieldGet(this, _Style_instances, "m", _Style_setProperty).call(this, property);
__classPrivateFieldGet(this, _Style_instances, "m", _Style_setValue).call(this, value);
}
/**
* The string that represents a CSS property.
*/
get property() {
return __classPrivateFieldGet(this, _Style_property, "f");
}
/**
* The string that represents the value of the CSS property.
*/
get value() {
return __classPrivateFieldGet(this, _Style_value, "f");
}
/**
* The string that represents the complete CSS declaration with property and value.
*/
get declaration() {
return `${__classPrivateFieldGet(this, _Style_property, "f")}: ${this.value};`;
}
}
_Style_property = new WeakMap(), _Style_value = new WeakMap(), _Style_instances = new WeakSet(), _Style_setProperty = function _Style_setProperty(property) {
__classPrivateFieldSet(this, _Style_property, property, "f");
}, _Style_setValue = function _Style_setValue(value) {
__classPrivateFieldSet(this, _Style_value, value, "f");
};