%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /www/specpages-backup/node_modules/less/lib/less/tree/
Upload File :
Create Path :
Current File : //www/specpages-backup/node_modules/less/lib/less/tree/dimension.js.map

{"version":3,"file":"dimension.js","sourceRoot":"","sources":["../../../src/less/tree/dimension.js"],"names":[],"mappings":";;;;;AAAA,gDAA0B;AAC1B,8EAAuD;AACvD,gDAA0B;AAC1B,kDAA4B;AAE5B,EAAE;AACF,uBAAuB;AACvB,EAAE;AACF,IAAM,SAAS,GAAG,UAAS,KAAK,EAAE,IAAI;IAClC,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;KACjD;IACD,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,IAAI,IAAI,YAAY,cAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,cAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACxC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF,SAAS,CAAC,SAAS,GAAG,IAAI,cAAI,EAAE,CAAC;AAEjC,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,UAAS,OAAO;IACzC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF,SAAS,CAAC,SAAS,CAAC,IAAI,GAAG,UAAS,OAAO;IACvC,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AAEF,SAAS,CAAC,SAAS,CAAC,OAAO,GAAG;IAC1B,OAAO,IAAI,eAAK,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,IA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KAAK,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;aAC3D;iBAAM;gBACH,KAAK,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;aAC3D;YAED,OAAO,UAAU,CAAC;SACrB;QAED,OAAO,UAAU,CAAC;IACtB,CAAC,CAAC;IAEF,KAAK,SAAS,IAAI,WAAW,EAAE;QAC3B,IAAI,WAAW,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE;YACvC,UAAU,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;YACpC,KAAK,GAAG,0BAAe,CAAC,SAAS,CAAC,CAAC;YAEnC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;SACvB;KACJ;IAED,IAAI,CAAC,MAAM,EAAE,CAAC;IAEd,OAAO,IAAI,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACtC,CAAC,CAAC;AAEF,SAAS,CAAC,SAAS,CAAC,IAAI,GAAG,WAAW,CAAC;AACvC,kBAAe,SAAS,CAAC","sourcesContent":["import Node from './node';\nimport unitConversions from '../data/unit-conversions';\nimport Unit from './unit';\nimport Color from './color';\n\n//\n// A number with a unit\n//\nconst Dimension = function(value, unit) {\n    this.value = parseFloat(value);\n    if (isNaN(this.value)) {\n        throw new Error('Dimension is not a number.');\n    }\n    this.unit = (unit && unit instanceof Unit) ? unit :\n        new Unit(unit ? [unit] : undefined);\n    this.setParent(this.unit, this);\n};\n\nDimension.prototype = new Node();\n\nDimension.prototype.accept = function(visitor) {\n    this.unit = visitor.visit(this.unit);\n};\n\nDimension.prototype.eval = function(context) {\n    return this;\n};\n\nDimension.prototype.toColor = function() {\n    return new Color([this.value, this.value, this.value]);\n};\n\nDimension.prototype.genCSS = function(context, output) {\n    if ((context && context.strictUnits) && !this.unit.isSingular()) {\n        throw new Error(`Multiple units in dimension. Correct the units or use the unit function. Bad unit: ${this.unit.toString()}`);\n    }\n\n    const value = this.fround(context, this.value);\n    let strValue = String(value);\n\n    if (value !== 0 && value < 0.000001 && value > -0.000001) {\n        // would be output 1e-6 etc.\n        strValue = value.toFixed(20).replace(/0+$/, '');\n    }\n\n    if (context && context.compress) {\n        // Zero values doesn't need a unit\n        if (value === 0 && this.unit.isLength()) {\n            output.add(strValue);\n            return;\n        }\n\n        // Float values doesn't need a leading zero\n        if (value > 0 && value < 1) {\n            strValue = (strValue).substr(1);\n        }\n    }\n\n    output.add(strValue);\n    this.unit.genCSS(context, output);\n};\n\n// In an operation between two Dimensions,\n// we default to the first Dimension's unit,\n// so `1px + 2` will yield `3px`.\nDimension.prototype.operate = function(context, op, other) {\n    /* jshint noempty:false */\n    let value = this._operate(context, op, this.value, other.value);\n\n    let unit = this.unit.clone();\n\n    if (op === '+' || op === '-') {\n        if (unit.numerator.length === 0 && unit.denominator.length === 0) {\n            unit = other.unit.clone();\n            if (this.unit.backupUnit) {\n                unit.backupUnit = this.unit.backupUnit;\n            }\n        } else if (other.unit.numerator.length === 0 && unit.denominator.length === 0) {\n            // do nothing\n        } else {\n            other = other.convertTo(this.unit.usedUnits());\n\n            if (context.strictUnits && other.unit.toString() !== unit.toString()) {\n                throw new Error(`Incompatible units. Change the units or use the unit function. ` + \n                    `Bad units: '${unit.toString()}' and '${other.unit.toString()}'.`);\n            }\n\n            value = this._operate(context, op, this.value, other.value);\n        }\n    } else if (op === '*') {\n        unit.numerator = unit.numerator.concat(other.unit.numerator).sort();\n        unit.denominator = unit.denominator.concat(other.unit.denominator).sort();\n        unit.cancel();\n    } else if (op === '/') {\n        unit.numerator = unit.numerator.concat(other.unit.denominator).sort();\n        unit.denominator = unit.denominator.concat(other.unit.numerator).sort();\n        unit.cancel();\n    }\n    return new Dimension(value, unit);\n};\n\nDimension.prototype.compare = function(other) {\n    let a;\n    let b;\n\n    if (!(other instanceof Dimension)) {\n        return undefined;\n    }\n\n    if (this.unit.isEmpty() || other.unit.isEmpty()) {\n        a = this;\n        b = other;\n    } else {\n        a = this.unify();\n        b = other.unify();\n        if (a.unit.compare(b.unit) !== 0) {\n            return undefined;\n        }\n    }\n\n    return Node.numericCompare(a.value, b.value);\n};\n\nDimension.prototype.unify = function() {\n    return this.convertTo({ length: 'px', duration: 's', angle: 'rad' });\n};\n\nDimension.prototype.convertTo = function(conversions) {\n    let value = this.value;\n    const unit = this.unit.clone();\n    let i;\n    let groupName;\n    let group;\n    let targetUnit;\n    let derivedConversions = {};\n    let applyUnit;\n\n    if (typeof conversions === 'string') {\n        for (i in unitConversions) {\n            if (unitConversions[i].hasOwnProperty(conversions)) {\n                derivedConversions = {};\n                derivedConversions[i] = conversions;\n            }\n        }\n        conversions = derivedConversions;\n    }\n    applyUnit = (atomicUnit, denominator) => {\n        /* jshint loopfunc:true */\n        if (group.hasOwnProperty(atomicUnit)) {\n            if (denominator) {\n                value = value / (group[atomicUnit] / group[targetUnit]);\n            } else {\n                value = value * (group[atomicUnit] / group[targetUnit]);\n            }\n\n            return targetUnit;\n        }\n\n        return atomicUnit;\n    };\n\n    for (groupName in conversions) {\n        if (conversions.hasOwnProperty(groupName)) {\n            targetUnit = conversions[groupName];\n            group = unitConversions[groupName];\n\n            unit.map(applyUnit);\n        }\n    }\n\n    unit.cancel();\n\n    return new Dimension(value, unit);\n};\n\nDimension.prototype.type = 'Dimension';\nexport default Dimension;\n"]}

Zerion Mini Shell 1.0