UNPKG

tailwindcss-3d

Version:

Add 3D transforms to your TailwindCSS project

75 lines (74 loc) 3.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "TransformCore", { enumerable: true, get: function() { return TransformCore; } }); var _assert_this_initialized = require("@swc/helpers/_/_assert_this_initialized"); var _class_call_check = require("@swc/helpers/_/_class_call_check"); var _define_property = require("@swc/helpers/_/_define_property"); var _inherits = require("@swc/helpers/_/_inherits"); var _object_spread = require("@swc/helpers/_/_object_spread"); var _create_super = require("@swc/helpers/_/_create_super"); var _base = require("./base"); var _scale = require("./scale"); var _transform = require("./transform"); var _translate = require("./translate"); var TransformCore = /*#__PURE__*/ function(Base) { "use strict"; _inherits._(TransformCore, Base); var _super = _create_super._(TransformCore); function TransformCore() { _class_call_check._(this, TransformCore); var _this; _this = _super.apply(this, arguments); _define_property._(_assert_this_initialized._(_this), "utilities", function() { var transformValue2d = _this.legacy ? _transform.Transform.normaliseLegacyFunctionValues({ dimension: '2d' }) : _transform.Transform.normaliseFunctionValues({ dimension: '2d' }); var transformValue3d = _this.legacy ? _transform.Transform.normaliseLegacyFunctionValues() : _transform.Transform.normaliseFunctionValues(); var transformDeclarations2d = { '--webkit-transform': transformValue2d, transform: transformValue2d }; var transformDeclarations3d = { '--webkit-transform': transformValue3d, transform: transformValue3d }; _this.api.addUtilities({ // Leaving `.transform` utility here for backward compatibility, // not really sure what purpose it serves though '.transform': transformDeclarations2d, '.transform-cpu': _this.legacy ? transformDeclarations2d : _object_spread._({ translate: _translate.Translate.normaliseFunctionValues({ dimension: '2d' }), scale: _scale.Scale.normaliseFunctionValues({ dimension: '2d' }) }, transformDeclarations2d), '.transform-gpu': _this.legacy ? transformDeclarations3d : _object_spread._({ translate: _translate.Translate.normaliseFunctionValues(), scale: _scale.Scale.normaliseFunctionValues() }, transformDeclarations3d), '.transform-none': _this.legacy ? { '--webkit-transform': 'none', transform: 'none' } : { translate: 'none', scale: 'none', '--webkit-transform': 'none', transform: 'none' } }); }); return _this; } return TransformCore; }(_base.Base);