UNPKG

@aplus-frontend/ui

Version:

30 lines (29 loc) 1.15 kB
class s { constructor(t) { this.result = "", this.result = t; } add(t) { return t instanceof s ? this.result = `${this.result} + ${t.getResult()}` : this.result = `${this.result} + ${t}`, this.lowPriority = !0, this; } sub(t) { return t instanceof s ? this.result = `${this.result} - ${t.getResult()}` : this.result = `${this.result} - ${t}`, this.lowPriority = !0, this; } mul(t) { return this.lowPriority && (this.result = `(${this.result})`), t instanceof s ? this.result = `${this.result} * ${t.getResult()}` : this.result = `${this.result} * ${t}`, this.lowPriority = !1, this; } div(t) { return this.lowPriority && (this.result = `(${this.result})`), t instanceof s ? this.result = `${this.result} / ${t.getResult()}` : this.result = `${this.result} / ${t}`, this.lowPriority = !1, this; } colorMix(t, i = "transparent") { return `color-mix(in srgb, ${this.result} ${t}%, ${i})`; } getResult() { return this.lowPriority ? `(${this.result})` : this.result; } equal() { return typeof this.lowPriority < "u" ? `calc(${this.result})` : this.result; } } export { s as TokenUtil };