add all frontend files

This commit is contained in:
2026-01-17 15:16:36 -05:00
parent ff16ae7858
commit e40287e4aa
25704 changed files with 1935289 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
import type { ColorMapToken, SeedToken } from '../../interface';
import type { GenerateColorMap, GenerateNeutralColorMap } from '../ColorMap';
interface PaletteGenerators {
generateColorPalettes: GenerateColorMap;
generateNeutralColorPalettes: GenerateNeutralColorMap;
}
export default function genColorMapToken(seed: SeedToken, { generateColorPalettes, generateNeutralColorPalettes }: PaletteGenerators): ColorMapToken;
export {};

View File

@@ -0,0 +1,90 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = genColorMapToken;
var _fastColor = require("@ant-design/fast-color");
function genColorMapToken(seed, {
generateColorPalettes,
generateNeutralColorPalettes
}) {
const {
colorSuccess: colorSuccessBase,
colorWarning: colorWarningBase,
colorError: colorErrorBase,
colorInfo: colorInfoBase,
colorPrimary: colorPrimaryBase,
colorBgBase,
colorTextBase
} = seed;
const primaryColors = generateColorPalettes(colorPrimaryBase);
const successColors = generateColorPalettes(colorSuccessBase);
const warningColors = generateColorPalettes(colorWarningBase);
const errorColors = generateColorPalettes(colorErrorBase);
const infoColors = generateColorPalettes(colorInfoBase);
const neutralColors = generateNeutralColorPalettes(colorBgBase, colorTextBase);
// Color Link
const colorLink = seed.colorLink || seed.colorInfo;
const linkColors = generateColorPalettes(colorLink);
const colorErrorBgFilledHover = new _fastColor.FastColor(errorColors[1]).mix(new _fastColor.FastColor(errorColors[3]), 50).toHexString();
return Object.assign(Object.assign({}, neutralColors), {
colorPrimaryBg: primaryColors[1],
colorPrimaryBgHover: primaryColors[2],
colorPrimaryBorder: primaryColors[3],
colorPrimaryBorderHover: primaryColors[4],
colorPrimaryHover: primaryColors[5],
colorPrimary: primaryColors[6],
colorPrimaryActive: primaryColors[7],
colorPrimaryTextHover: primaryColors[8],
colorPrimaryText: primaryColors[9],
colorPrimaryTextActive: primaryColors[10],
colorSuccessBg: successColors[1],
colorSuccessBgHover: successColors[2],
colorSuccessBorder: successColors[3],
colorSuccessBorderHover: successColors[4],
colorSuccessHover: successColors[4],
colorSuccess: successColors[6],
colorSuccessActive: successColors[7],
colorSuccessTextHover: successColors[8],
colorSuccessText: successColors[9],
colorSuccessTextActive: successColors[10],
colorErrorBg: errorColors[1],
colorErrorBgHover: errorColors[2],
colorErrorBgFilledHover,
colorErrorBgActive: errorColors[3],
colorErrorBorder: errorColors[3],
colorErrorBorderHover: errorColors[4],
colorErrorHover: errorColors[5],
colorError: errorColors[6],
colorErrorActive: errorColors[7],
colorErrorTextHover: errorColors[8],
colorErrorText: errorColors[9],
colorErrorTextActive: errorColors[10],
colorWarningBg: warningColors[1],
colorWarningBgHover: warningColors[2],
colorWarningBorder: warningColors[3],
colorWarningBorderHover: warningColors[4],
colorWarningHover: warningColors[4],
colorWarning: warningColors[6],
colorWarningActive: warningColors[7],
colorWarningTextHover: warningColors[8],
colorWarningText: warningColors[9],
colorWarningTextActive: warningColors[10],
colorInfoBg: infoColors[1],
colorInfoBgHover: infoColors[2],
colorInfoBorder: infoColors[3],
colorInfoBorderHover: infoColors[4],
colorInfoHover: infoColors[4],
colorInfo: infoColors[6],
colorInfoActive: infoColors[7],
colorInfoTextHover: infoColors[8],
colorInfoText: infoColors[9],
colorInfoTextActive: infoColors[10],
colorLinkHover: linkColors[4],
colorLink: linkColors[6],
colorLinkActive: linkColors[7],
colorBgMask: new _fastColor.FastColor('#000').setA(0.45).toRgbString(),
colorWhite: '#fff'
});
}

View File

@@ -0,0 +1,2 @@
import type { CommonMapToken, SeedToken } from '../../interface';
export default function genCommonMapToken(token: SeedToken): CommonMapToken;

View File

@@ -0,0 +1,24 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = genCommonMapToken;
var _genRadius = _interopRequireDefault(require("./genRadius"));
function genCommonMapToken(token) {
const {
motionUnit,
motionBase,
borderRadius,
lineWidth
} = token;
return Object.assign({
// motion
motionDurationFast: `${(motionBase + motionUnit).toFixed(1)}s`,
motionDurationMid: `${(motionBase + motionUnit * 2).toFixed(1)}s`,
motionDurationSlow: `${(motionBase + motionUnit * 3).toFixed(1)}s`,
// line
lineWidthBold: lineWidth + 1
}, (0, _genRadius.default)(borderRadius));
}

View File

@@ -0,0 +1,3 @@
import type { HeightMapToken, SeedToken } from '../../interface';
declare const genControlHeight: (token: SeedToken) => HeightMapToken;
export default genControlHeight;

View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
const genControlHeight = token => {
const {
controlHeight
} = token;
return {
controlHeightSM: controlHeight * 0.75,
controlHeightXS: controlHeight * 0.5,
controlHeightLG: controlHeight * 1.25
};
};
var _default = exports.default = genControlHeight;

