metamorphosis
Version:
A css variable management library that helps create and organize variables into easily configurable themes.
26 lines (25 loc) • 462 B
JavaScript
import { Base } from "./Base.js";
class ControlVar extends Base {
unit;
value;
css = "";
constructor(unit, value) {
super();
this.unit = unit;
this.set(value);
}
set(value) {
this.value = ["number", "string", "boolean"].includes(typeof value) ? { _: value } : value;
this.notify();
}
notify() {
this.recompute();
this._notify();
}
recompute() {
this.css = this.unit(this.value);
}
}
export {
ControlVar
};