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,14 @@
export declare const ATTR_CACHE_MAP = "data-ant-cssinjs-cache-path";
/**
* This marks style from the css file.
* Which means not exist in `<style />` tag.
*/
export declare const CSS_FILE_STYLE = "_FILE_STYLE__";
export declare function serialize(cachePathMap: Record<string, string>): string;
/**
* @private Test usage only. Can save remove if no need.
*/
export declare function reset(mockCache?: Record<string, string>, fromFile?: boolean): void;
export declare function prepare(): void;
export declare function existPath(path: string): boolean;
export declare function getStyleAndHash(path: string): [style: string | null, hash: string];

View File

@@ -0,0 +1,94 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.CSS_FILE_STYLE = exports.ATTR_CACHE_MAP = void 0;
exports.existPath = existPath;
exports.getStyleAndHash = getStyleAndHash;
exports.prepare = prepare;
exports.reset = reset;
exports.serialize = serialize;
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var _canUseDom = _interopRequireDefault(require("rc-util/lib/Dom/canUseDom"));
var _StyleContext = require("../StyleContext");
var ATTR_CACHE_MAP = exports.ATTR_CACHE_MAP = 'data-ant-cssinjs-cache-path';
/**
* This marks style from the css file.
* Which means not exist in `<style />` tag.
*/
var CSS_FILE_STYLE = exports.CSS_FILE_STYLE = '_FILE_STYLE__';
function serialize(cachePathMap) {
return Object.keys(cachePathMap).map(function (path) {
var hash = cachePathMap[path];
return "".concat(path, ":").concat(hash);
}).join(';');
}
var cachePathMap;
var fromCSSFile = true;
/**
* @private Test usage only. Can save remove if no need.
*/
function reset(mockCache) {
var fromFile = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
cachePathMap = mockCache;
fromCSSFile = fromFile;
}
function prepare() {
if (!cachePathMap) {
cachePathMap = {};
if ((0, _canUseDom.default)()) {
var div = document.createElement('div');
div.className = ATTR_CACHE_MAP;
div.style.position = 'fixed';
div.style.visibility = 'hidden';
div.style.top = '-9999px';
document.body.appendChild(div);
var content = getComputedStyle(div).content || '';
content = content.replace(/^"/, '').replace(/"$/, '');
// Fill data
content.split(';').forEach(function (item) {
var _item$split = item.split(':'),
_item$split2 = (0, _slicedToArray2.default)(_item$split, 2),
path = _item$split2[0],
hash = _item$split2[1];
cachePathMap[path] = hash;
});
// Remove inline record style
var inlineMapStyle = document.querySelector("style[".concat(ATTR_CACHE_MAP, "]"));
if (inlineMapStyle) {
var _inlineMapStyle$paren;
fromCSSFile = false;
(_inlineMapStyle$paren = inlineMapStyle.parentNode) === null || _inlineMapStyle$paren === void 0 || _inlineMapStyle$paren.removeChild(inlineMapStyle);
}
document.body.removeChild(div);
}
}
}
function existPath(path) {
prepare();
return !!cachePathMap[path];
}
function getStyleAndHash(path) {
var hash = cachePathMap[path];
var styleStr = null;
if (hash && (0, _canUseDom.default)()) {
if (fromCSSFile) {
styleStr = CSS_FILE_STYLE;
} else {
var _style = document.querySelector("style[".concat(_StyleContext.ATTR_MARK, "=\"").concat(cachePathMap[path], "\"]"));
if (_style) {
styleStr = _style.innerHTML;
} else {
// Clean up since not exist anymore
delete cachePathMap[path];
}
}
}
return [styleStr, hash];
}

View File

@@ -0,0 +1,14 @@
export declare const token2CSSVar: (token: string, prefix?: string) => string;
export declare const serializeCSSVar: <T extends Record<string, any>>(cssVars: T, hashId: string, options?: {
scope?: string;
}) => string;
export type TokenWithCSSVar<V, T extends Record<string, V> = Record<string, V>> = {
[key in keyof T]?: string | V;
};
export declare const transformToken: <V, T extends Record<string, V> = Record<string, V>>(token: T, themeKey: string, config?: {
prefix?: string | undefined;
ignore?: { [key in keyof T]?: boolean | undefined; } | undefined;
unitless?: { [key_1 in keyof T]?: boolean | undefined; } | undefined;
preserve?: { [key_2 in keyof T]?: boolean | undefined; } | undefined;
scope?: string | undefined;
} | undefined) => [TokenWithCSSVar<V, T>, string];

