diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 29fa879..0000000 --- a/.babelrc +++ /dev/null @@ -1,16 +0,0 @@ -{ - "presets": ["env", "stage-0", "react"], - - "plugins": [ - "syntax-dynamic-import", - "react-hot-loader/babel", - "transform-decorators-legacy", - ["import", { "libraryName": "antd"}], - ["import", { - "libraryName": "ant-design-pro", - "libraryDirectory": "lib", - "style": true, - "camel2DashComponentName": false - }] - ] -} diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index bed0635..0000000 --- a/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -dist -config \ No newline at end of file diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 9d4e6b7..0000000 --- a/.eslintrc +++ /dev/null @@ -1,31 +0,0 @@ -{ - "extends": "eslint-config-ali/react", - "parser": "babel-eslint", - "env": { - "es6": true, - "browser": true, - "node": true - }, - "parserOptions": { - "ecmaVersion": 7, - "sourceType": "module", - "ecmaFeatures": { - "jsx": true - } - }, - "rules": { - "comma-dangle": "off", - "object-curly-spacing": ["error", "always"], - "no-void": "warn", - "new-cap": ["warn", { "newIsCap": true, "properties": false }], - "no-plusplus": "warn", - "no-mixed-operators": ["error",{"allowSamePrecedence": true}], - "no-fallthrough": ["error", { "commentPattern": "break[\\s\\w]*omitted" }], - "no-nested-ternary": "warn", - "no-console": "off", - "no-param-reassign": "off", - "eqeqeq": "error", - "react/prop-types": "off", - "no-script-url": 0 - } -} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5bab137..0c8dff1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,9 @@ /dist .DS_Store yarn-error.log -yarn.lock +.history +local +public/antd.less +scripts/deploy.sh +scripts/vars.json +src/.umi \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..0d4222f --- /dev/null +++ b/.prettierignore @@ -0,0 +1,8 @@ +**/*.md +**/*.svg +**/*.ejs +**/*.html +package.json +.umi +.umi-production +.umi-test diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..e31da96 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,12 @@ +{ + "singleQuote": true, + "trailingComma": "all", + "printWidth": 80, + "semi": false, + "overrides": [ + { + "files": ".prettierrc", + "options": { "parser": "json" } + } + ] +} diff --git a/.umirc.js b/.umirc.js new file mode 100644 index 0000000..308128a --- /dev/null +++ b/.umirc.js @@ -0,0 +1,8 @@ +export default { + copy: ['node_modules/less/dist/less.min.js'], + proxy: { + '/api': { + target: 'http://localhost:9000', + }, + }, +} diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 7c6862a..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - // 使用 IntelliSense 了解相关属性。 - // 悬停以查看现有属性的描述。 - // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - - { - "type": "node", - "request": "launch", - "name": "Launch buildVars", - "program": "${workspaceFolder}/build/buildVars.js" - } - ] -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..a3e7fc5 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "*.js": "javascriptreact" + } +} \ No newline at end of file diff --git a/README.md b/README.md index a053b43..40f3a73 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,10 @@ +### Antd Custom Theme +![screenshot](readme/screenshot.jpg) -
- Set the theme online, generate less and js files directly antdtheme.com -
- -![](https://github.com/gzgogo/antd-theme/raw/master/screenshot.png) - - -## How to add your theme to preview? -1. Visit [antdtheme.com](https://antdtheme.com),Click "Save" after editing is complete -2. Publish your theme to npm (Optional) -3. Import and add your theme in the file: theme/index.js. The key is the name of your theme in the list. -4. Thanks for your participation and contribution! - -![](https://github.com/gzgogo/antd-theme/raw/master/guide.png) +``` +$ yarn +$ yarn start +``` diff --git a/build/buildLess.js b/build/buildLess.js deleted file mode 100644 index c018dc5..0000000 --- a/build/buildLess.js +++ /dev/null @@ -1,11 +0,0 @@ -const bundle = require('less-bundle-promise'); - -bundle({ - src: './src/stylesheet/app.less', - dest: './src/stylesheet/antd.less', - writeFile: true -}).then((/* output */) => { - // console.log(output); -}).catch((error) => { - console.log('Error', error); -}); diff --git a/build/buildVars.js b/build/buildVars.js deleted file mode 100644 index 81d5ae5..0000000 --- a/build/buildVars.js +++ /dev/null @@ -1,37 +0,0 @@ -const fs = require('fs'); -const readline = require('readline'); -const vars = require('../src/vars'); - -const varsObj = {}; - -const rl = readline.createInterface({ - input: fs.createReadStream('./node_modules/antd/lib/style/themes/default.less'), - crlfDelay: Infinity -}); - -rl.on('line', (line) => { - // console.log(line); - if (line.startsWith('@')) { - const [name, value] = line.split(':'); - if (name && value) { - const temp = value.split('//')[0]; // 去掉行尾注释 - varsObj[name] = temp.replace(';', '').trimLeft(); - } - } -}); - -rl.on('close', () => { - // console.log(varsObj); - - vars.forEach((group) => { - group.children.forEach((item) => { - const value = varsObj[item.name]; - if (value) { - item.value = item.type === 'number' ? parseFloat(value) : value; - } - }); - - fs.writeFileSync('./src/vars.json', JSON.stringify(vars, null, 2), 'utf8'); - }); -}); - diff --git a/build/combineLess.js b/build/combineLess.js deleted file mode 100644 index 94ee7f8..0000000 --- a/build/combineLess.js +++ /dev/null @@ -1,50 +0,0 @@ -const fs = require('fs'); -const path = require('path'); - -const entryFile = process.argv[2]; -const outputFile = process.argv[3] || './antd-combine.less'; - -if (entryFile) { - const result = combine(entryFile); - fs.writeFileSync(outputFile, result, 'utf-8'); - console.log('finish!'); -} - -function combine(fileName, loadedList) { - if (!Array.isArray(loadedList)) { - loadedList = []; - } - console.log('fileName: %s', fileName); - - let result = fs.readFileSync(fileName, 'utf-8'); - - loadedList.push(fileName); - - // console.log('result: %s', result); - - while (1) { - const res = result.match(/@import ?["'](.*?)["'];/); - if (res && res[1]) { - // console.log('res[1]: %s', res[1]); - - let subPath = path.resolve(path.dirname(fileName), res[1]); - - if (!subPath.endsWith('.less')) { - subPath += '.less'; - } - - // console.log('subPath: %s', subPath); - - if (loadedList.indexOf(subPath) < 0) { - const lessCode = combine(subPath, loadedList); - const reg = new RegExp(`@import ["']${res[1]}["'];`); - result = result.replace(reg, lessCode); - } else { - const reg = new RegExp(`@import ["']${res[1]}["'];`); - result = result.replace(reg, ''); - } - } else { - return result; - } - } -} diff --git a/combineTest/a.less b/combineTest/a.less deleted file mode 100644 index 6766155..0000000 --- a/combineTest/a.less +++ /dev/null @@ -1 +0,0 @@ -@import './b.less'; \ No newline at end of file diff --git a/combineTest/b.less b/combineTest/b.less deleted file mode 100644 index 3bc5eef..0000000 --- a/combineTest/b.less +++ /dev/null @@ -1 +0,0 @@ -@import './c.less'; \ No newline at end of file diff --git a/combineTest/c.less b/combineTest/c.less deleted file mode 100644 index e9dd32c..0000000 --- a/combineTest/c.less +++ /dev/null @@ -1,3 +0,0 @@ -.c-hello { - margin: 20px; -} \ No newline at end of file diff --git a/combineTest/index.less b/combineTest/index.less deleted file mode 100644 index 44a71e3..0000000 --- a/combineTest/index.less +++ /dev/null @@ -1,5 +0,0 @@ -@import "./a.less"; - -.hello { - background-color: aliceblue; -} \ No newline at end of file diff --git a/config/PATHS.js b/config/PATHS.js deleted file mode 100644 index e980cce..0000000 --- a/config/PATHS.js +++ /dev/null @@ -1,8 +0,0 @@ -const path = require('path'); - -module.exports = { - root: path.resolve(__dirname, "../"), - src: path.resolve(__dirname, '../src'), - dist: path.resolve(__dirname, '../docs'), - doc: path.resolve(__dirname, '../docs') -}; \ No newline at end of file diff --git a/config/webpack.common.js b/config/webpack.common.js deleted file mode 100644 index c8e6ab7..0000000 --- a/config/webpack.common.js +++ /dev/null @@ -1,87 +0,0 @@ -const webpack = require('webpack'); -const path = require("path"); -const CopyWebpackPlugin = require("copy-webpack-plugin"); -const PATHS = require("./PATHS"); - -module.exports = { - module: { - rules: [ - { - test: /\.js$/, - exclude: /node_modules/, - use: { - loader: "babel-loader" - } - }, - // { - // test: /\.json$/, - // type: 'javascript/auto', - // use: [ - // { - // loader: 'json-loader' - // } - // ] - // }, - { - test: /\.(png|gif|jpg)$/, - use: [ - { - loader: 'url-loader', - options: { - limit: 10240, - name: path.normalize('asset/[name].[ext]') - } - } - ] - }, - { - test: /\.(woff|woff2|ttf|eot|svg)$/, - use: [ - { - loader: 'url-loader', - options: { - limit: 10240, - name: path.normalize('asset/[name].[ext]') - } - } - ] - } - ] - }, - resolve: { - extensions: ['.js', '.jsx'], - alias: { - src: PATHS.src, - stylesheet: path.resolve(PATHS.src, 'stylesheet'), - image: path.resolve(PATHS.src, 'asset/image'), - layout: path.resolve(PATHS.src, 'layout'), - component: path.resolve(PATHS.src, 'component'), - page: path.resolve(PATHS.src, 'page'), - util: path.resolve(PATHS.src, 'util'), - constant: path.resolve(PATHS.src, 'constant'), - store: path.resolve(PATHS.src, 'store'), - theme: path.resolve(PATHS.src, 'theme') - } - }, - plugins: [ - new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), - new CopyWebpackPlugin([ - { - from: path.resolve(PATHS.src, 'stylesheet/antd.less'), - to: path.resolve(PATHS.dist, 'antd.less') - }, - { - from: path.resolve(PATHS.src, 'pwa'), - to: PATHS.dist, - }, - { - from: path.resolve(PATHS.src, 'asset/js/less.min.js'), - to: PATHS.dist, - }, - { - from: path.resolve(PATHS.src, 'template/404.html'), - to: path.resolve(PATHS.dist, '404.html') - } - ]), - ] -}; diff --git a/config/webpack.dev.js b/config/webpack.dev.js deleted file mode 100644 index c35260b..0000000 --- a/config/webpack.dev.js +++ /dev/null @@ -1,118 +0,0 @@ -const path = require('path'); -const webpack = require('webpack'); -const merge = require('webpack-merge'); -const HtmlWebPackPlugin = require("html-webpack-plugin"); -const autoprefixer = require('autoprefixer'); -// const CopyWebpackPlugin = require("copy-webpack-plugin"); -const common = require('./webpack.common'); -const PATHS = require('./PATHS'); -// const OpenBrowserPlugin = require('open-browser-webpack-plugin'); - -module.exports = env => { - const API = (env || {}).API || 'mock'; - - console.log('API %s\n', API); - - const devServer = { - contentBase: path.resolve(PATHS.dist), - historyApiFallback: true, - // compress: true, - hot: true, - inline: true, - disableHostCheck: true, - // https: true - // progress: true - }; - - if (API === 'dev') { - devServer.proxy = { - '/api': 'http://pre.xxx.com' // 预发地址 - }; - } /* else { - devServer.proxy = { - '/api': { - target: 'http://rap2api.taobao.org', - pathRewrite: { - '^/api' : '/app/mock/84445/api' - } - // changeOrigin: true, - // onProxyRes: function(proxyReq, req, res) { - // console.log('--------------------------------'); - // console.log(proxyReq); - // console.log(req); - // // console.log(res); - // console.log('--------------------------------'); - // } - } - }; - } */ - - return merge(common, { - entry: { - main: ['@babel/polyfill', path.resolve(PATHS.src, 'index.js')] - }, - output: { - filename: '[name].js', - path: path.resolve(PATHS.dist), - publicPath: '/' - }, - mode: 'development', - devtool: 'inline-source-map', - devServer: devServer, - module: { - rules: [ - { - test: /\.css$/, - use: [ - { - loader: "style-loader" - }, - { - loader: "css-loader" - } - ] - }, - { - test: /\.less$/, - // exclude: path.resolve(PATHS.src, 'stylesheet'), - use: [ - { - loader: "style-loader" - }, - { - loader: "css-loader", - }, - { - loader: 'postcss-loader', - options: { - plugins: [autoprefixer('last 2 version')], - sourceMap: true - } - }, - { - loader: "less-loader", - options: { - javascriptEnabled: true - } - } - ] - }, - ] - }, - plugins: [ - new webpack.HotModuleReplacementPlugin(), - // new OpenBrowserPlugin({ - // url: 'http://localhost:8080', - // browser: "Google Chrome", - // }), - new webpack.DefinePlugin({ // 为项目注入环境变量 - 'process.env.API': JSON.stringify(API) - }), - new HtmlWebPackPlugin({ - template: path.resolve(PATHS.src, 'template/index.html'), - filename: path.resolve(PATHS.dist, 'index.html'), - favicon: path.resolve(PATHS.src, 'asset/image/favicon.png') - }) - ] - }); -}; diff --git a/config/webpack.doc.js b/config/webpack.doc.js deleted file mode 100644 index e0d0155..0000000 --- a/config/webpack.doc.js +++ /dev/null @@ -1,104 +0,0 @@ -const path = require("path"); -const merge = require('webpack-merge'); -const webpack = require('webpack'); -const CleanWebpackPlugin = require('clean-webpack-plugin'); -const HtmlWebPackPlugin = require("html-webpack-plugin"); -const ExtractTextPlugin = require('extract-text-webpack-plugin'); -const ScriptExtHtmlWebpackPlugin = require("script-ext-html-webpack-plugin"); -const autoprefixer = require('autoprefixer'); -const CopyWebpackPlugin = require("copy-webpack-plugin"); -const common = require('./webpack.common'); -const PATHS = require("./PATHS"); - -module.exports = merge(common, { - entry: { - main: ['@babel/polyfill', path.resolve(PATHS.src, 'doc.js')] - }, - output: { - filename: '[name].[chunkhash:8].js', - path: path.resolve(PATHS.doc), - // publicPath: '/' - }, - mode: 'production', - // devtool: 'inline-source-map', - module: { - rules: [ - { - test: /\.css$/, - use: ExtractTextPlugin.extract({ - fallback: 'style-loader', - use: [ - { loader: "css-loader" } - ] - }) - }, - { - test: /\.less$/, - // exclude: path.resolve(PATHS.src, 'stylesheet'), - use: ExtractTextPlugin.extract({ - fallback: 'style-loader', - use: [ - { - loader: "css-loader", - }, - { - loader: 'postcss-loader', - options: { - ident: 'postcss', - plugins: [autoprefixer('last 2 version')], - sourceMap: true - } - }, - { - loader: "less-loader", - options: { - javascriptEnabled: true - } - } - ] - }) - }, - ] - }, - optimization: { - moduleIds: 'hashed', - runtimeChunk: { - name: 'runtime' - }, - splitChunks: { - cacheGroups: { - vendor: { - test: /[\\/]node_modules[\\/]/, - priority: 10, - chunks: 'initial', - name: 'vendor' - } - } - } - }, - performance: { - hints: false - }, - plugins: [ - new CleanWebpackPlugin(['docs'], { - root: PATHS.root - }), - new ExtractTextPlugin({ - filename: '[name].[hash].css', - allChunks: true, - }), - new webpack.DefinePlugin({ // 为项目注入环境变量 - 'process.env.API': JSON.stringify('mock') - }), - new HtmlWebPackPlugin({ - template: path.resolve(PATHS.src, 'template/index.html'), - filename: path.resolve(PATHS.doc, 'index.html'), - favicon: path.resolve(PATHS.src, 'asset/image/favicon.png') - }), - // 注意一定要在HtmlWebpackPlugin之后引用 - // inline的name和runtimeChunk的name保持一致 - new ScriptExtHtmlWebpackPlugin({ - inline: /runtime\..*\.js$/ - }) - ] -}); diff --git a/config/webpack.prod.js b/config/webpack.prod.js deleted file mode 100644 index d66f4bf..0000000 --- a/config/webpack.prod.js +++ /dev/null @@ -1,98 +0,0 @@ -const path = require("path"); -const merge = require('webpack-merge'); -const CleanWebpackPlugin = require('clean-webpack-plugin'); -const HtmlWebPackPlugin = require("html-webpack-plugin"); -const ExtractTextPlugin = require('extract-text-webpack-plugin'); -const ScriptExtHtmlWebpackPlugin = require("script-ext-html-webpack-plugin"); -const autoprefixer = require('autoprefixer'); -const common = require('./webpack.common'); -const PATHS = require("./PATHS"); - -module.exports = merge(common, { - entry: { - main: ['@babel/polyfill', path.resolve(PATHS.src, 'index.js')] - }, - output: { - filename: '[name].[chunkhash:8].js', - path: path.resolve(PATHS.dist), - publicPath: '/' - }, - mode: 'production', - module: { - rules: [ - { - test: /\.css$/, - use: ExtractTextPlugin.extract({ - fallback: 'style-loader', - use: [ - { loader: "css-loader" } - ] - }) - }, - { - test: /\.less$/, - // exclude: path.resolve(PATHS.src, 'stylesheet'), - use: ExtractTextPlugin.extract({ - fallback: 'style-loader', - use: [ - { - loader: "css-loader", - }, - { - loader: 'postcss-loader', - options: { - ident: 'postcss', - plugins: [autoprefixer('last 2 version')], - sourceMap: true - } - }, - { - loader: "less-loader", - options: { - javascriptEnabled: true - } - } - ] - }) - }, - ] - }, - optimization: { - moduleIds: 'hashed', - runtimeChunk: { - name: 'runtime' - }, - splitChunks: { - cacheGroups: { - vendor: { - test: /[\\/]node_modules[\\/]/, - priority: 10, - chunks: 'initial', - name: 'vendor' - } - } - } - }, - performance: { - hints: false - }, - plugins: [ - new CleanWebpackPlugin(['dist'], { - root: PATHS.root - }), - new ExtractTextPlugin({ - filename: '[name].[hash].css', - allChunks: true, - }), - new HtmlWebPackPlugin({ - template: path.resolve(PATHS.src, 'template/index.html'), - filename: path.resolve(PATHS.dist, 'index.html'), - favicon: path.resolve(PATHS.src, 'asset/image/favicon.png') - }), - // 注意一定要在HtmlWebpackPlugin之后引用 - // inline的name和runtimeChunk的name保持一致 - new ScriptExtHtmlWebpackPlugin({ - inline: /runtime\..*\.js$/ - }) - ] -}); diff --git a/docs1/404.html b/docs1/404.html deleted file mode 100644 index 2fd495f..0000000 --- a/docs1/404.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/docs1/CNAME b/docs1/CNAME deleted file mode 100644 index 64dbefd..0000000 --- a/docs1/CNAME +++ /dev/null @@ -1 +0,0 @@ -www.antdtheme.com diff --git a/docs1/antd.less b/docs1/antd.less deleted file mode 100644 index 0868fef..0000000 --- a/docs1/antd.less +++ /dev/null @@ -1,18983 +0,0 @@ -/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */ -/* stylelint-disable no-duplicate-selectors */ -/* stylelint-disable */ -.bezierEasingMixin() { -@functions: ~`(function() { - var NEWTON_ITERATIONS = 4; - var NEWTON_MIN_SLOPE = 0.001; - var SUBDIVISION_PRECISION = 0.0000001; - var SUBDIVISION_MAX_ITERATIONS = 10; - - var kSplineTableSize = 11; - var kSampleStepSize = 1.0 / (kSplineTableSize - 1.0); - - var float32ArraySupported = typeof Float32Array === 'function'; - - function A (aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1; } - function B (aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1; } - function C (aA1) { return 3.0 * aA1; } - - // Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2. - function calcBezier (aT, aA1, aA2) { return ((A(aA1, aA2) * aT + B(aA1, aA2)) * aT + C(aA1)) * aT; } - - // Returns dx/dt given t, x1, and x2, or dy/dt given t, y1, and y2. - function getSlope (aT, aA1, aA2) { return 3.0 * A(aA1, aA2) * aT * aT + 2.0 * B(aA1, aA2) * aT + C(aA1); } - - function binarySubdivide (aX, aA, aB, mX1, mX2) { - var currentX, currentT, i = 0; - do { - currentT = aA + (aB - aA) / 2.0; - currentX = calcBezier(currentT, mX1, mX2) - aX; - if (currentX > 0.0) { - aB = currentT; - } else { - aA = currentT; - } - } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS); - return currentT; - } - - function newtonRaphsonIterate (aX, aGuessT, mX1, mX2) { - for (var i = 0; i < NEWTON_ITERATIONS; ++i) { - var currentSlope = getSlope(aGuessT, mX1, mX2); - if (currentSlope === 0.0) { - return aGuessT; - } - var currentX = calcBezier(aGuessT, mX1, mX2) - aX; - aGuessT -= currentX / currentSlope; - } - return aGuessT; - } - - var BezierEasing = function (mX1, mY1, mX2, mY2) { - if (!(0 <= mX1 && mX1 <= 1 && 0 <= mX2 && mX2 <= 1)) { - throw new Error('bezier x values must be in [0, 1] range'); - } - - // Precompute samples table - var sampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize); - if (mX1 !== mY1 || mX2 !== mY2) { - for (var i = 0; i < kSplineTableSize; ++i) { - sampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2); - } - } - - function getTForX (aX) { - var intervalStart = 0.0; - var currentSample = 1; - var lastSample = kSplineTableSize - 1; - - for (; currentSample !== lastSample && sampleValues[currentSample] <= aX; ++currentSample) { - intervalStart += kSampleStepSize; - } - --currentSample; - - // Interpolate to provide an initial guess for t - var dist = (aX - sampleValues[currentSample]) / (sampleValues[currentSample + 1] - sampleValues[currentSample]); - var guessForT = intervalStart + dist * kSampleStepSize; - - var initialSlope = getSlope(guessForT, mX1, mX2); - if (initialSlope >= NEWTON_MIN_SLOPE) { - return newtonRaphsonIterate(aX, guessForT, mX1, mX2); - } else if (initialSlope === 0.0) { - return guessForT; - } else { - return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize, mX1, mX2); - } - } - - return function BezierEasing (x) { - if (mX1 === mY1 && mX2 === mY2) { - return x; // linear - } - // Because JavaScript number are imprecise, we should guarantee the extremes are right. - if (x === 0) { - return 0; - } - if (x === 1) { - return 1; - } - return calcBezier(getTForX(x), mY1, mY2); - }; - }; - - this.colorEasing = BezierEasing(0.26, 0.09, 0.37, 0.18); - // less 3 requires a return - return ''; -})()`; -} -// It is hacky way to make this function will be compiled preferentially by less -// resolve error: `ReferenceError: colorPalette is not defined` -// https://github.com/ant-design/ant-motion/issues/44 -.bezierEasingMixin(); - -/* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */ -.tinyColorMixin() { -@functions: ~`(function() { -// TinyColor v1.4.1 -// https://github.com/bgrins/TinyColor -// 2016-07-07, Brian Grinstead, MIT License -var trimLeft = /^\s+/, - trimRight = /\s+$/, - tinyCounter = 0, - mathRound = Math.round, - mathMin = Math.min, - mathMax = Math.max, - mathRandom = Math.random; - -function tinycolor (color, opts) { - - color = (color) ? color : ''; - opts = opts || { }; - - // If input is already a tinycolor, return itself - if (color instanceof tinycolor) { - return color; - } - // If we are called as a function, call using new instead - if (!(this instanceof tinycolor)) { - return new tinycolor(color, opts); - } - - var rgb = inputToRGB(color); - this._originalInput = color, - this._r = rgb.r, - this._g = rgb.g, - this._b = rgb.b, - this._a = rgb.a, - this._roundA = mathRound(100*this._a) / 100, - this._format = opts.format || rgb.format; - this._gradientType = opts.gradientType; - - // Don't let the range of [0,255] come back in [0,1]. - // Potentially lose a little bit of precision here, but will fix issues where - // .5 gets interpreted as half of the total, instead of half of 1 - // If it was supposed to be 128, this was already taken care of by inputToRgb - if (this._r < 1) { this._r = mathRound(this._r); } - if (this._g < 1) { this._g = mathRound(this._g); } - if (this._b < 1) { this._b = mathRound(this._b); } - - this._ok = rgb.ok; - this._tc_id = tinyCounter++; -} - -tinycolor.prototype = { - isDark: function() { - return this.getBrightness() < 128; - }, - isLight: function() { - return !this.isDark(); - }, - isValid: function() { - return this._ok; - }, - getOriginalInput: function() { - return this._originalInput; - }, - getFormat: function() { - return this._format; - }, - getAlpha: function() { - return this._a; - }, - getBrightness: function() { - //http://www.w3.org/TR/AERT#color-contrast - var rgb = this.toRgb(); - return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000; - }, - getLuminance: function() { - //http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef - var rgb = this.toRgb(); - var RsRGB, GsRGB, BsRGB, R, G, B; - RsRGB = rgb.r/255; - GsRGB = rgb.g/255; - BsRGB = rgb.b/255; - - if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);} - if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);} - if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);} - return (0.2126 * R) + (0.7152 * G) + (0.0722 * B); - }, - setAlpha: function(value) { - this._a = boundAlpha(value); - this._roundA = mathRound(100*this._a) / 100; - return this; - }, - toHsv: function() { - var hsv = rgbToHsv(this._r, this._g, this._b); - return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a }; - }, - toHsvString: function() { - var hsv = rgbToHsv(this._r, this._g, this._b); - var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100); - return (this._a == 1) ? - "hsv(" + h + ", " + s + "%, " + v + "%)" : - "hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")"; - }, - toHsl: function() { - var hsl = rgbToHsl(this._r, this._g, this._b); - return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a }; - }, - toHslString: function() { - var hsl = rgbToHsl(this._r, this._g, this._b); - var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100); - return (this._a == 1) ? - "hsl(" + h + ", " + s + "%, " + l + "%)" : - "hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")"; - }, - toHex: function(allow3Char) { - return rgbToHex(this._r, this._g, this._b, allow3Char); - }, - toHexString: function(allow3Char) { - return '#' + this.toHex(allow3Char); - }, - toHex8: function(allow4Char) { - return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char); - }, - toHex8String: function(allow4Char) { - return '#' + this.toHex8(allow4Char); - }, - toRgb: function() { - return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a }; - }, - toRgbString: function() { - return (this._a == 1) ? - "rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" : - "rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")"; - }, - toPercentageRgb: function() { - return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a }; - }, - toPercentageRgbString: function() { - return (this._a == 1) ? - "rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" : - "rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")"; - }, - toName: function() { - if (this._a === 0) { - return "transparent"; - } - - if (this._a < 1) { - return false; - } - - return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false; - }, - toFilter: function(secondColor) { - var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a); - var secondHex8String = hex8String; - var gradientType = this._gradientType ? "GradientType = 1, " : ""; - - if (secondColor) { - var s = tinycolor(secondColor); - secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a); - } - - return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")"; - }, - toString: function(format) { - var formatSet = !!format; - format = format || this._format; - - var formattedString = false; - var hasAlpha = this._a < 1 && this._a >= 0; - var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name"); - - if (needsAlphaFormat) { - // Special case for "transparent", all other non-alpha formats - // will return rgba when there is transparency. - if (format === "name" && this._a === 0) { - return this.toName(); - } - return this.toRgbString(); - } - if (format === "rgb") { - formattedString = this.toRgbString(); - } - if (format === "prgb") { - formattedString = this.toPercentageRgbString(); - } - if (format === "hex" || format === "hex6") { - formattedString = this.toHexString(); - } - if (format === "hex3") { - formattedString = this.toHexString(true); - } - if (format === "hex4") { - formattedString = this.toHex8String(true); - } - if (format === "hex8") { - formattedString = this.toHex8String(); - } - if (format === "name") { - formattedString = this.toName(); - } - if (format === "hsl") { - formattedString = this.toHslString(); - } - if (format === "hsv") { - formattedString = this.toHsvString(); - } - - return formattedString || this.toHexString(); - }, - clone: function() { - return tinycolor(this.toString()); - }, - - _applyModification: function(fn, args) { - var color = fn.apply(null, [this].concat([].slice.call(args))); - this._r = color._r; - this._g = color._g; - this._b = color._b; - this.setAlpha(color._a); - return this; - }, - lighten: function() { - return this._applyModification(lighten, arguments); - }, - brighten: function() { - return this._applyModification(brighten, arguments); - }, - darken: function() { - return this._applyModification(darken, arguments); - }, - desaturate: function() { - return this._applyModification(desaturate, arguments); - }, - saturate: function() { - return this._applyModification(saturate, arguments); - }, - greyscale: function() { - return this._applyModification(greyscale, arguments); - }, - spin: function() { - return this._applyModification(spin, arguments); - }, - - _applyCombination: function(fn, args) { - return fn.apply(null, [this].concat([].slice.call(args))); - }, - analogous: function() { - return this._applyCombination(analogous, arguments); - }, - complement: function() { - return this._applyCombination(complement, arguments); - }, - monochromatic: function() { - return this._applyCombination(monochromatic, arguments); - }, - splitcomplement: function() { - return this._applyCombination(splitcomplement, arguments); - }, - triad: function() { - return this._applyCombination(triad, arguments); - }, - tetrad: function() { - return this._applyCombination(tetrad, arguments); - } -}; - -// If input is an object, force 1 into "1.0" to handle ratios properly -// String input requires "1.0" as input, so 1 will be treated as 1 -tinycolor.fromRatio = function(color, opts) { - if (typeof color == "object") { - var newColor = {}; - for (var i in color) { - if (color.hasOwnProperty(i)) { - if (i === "a") { - newColor[i] = color[i]; - } - else { - newColor[i] = convertToPercentage(color[i]); - } - } - } - color = newColor; - } - - return tinycolor(color, opts); -}; - -// Given a string or object, convert that input to RGB -// Possible string inputs: -// -// "red" -// "#f00" or "f00" -// "#ff0000" or "ff0000" -// "#ff000000" or "ff000000" -// "rgb 255 0 0" or "rgb (255, 0, 0)" -// "rgb 1.0 0 0" or "rgb (1, 0, 0)" -// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1" -// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1" -// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%" -// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1" -// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%" -// -function inputToRGB(color) { - - var rgb = { r: 0, g: 0, b: 0 }; - var a = 1; - var s = null; - var v = null; - var l = null; - var ok = false; - var format = false; - - if (typeof color == "string") { - color = stringInputToObject(color); - } - - if (typeof color == "object") { - if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) { - rgb = rgbToRgb(color.r, color.g, color.b); - ok = true; - format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb"; - } - else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) { - s = convertToPercentage(color.s); - v = convertToPercentage(color.v); - rgb = hsvToRgb(color.h, s, v); - ok = true; - format = "hsv"; - } - else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) { - s = convertToPercentage(color.s); - l = convertToPercentage(color.l); - rgb = hslToRgb(color.h, s, l); - ok = true; - format = "hsl"; - } - - if (color.hasOwnProperty("a")) { - a = color.a; - } - } - - a = boundAlpha(a); - - return { - ok: ok, - format: color.format || format, - r: mathMin(255, mathMax(rgb.r, 0)), - g: mathMin(255, mathMax(rgb.g, 0)), - b: mathMin(255, mathMax(rgb.b, 0)), - a: a - }; -} - -// Conversion Functions -// -------------------- - -// rgbToHsl, rgbToHsv, hslToRgb, hsvToRgb modified from: -//`s get reset. However, we also reset the -// bottom margin to use `em` units instead of `em`. -p { - margin-top: 0; - margin-bottom: 1em; -} - -// Abbreviations -// -// 1. remove the bottom border in Firefox 39-. -// 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari. -// 3. Add explicit cursor to indicate changed behavior. -// 4. Duplicate behavior to the data-* attribute for our tooltip plugin - -abbr[title], -abbr[data-original-title] { - // 4 - text-decoration: underline; // 2 - text-decoration: underline dotted; // 2 - border-bottom: 0; // 1 - cursor: help; // 3 -} - -address { - margin-bottom: 1em; - font-style: normal; - line-height: inherit; -} - -input[type='text'], -input[type='password'], -input[type='number'], -textarea { - -webkit-appearance: none; -} - -ol, -ul, -dl { - margin-top: 0; - margin-bottom: 1em; -} - -ol ol, -ul ul, -ol ul, -ul ol { - margin-bottom: 0; -} - -dt { - font-weight: 500; -} - -dd { - margin-bottom: 0.5em; - margin-left: 0; // Undo browser default -} - -blockquote { - margin: 0 0 1em; -} - -dfn { - font-style: italic; // Add the correct font style in Android 4.3- -} - -b, -strong { - font-weight: bolder; // Add the correct font weight in Chrome, Edge, and Safari -} - -small { - font-size: 80%; // Add the correct font size in all browsers -} - -// -// Prevent `sub` and `sup` elements from affecting the line height in -// all browsers. -// - -sub, -sup { - position: relative; - font-size: 75%; - line-height: 0; - vertical-align: baseline; -} - -sub { - bottom: -0.25em; -} -sup { - top: -0.5em; -} - -// -// Links -// - -a { - color: @link-color; - text-decoration: @link-decoration; - background-color: transparent; // remove the gray background on active links in IE 10. - outline: none; - cursor: pointer; - transition: color 0.3s; - -webkit-text-decoration-skip: objects; // remove gaps in links underline in iOS 8+ and Safari 8+. - - &:hover { - color: @link-hover-color; - } - - &:active { - color: @link-active-color; - } - - &:active, - &:hover { - text-decoration: @link-hover-decoration; - outline: 0; - } - - &[disabled] { - color: @disabled-color; - cursor: not-allowed; - pointer-events: none; - } -} - -// -// Code -// - -pre, -code, -kbd, -samp { - font-size: 1em; // Correct the odd `em` font sizing in all browsers. - font-family: @code-family; -} - -pre { - // remove browser default top margin - margin-top: 0; - // Reset browser default of `1em` to use `em`s - margin-bottom: 1em; - // Don't allow content to break outside - overflow: auto; -} - -// -// Figures -// -figure { - // Apply a consistent margin strategy (matches our type styles). - margin: 0 0 1em; -} - -// -// Images and content -// - -img { - vertical-align: middle; - border-style: none; // remove the border on images inside links in IE 10-. -} - -svg:not(:root) { - overflow: hidden; // Hide the overflow in IE -} - -// Avoid 300ms click delay on touch devices that support the `touch-action` CSS property. -// -// In particular, unlike most other browsers, IE11+Edge on Windows 10 on touch devices and IE Mobile 10-11 -// DON'T remove the click delay when `` is present. -// However, they DO support emoving the click delay via `touch-action: manipulation`. -// See: -// * https://getbootstrap.com/docs/4.0/content/reboot/#click-delay-optimization-for-touch -// * http://caniuse.com/#feat=css-touch-action -// * https://patrickhlauke.github.io/touch/tests/results/#suppressing-300ms-delay - -a, -area, -button, -[role='button'], -input:not([type='range']), -label, -select, -summary, -textarea { - touch-action: manipulation; -} - -// -// Tables -// - -table { - border-collapse: collapse; // Prevent double borders -} - -caption { - padding-top: 0.75em; - padding-bottom: 0.3em; - color: @text-color-secondary; - text-align: left; - caption-side: bottom; -} - -th { - // Matches default `