View File

@@ -0,0 +1,3 @@
import type { FontMapToken } from '../../interface';
declare const genFontMapToken: (fontSize: number) => FontMapToken;
export default genFontMapToken;

View File

@@ -0,0 +1,42 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _genFontSizes = _interopRequireDefault(require("./genFontSizes"));
const genFontMapToken = fontSize => {
const fontSizePairs = (0, _genFontSizes.default)(fontSize);
const fontSizes = fontSizePairs.map(pair => pair.size);
const lineHeights = fontSizePairs.map(pair => pair.lineHeight);
const fontSizeMD = fontSizes[1];
const fontSizeSM = fontSizes[0];
const fontSizeLG = fontSizes[2];
const lineHeight = lineHeights[1];
const lineHeightSM = lineHeights[0];
const lineHeightLG = lineHeights[2];
return {
fontSizeSM,
fontSize: fontSizeMD,
fontSizeLG,
fontSizeXL: fontSizes[3],
fontSizeHeading1: fontSizes[6],
fontSizeHeading2: fontSizes[5],
fontSizeHeading3: fontSizes[4],
fontSizeHeading4: fontSizes[3],
fontSizeHeading5: fontSizes[2],
lineHeight,
lineHeightLG,
lineHeightSM,
fontHeight: Math.round(lineHeight * fontSizeMD),
fontHeightLG: Math.round(lineHeightLG * fontSizeLG),
fontHeightSM: Math.round(lineHeightSM * fontSizeSM),
lineHeightHeading1: lineHeights[6],
lineHeightHeading2: lineHeights[5],
lineHeightHeading3: lineHeights[4],
lineHeightHeading4: lineHeights[3],
lineHeightHeading5: lineHeights[2]
};
};
var _default = exports.default = genFontMapToken;

View File

@@ -0,0 +1,5 @@
export declare function getLineHeight(fontSize: number): number;
export default function getFontSizes(base: number): {
size: number;
lineHeight: number;
}[];

View File

@@ -0,0 +1,27 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getFontSizes;
exports.getLineHeight = getLineHeight;
function getLineHeight(fontSize) {
return (fontSize + 8) / fontSize;
}
// https://zhuanlan.zhihu.com/p/32746810
function getFontSizes(base) {
const fontSizes = Array.from({
length: 10
}).map((_, index) => {
const i = index - 1;
const baseSize = base * Math.pow(Math.E, i / 5);
const intSize = index > 1 ? Math.floor(baseSize) : Math.ceil(baseSize);
// Convert to even
return Math.floor(intSize / 2) * 2;
});
fontSizes[1] = base;
return fontSizes.map(size => ({
size,
lineHeight: getLineHeight(size)
}));
}

View File

@@ -0,0 +1,3 @@
import type { MapToken } from '../../interface';
declare const genRadius: (radiusBase: number) => Pick<MapToken, "borderRadiusXS" | "borderRadiusSM" | "borderRadiusLG" | "borderRadius" | "borderRadiusOuter">;
export default genRadius;

52
node_modules/antd/lib/theme/themes/shared/genRadius.js generated vendored Normal file
View File

@@ -0,0 +1,52 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
const genRadius = radiusBase => {
let radiusLG = radiusBase;
let radiusSM = radiusBase;
let radiusXS = radiusBase;
let radiusOuter = radiusBase;
// radiusLG
if (radiusBase < 6 && radiusBase >= 5) {
radiusLG = radiusBase + 1;
} else if (radiusBase < 16 && radiusBase >= 6) {
radiusLG = radiusBase + 2;
} else if (radiusBase >= 16) {
radiusLG = 16;
}
// radiusSM
if (radiusBase < 7 && radiusBase >= 5) {
radiusSM = 4;
} else if (radiusBase < 8 && radiusBase >= 7) {
radiusSM = 5;
} else if (radiusBase < 14 && radiusBase >= 8) {
radiusSM = 6;
} else if (radiusBase < 16 && radiusBase >= 14) {
radiusSM = 7;
} else if (radiusBase >= 16) {
radiusSM = 8;
}
// radiusXS
if (radiusBase < 6 && radiusBase >= 2) {
radiusXS = 1;
} else if (radiusBase >= 6) {
radiusXS = 2;
}
// radiusOuter
if (radiusBase > 4 && radiusBase < 8) {
radiusOuter = 4;
} else if (radiusBase >= 8) {
radiusOuter = 6;
}
return {
borderRadius: radiusBase,
borderRadiusXS: radiusXS,
borderRadiusSM: radiusSM,
borderRadiusLG: radiusLG,
borderRadiusOuter: radiusOuter
};
};
var _default = exports.default = genRadius;

View File

@@ -0,0 +1,2 @@
import type { SeedToken, SizeMapToken } from '../../interface';
export default function genSizeMapToken(token: SeedToken): SizeMapToken;

View File

@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = genSizeMapToken;
function genSizeMapToken(token) {
const {
sizeUnit,
sizeStep
} = token;
return {
sizeXXL: sizeUnit * (sizeStep + 8),
// 48
sizeXL: sizeUnit * (sizeStep + 4),
// 32
sizeLG: sizeUnit * (sizeStep + 2),
// 24
sizeMD: sizeUnit * (sizeStep + 1),
// 20
sizeMS: sizeUnit * sizeStep,
// 16
size: sizeUnit * sizeStep,
// 16
sizeSM: sizeUnit * (sizeStep - 1),
// 12
sizeXS: sizeUnit * (sizeStep - 2),
// 8
sizeXXS: sizeUnit * (sizeStep - 3) // 4
};
}