View File

@@ -0,0 +1,44 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.transformToken = exports.token2CSSVar = exports.serializeCSSVar = void 0;
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
var token2CSSVar = exports.token2CSSVar = function token2CSSVar(token) {
var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return "--".concat(prefix ? "".concat(prefix, "-") : '').concat(token).replace(/([a-z0-9])([A-Z])/g, '$1-$2').replace(/([A-Z]+)([A-Z][a-z0-9]+)/g, '$1-$2').replace(/([a-z])([A-Z0-9])/g, '$1-$2').toLowerCase();
};
var serializeCSSVar = exports.serializeCSSVar = function serializeCSSVar(cssVars, hashId, options) {
if (!Object.keys(cssVars).length) {
return '';
}
return ".".concat(hashId).concat(options !== null && options !== void 0 && options.scope ? ".".concat(options.scope) : '', "{").concat(Object.entries(cssVars).map(function (_ref) {
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
key = _ref2[0],
value = _ref2[1];
return "".concat(key, ":").concat(value, ";");
}).join(''), "}");
};
var transformToken = exports.transformToken = function transformToken(token, themeKey, config) {
var cssVars = {};
var result = {};
Object.entries(token).forEach(function (_ref3) {
var _config$preserve, _config$ignore;
var _ref4 = (0, _slicedToArray2.default)(_ref3, 2),
key = _ref4[0],
value = _ref4[1];
if (config !== null && config !== void 0 && (_config$preserve = config.preserve) !== null && _config$preserve !== void 0 && _config$preserve[key]) {
result[key] = value;
} else if ((typeof value === 'string' || typeof value === 'number') && !(config !== null && config !== void 0 && (_config$ignore = config.ignore) !== null && _config$ignore !== void 0 && _config$ignore[key])) {
var _config$unitless;
var cssVar = token2CSSVar(key, config === null || config === void 0 ? void 0 : config.prefix);
cssVars[cssVar] = typeof value === 'number' && !(config !== null && config !== void 0 && (_config$unitless = config.unitless) !== null && _config$unitless !== void 0 && _config$unitless[key]) ? "".concat(value, "px") : String(value);
result[key] = "var(".concat(cssVar, ")");
}
});
return [result, serializeCSSVar(cssVars, themeKey, {
scope: config === null || config === void 0 ? void 0 : config.scope
})];
};

15
node_modules/@ant-design/cssinjs/lib/util/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
export declare function memoResult<T extends object, R>(callback: () => R, deps: T[]): R;
/**
* Flatten token to string, this will auto cache the result when token not change
*/
export declare function flattenToken(token: any): string;
/**
* Convert derivative token to key string
*/
export declare function token2key(token: any, salt: string): string;
export declare function supportLayer(): boolean;
export declare function supportWhere(): boolean;
export declare function supportLogicProps(): boolean;
export declare const isClientSide: boolean;
export declare function unit(num: string | number): string;
export declare function toStyleStr(style: string, tokenKey?: string, styleId?: string, customizeAttrs?: Record<string, string>, plain?: boolean): string;

155
node_modules/@ant-design/cssinjs/lib/util/index.js generated vendored Normal file
View File

