UNPKG

intentful

Version:

Create Custom Skills with less headache

44 lines (43 loc) 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Dimension = void 0; class Dimension { constructor(value) { this.value = value; } model() { return this.value; } static expression(value) { return new Dimension(value); } static literal(value) { return new Dimension(value); } static number(value) { return new Dimension(`${value}`); } static dp(value) { return new Dimension(`${value}dp`); } static px(value) { return new Dimension(`${value}px`); } static vh(value) { const adjustedValue = Math.max(0, Math.min(100, value)); return new Dimension(`${adjustedValue}vh`); } static vw(value) { return new Dimension(`${value}vw`); } static percent(value) { return new Dimension(`${value}%`); } static auto() { return new Dimension('auto'); } toJSON() { return this.value; } } exports.Dimension = Dimension;