@@ -0,0 +1,155 @@
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.flattenToken = flattenToken;
exports.isClientSide = void 0;
exports.memoResult = memoResult;
exports.supportLayer = supportLayer;
exports.supportLogicProps = supportLogicProps;
exports.supportWhere = supportWhere;
exports.toStyleStr = toStyleStr;
exports.token2key = token2key;
exports.unit = unit;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
var _hash = _interopRequireDefault(require("@emotion/hash"));
var _canUseDom = _interopRequireDefault(require("rc-util/lib/Dom/canUseDom"));
var _dynamicCSS = require("rc-util/lib/Dom/dynamicCSS");
var _StyleContext = require("../StyleContext");
var _theme = require("../theme");
// Create a cache for memo concat
var resultCache = new WeakMap();
var RESULT_VALUE = {};
function memoResult(callback, deps) {
var current = resultCache;
for (var i = 0; i < deps.length; i += 1) {
var dep = deps[i];
if (!current.has(dep)) {
current.set(dep, new WeakMap());
}
current = current.get(dep);
}
if (!current.has(RESULT_VALUE)) {
current.set(RESULT_VALUE, callback());
}
return current.get(RESULT_VALUE);
}
// Create a cache here to avoid always loop generate
var flattenTokenCache = new WeakMap();
/**
* Flatten token to string, this will auto cache the result when token not change
*/
function flattenToken(token) {
var str = flattenTokenCache.get(token) || '';
if (!str) {
Object.keys(token).forEach(function (key) {
var value = token[key];
str += key;
if (value instanceof _theme.Theme) {
str += value.id;
} else if (value && (0, _typeof2.default)(value) === 'object') {
str += flattenToken(value);
} else {
str += value;
}
});
// https://github.com/ant-design/ant-design/issues/48386
// Should hash the string to avoid style tag name too long
str = (0, _hash.default)(str);
// Put in cache
flattenTokenCache.set(token, str);
}
return str;
}
/**
* Convert derivative token to key string
*/
function token2key(token, salt) {
return (0, _hash.default)("".concat(salt, "_").concat(flattenToken(token)));
}
var randomSelectorKey = "random-".concat(Date.now(), "-").concat(Math.random()).replace(/\./g, '');
// Magic `content` for detect selector support
var checkContent = '_bAmBoO_';
function supportSelector(styleStr, handleElement, supportCheck) {
if ((0, _canUseDom.default)()) {
var _getComputedStyle$con, _ele$parentNode;
(0, _dynamicCSS.updateCSS)(styleStr, randomSelectorKey);
var _ele = document.createElement('div');
_ele.style.position = 'fixed';
_ele.style.left = '0';
_ele.style.top = '0';
handleElement === null || handleElement === void 0 || handleElement(_ele);
document.body.appendChild(_ele);
if (process.env.NODE_ENV !== 'production') {
_ele.innerHTML = 'Test';
_ele.style.zIndex = '9999999';
}
var support = supportCheck ? supportCheck(_ele) : (_getComputedStyle$con = getComputedStyle(_ele).content) === null || _getComputedStyle$con === void 0 ? void 0 : _getComputedStyle$con.includes(checkContent);
(_ele$parentNode = _ele.parentNode) === null || _ele$parentNode === void 0 || _ele$parentNode.removeChild(_ele);
(0, _dynamicCSS.removeCSS)(randomSelectorKey);
return support;
}
return false;
}
var canLayer = undefined;
function supportLayer() {
if (canLayer === undefined) {
canLayer = supportSelector("@layer ".concat(randomSelectorKey, " { .").concat(randomSelectorKey, " { content: \"").concat(checkContent, "\"!important; } }"), function (ele) {
ele.className = randomSelectorKey;
});
}
return canLayer;
}
var canWhere = undefined;
function supportWhere() {
if (canWhere === undefined) {
canWhere = supportSelector(":where(.".concat(randomSelectorKey, ") { content: \"").concat(checkContent, "\"!important; }"), function (ele) {
ele.className = randomSelectorKey;
});
}
return canWhere;
}
var canLogic = undefined;
function supportLogicProps() {
if (canLogic === undefined) {
canLogic = supportSelector(".".concat(randomSelectorKey, " { inset-block: 93px !important; }"), function (ele) {
ele.className = randomSelectorKey;
}, function (ele) {
return getComputedStyle(ele).bottom === '93px';
});
}
return canLogic;
}
var isClientSide = exports.isClientSide = (0, _canUseDom.default)();
function unit(num) {
if (typeof num === 'number') {
return "".concat(num, "px");
}
return num;
}
function toStyleStr(style, tokenKey, styleId) {
var customizeAttrs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var plain = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
if (plain) {
return style;
}
var attrs = (0, _objectSpread3.default)((0, _objectSpread3.default)({}, customizeAttrs), {}, (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _StyleContext.ATTR_TOKEN, tokenKey), _StyleContext.ATTR_MARK, styleId));
var attrStr = Object.keys(attrs).map(function (attr) {
var val = attrs[attr];
return val ? "".concat(attr, "=\"").concat(val, "\"") : null;
}).filter(function (v) {
return v;
}).join(' ');
return "<style ".concat(attrStr, ">").concat(style, "</style>");
}