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

59
node_modules/antd/es/anchor/Anchor.d.ts generated vendored Normal file
View File

@@ -0,0 +1,59 @@
import * as React from 'react';
import type { AffixProps } from '../affix';
import type { AnchorLinkBaseProps } from './AnchorLink';
export interface AnchorLinkItemProps extends AnchorLinkBaseProps {
key: React.Key;
children?: AnchorLinkItemProps[];
}
export type AnchorContainer = HTMLElement | Window;
export interface AnchorProps {
prefixCls?: string;
className?: string;
rootClassName?: string;
style?: React.CSSProperties;
/**
* @deprecated Please use `items` instead.
*/
children?: React.ReactNode;
offsetTop?: number;
bounds?: number;
affix?: boolean | Omit<AffixProps, 'offsetTop' | 'target' | 'children'>;
showInkInFixed?: boolean;
getContainer?: () => AnchorContainer;
/** Return customize highlight anchor */
getCurrentAnchor?: (activeLink: string) => string;
onClick?: (e: React.MouseEvent<HTMLElement>, link: {
title: React.ReactNode;
href: string;
}) => void;
/** Scroll to target offset value, if none, it's offsetTop prop value or 0. */
targetOffset?: number;
/** Listening event when scrolling change active link */
onChange?: (currentActiveLink: string) => void;
items?: AnchorLinkItemProps[];
direction?: AnchorDirection;
replace?: boolean;
}
export interface AnchorState {
activeLink: null | string;
}
export interface AnchorDefaultProps extends AnchorProps {
prefixCls: string;
affix: boolean;
showInkInFixed: boolean;
getContainer: () => AnchorContainer;
}
export type AnchorDirection = 'vertical' | 'horizontal';
export interface AntAnchor {
registerLink: (link: string) => void;
unregisterLink: (link: string) => void;
activeLink: string | null;
scrollTo: (link: string) => void;
onClick?: (e: React.MouseEvent<HTMLAnchorElement, MouseEvent>, link: {
title: React.ReactNode;
href: string;
}) => void;
direction: AnchorDirection;
}
declare const Anchor: React.FC<AnchorProps>;
export default Anchor;

243
node_modules/antd/es/anchor/Anchor.js generated vendored Normal file
View File

@@ -0,0 +1,243 @@
"use client";
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
import * as React from 'react';
import classNames from 'classnames';
import useEvent from "rc-util/es/hooks/useEvent";
import scrollIntoView from 'scroll-into-view-if-needed';
import getScroll from '../_util/getScroll';
import scrollTo from '../_util/scrollTo';
import { devUseWarning } from '../_util/warning';
import Affix from '../affix';
import { ConfigContext, useComponentConfig } from '../config-provider/context';
import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
import AnchorLink from './AnchorLink';
import AnchorContext from './context';
import useStyle from './style';
function getDefaultContainer() {
return window;
}
function getOffsetTop(element, container) {
if (!element.getClientRects().length) {
return 0;
}
const rect = element.getBoundingClientRect();
if (rect.width || rect.height) {
if (container === window) {
return rect.top - element.ownerDocument.documentElement.clientTop;
}
return rect.top - container.getBoundingClientRect().top;
}
return rect.top;
}
const sharpMatcherRegex = /#([\S ]+)$/;
const Anchor = props => {
var _a;
const {
rootClassName,
prefixCls: customPrefixCls,
className,
style,
offsetTop,
affix = true,
showInkInFixed = false,
children,
items,
direction: anchorDirection = 'vertical',
bounds,
targetOffset,
onClick,
onChange,
getContainer,
getCurrentAnchor,
replace
} = props;
// =================== Warning =====================
if (process.env.NODE_ENV !== 'production') {
const warning = devUseWarning('Anchor');
warning.deprecated(!children, 'Anchor children', 'items');
process.env.NODE_ENV !== "production" ? warning(!(anchorDirection === 'horizontal' && (items === null || items === void 0 ? void 0 : items.some(n => 'children' in n))), 'usage', '`Anchor items#children` is not supported when `Anchor` direction is horizontal.') : void 0;
}
const [links, setLinks] = React.useState([]);
const [activeLink, setActiveLink] = React.useState(null);
const activeLinkRef = React.useRef(activeLink);
const wrapperRef = React.useRef(null);
const spanLinkNode = React.useRef(null);
const animating = React.useRef(false);
const {
direction,
getPrefixCls,
className: anchorClassName,
style: anchorStyle
} = useComponentConfig('anchor');
const {
getTargetContainer
} = React.useContext(ConfigContext);
const prefixCls = getPrefixCls('anchor', customPrefixCls);
const rootCls = useCSSVarCls(prefixCls);
const [wrapCSSVar, hashId, cssVarCls] = useStyle(prefixCls, rootCls);
const getCurrentContainer = (_a = getContainer !== null && getContainer !== void 0 ? getContainer : getTargetContainer) !== null && _a !== void 0 ? _a : getDefaultContainer;
const dependencyListItem = JSON.stringify(links);
const registerLink = useEvent(link => {
if (!links.includes(link)) {
setLinks(prev => [].concat(_toConsumableArray(prev), [link]));
}
});
const unregisterLink = useEvent(link => {
if (links.includes(link)) {
setLinks(prev => prev.filter(i => i !== link));
}
});
const updateInk = () => {
var _a;
const linkNode = (_a = wrapperRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(`.${prefixCls}-link-title-active`);
if (linkNode && spanLinkNode.current) {
const {
style: inkStyle
} = spanLinkNode.current;
const horizontalAnchor = anchorDirection === 'horizontal';
inkStyle.top = horizontalAnchor ? '' : `${linkNode.offsetTop + linkNode.clientHeight / 2}px`;
inkStyle.height = horizontalAnchor ? '' : `${linkNode.clientHeight}px`;
inkStyle.left = horizontalAnchor ? `${linkNode.offsetLeft}px` : '';
inkStyle.width = horizontalAnchor ? `${linkNode.clientWidth}px` : '';
if (horizontalAnchor) {
scrollIntoView(linkNode, {
scrollMode: 'if-needed',
block: 'nearest'
});
}
}
};
const getInternalCurrentAnchor = (_links, _offsetTop = 0, _bounds = 5) => {
const linkSections = [];
const container = getCurrentContainer();
_links.forEach(link => {
const sharpLinkMatch = sharpMatcherRegex.exec(link === null || link === void 0 ? void 0 : link.toString());
if (!sharpLinkMatch) {
return;
}
const target = document.getElementById(sharpLinkMatch[1]);
if (target) {
const top = getOffsetTop(target, container);
if (top <= _offsetTop + _bounds) {
linkSections.push({
link,
top
});
}
}
});
if (linkSections.length) {
const maxSection = linkSections.reduce((prev, curr) => curr.top > prev.top ? curr : prev);
return maxSection.link;
}
return '';
};
const setCurrentActiveLink = useEvent(link => {
// FIXME: Seems a bug since this compare is not equals
// `activeLinkRef` is parsed value which will always trigger `onChange` event.
if (activeLinkRef.current === link) {
return;
}
// https://github.com/ant-design/ant-design/issues/30584
const newLink = typeof getCurrentAnchor === 'function' ? getCurrentAnchor(link) : link;
setActiveLink(newLink);
activeLinkRef.current = newLink;
// onChange should respect the original link (which may caused by
// window scroll or user click), not the new link
onChange === null || onChange === void 0 ? void 0 : onChange(link);
});
const handleScroll = React.useCallback(() => {
if (animating.current) {
return;
}
const currentActiveLink = getInternalCurrentAnchor(links, targetOffset !== undefined ? targetOffset : offsetTop || 0, bounds);
setCurrentActiveLink(currentActiveLink);
}, [links, targetOffset, offsetTop, bounds]);
const handleScrollTo = React.useCallback(link => {
setCurrentActiveLink(link);
const sharpLinkMatch = sharpMatcherRegex.exec(link);
if (!sharpLinkMatch) {
return;
}
const targetElement = document.getElementById(sharpLinkMatch[1]);
if (!targetElement) {
return;
}
const container = getCurrentContainer();
const scrollTop = getScroll(container);
const eleOffsetTop = getOffsetTop(targetElement, container);
let y = scrollTop + eleOffsetTop;
y -= targetOffset !== undefined ? targetOffset : offsetTop || 0;
animating.current = true;
scrollTo(y, {
getContainer: getCurrentContainer,
callback() {
animating.current = false;
}
});
}, [targetOffset, offsetTop]);
const wrapperClass = classNames(hashId, cssVarCls, rootCls, rootClassName, `${prefixCls}-wrapper`, {
[`${prefixCls}-wrapper-horizontal`]: anchorDirection === 'horizontal',
[`${prefixCls}-rtl`]: direction === 'rtl'
}, className, anchorClassName);
const anchorClass = classNames(prefixCls, {
[`${prefixCls}-fixed`]: !affix && !showInkInFixed
});
const inkClass = classNames(`${prefixCls}-ink`, {
[`${prefixCls}-ink-visible`]: activeLink
});
const wrapperStyle = Object.assign(Object.assign({
maxHeight: offsetTop ? `calc(100vh - ${offsetTop}px)` : '100vh'
}, anchorStyle), style);
const createNestedLink = options => Array.isArray(options) ? options.map(item => (/*#__PURE__*/React.createElement(AnchorLink, Object.assign({
replace: replace
}, item, {
key: item.key
}), anchorDirection === 'vertical' && createNestedLink(item.children)))) : null;
const anchorContent = /*#__PURE__*/React.createElement("div", {
ref: wrapperRef,
className: wrapperClass,
style: wrapperStyle
}, /*#__PURE__*/React.createElement("div", {
className: anchorClass
}, /*#__PURE__*/React.createElement("span", {
className: inkClass,
ref: spanLinkNode
}), 'items' in props ? createNestedLink(items) : children));
React.useEffect(() => {
const scrollContainer = getCurrentContainer();
handleScroll();
scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.addEventListener('scroll', handleScroll);
return () => {
scrollContainer === null || scrollContainer === void 0 ? void 0 : scrollContainer.removeEventListener('scroll', handleScroll);
};
}, [dependencyListItem]);
React.useEffect(() => {
if (typeof getCurrentAnchor === 'function') {
setCurrentActiveLink(getCurrentAnchor(activeLinkRef.current || ''));
}
}, [getCurrentAnchor]);
React.useEffect(() => {
updateInk();
}, [anchorDirection, getCurrentAnchor, dependencyListItem, activeLink]);
const memoizedContextValue = React.useMemo(() => ({
registerLink,
unregisterLink,
scrollTo: handleScrollTo,
activeLink,
onClick,
direction: anchorDirection
}), [activeLink, onClick, handleScrollTo, anchorDirection]);
const affixProps = affix && typeof affix === 'object' ? affix : undefined;
return wrapCSSVar(/*#__PURE__*/React.createElement(AnchorContext.Provider, {
value: memoizedContextValue
}, affix ? (/*#__PURE__*/React.createElement(Affix, Object.assign({
offsetTop: offsetTop,
target: getCurrentContainer
}, affixProps), anchorContent)) : anchorContent));
};
if (process.env.NODE_ENV !== 'production') {
Anchor.displayName = 'Anchor';
}
export default Anchor;

14
node_modules/antd/es/anchor/AnchorLink.d.ts generated vendored Normal file
View File

@@ -0,0 +1,14 @@
import * as React from 'react';
export interface AnchorLinkBaseProps {
prefixCls?: string;
href: string;
target?: string;
title: React.ReactNode;
className?: string;
replace?: boolean;
}
export interface AnchorLinkProps extends AnchorLinkBaseProps {
children?: React.ReactNode;
}
declare const AnchorLink: React.FC<AnchorLinkProps>;
export default AnchorLink;

83
node_modules/antd/es/anchor/AnchorLink.js generated vendored Normal file
View File

@@ -0,0 +1,83 @@
"use client";
import * as React from 'react';
import classNames from 'classnames';
import { devUseWarning } from '../_util/warning';
import { ConfigContext } from '../config-provider';
import AnchorContext from './context';
const AnchorLink = props => {
const {
href,
title,
prefixCls: customizePrefixCls,
children,
className,
target,
replace
} = props;
const context = React.useContext(AnchorContext);
const {
registerLink,
unregisterLink,
scrollTo,
onClick,
activeLink,
direction
} = context || {};
React.useEffect(() => {
registerLink === null || registerLink === void 0 ? void 0 : registerLink(href);
return () => {
unregisterLink === null || unregisterLink === void 0 ? void 0 : unregisterLink(href);
};
}, [href]);
const handleClick = e => {
onClick === null || onClick === void 0 ? void 0 : onClick(e, {
title,
href
});
scrollTo === null || scrollTo === void 0 ? void 0 : scrollTo(href);
// Support clicking on an anchor does not record history.
if (e.defaultPrevented) {
return;
}
const isExternalLink = href.startsWith('http://') || href.startsWith('https://');
// Support external link
if (isExternalLink) {
if (replace) {
e.preventDefault();
window.location.replace(href);
}
return;
}
// Handling internal anchor link
e.preventDefault();
const historyMethod = replace ? 'replaceState' : 'pushState';
window.history[historyMethod](null, '', href);
};
// =================== Warning =====================
if (process.env.NODE_ENV !== 'production') {
const warning = devUseWarning('Anchor.Link');
process.env.NODE_ENV !== "production" ? warning(!children || direction !== 'horizontal', 'usage', '`Anchor.Link children` is not supported when `Anchor` direction is horizontal') : void 0;
}
const {
getPrefixCls
} = React.useContext(ConfigContext);
const prefixCls = getPrefixCls('anchor', customizePrefixCls);
const active = activeLink === href;
const wrapperClassName = classNames(`${prefixCls}-link`, className, {
[`${prefixCls}-link-active`]: active
});
const titleClassName = classNames(`${prefixCls}-link-title`, {
[`${prefixCls}-link-title-active`]: active
});
return /*#__PURE__*/React.createElement("div", {
className: wrapperClassName
}, /*#__PURE__*/React.createElement("a", {
className: titleClassName,
href: href,
title: typeof title === 'string' ? title : '',
target: target,
onClick: handleClick
}, title), direction !== 'horizontal' ? children : null);
};
export default AnchorLink;

4
node_modules/antd/es/anchor/context.d.ts generated vendored Normal file
View File

@@ -0,0 +1,4 @@
import * as React from 'react';
import type { AntAnchor } from './Anchor';
declare const AnchorContext: React.Context<AntAnchor | undefined>;
export default AnchorContext;

3
node_modules/antd/es/anchor/context.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
import * as React from 'react';
const AnchorContext = /*#__PURE__*/React.createContext(undefined);
export default AnchorContext;

10
node_modules/antd/es/anchor/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import InternalAnchor from './Anchor';
import AnchorLink from './AnchorLink';
export type { AnchorProps } from './Anchor';
export type { AnchorLinkProps } from './AnchorLink';
type InternalAnchorType = typeof InternalAnchor;
type CompoundedComponent = InternalAnchorType & {
Link: typeof AnchorLink;
};
declare const Anchor: CompoundedComponent;
export default Anchor;

7
node_modules/antd/es/anchor/index.js generated vendored Normal file
View File

@@ -0,0 +1,7 @@
"use client";
import InternalAnchor from './Anchor';
import AnchorLink from './AnchorLink';
const Anchor = InternalAnchor;
Anchor.Link = AnchorLink;
export default Anchor;

16
node_modules/antd/es/anchor/style/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,16 @@
import type { GetDefaultToken } from '../../theme/internal';
export interface ComponentToken {
/**
* @desc 链接纵向内间距
* @descEN Vertical padding of link
*/
linkPaddingBlock: number;
/**
* @desc 链接横向内间距
* @descEN Horizontal padding of link
*/
linkPaddingInlineStart: number;
}
export declare const prepareComponentToken: GetDefaultToken<'Anchor'>;
declare const _default: (prefixCls: string, rootCls?: string) => readonly [(node: React.ReactElement) => React.ReactElement, string, string];
export default _default;

142
node_modules/antd/es/anchor/style/index.js generated vendored Normal file
View File

@@ -0,0 +1,142 @@
import { unit } from '@ant-design/cssinjs';
import { resetComponent, textEllipsis } from '../../style';
import { genStyleHooks, mergeToken } from '../../theme/internal';
// ============================== Shared ==============================
const genSharedAnchorStyle = token => {
const {
componentCls,
holderOffsetBlock,
motionDurationSlow,
lineWidthBold,
colorPrimary,
lineType,
colorSplit,
calc
} = token;
return {
[`${componentCls}-wrapper`]: {
marginBlockStart: calc(holderOffsetBlock).mul(-1).equal(),
paddingBlockStart: holderOffsetBlock,
// delete overflow: auto
// overflow: 'auto',
[componentCls]: Object.assign(Object.assign({}, resetComponent(token)), {
position: 'relative',
paddingInlineStart: lineWidthBold,
[`${componentCls}-link`]: {
paddingBlock: token.linkPaddingBlock,
paddingInline: `${unit(token.linkPaddingInlineStart)} 0`,
'&-title': Object.assign(Object.assign({}, textEllipsis), {
position: 'relative',
display: 'block',
marginBlockEnd: token.anchorTitleBlock,
color: token.colorText,
transition: `all ${token.motionDurationSlow}`,
'&:only-child': {
marginBlockEnd: 0
}
}),
[`&-active > ${componentCls}-link-title`]: {
color: token.colorPrimary
},
// link link
[`${componentCls}-link`]: {
paddingBlock: token.anchorPaddingBlockSecondary
}
}
}),
[`&:not(${componentCls}-wrapper-horizontal)`]: {
[componentCls]: {
'&::before': {
position: 'absolute',
insetInlineStart: 0,
top: 0,
height: '100%',
borderInlineStart: `${unit(lineWidthBold)} ${lineType} ${colorSplit}`,
content: '" "'
},
[`${componentCls}-ink`]: {
position: 'absolute',
insetInlineStart: 0,
display: 'none',
transform: 'translateY(-50%)',
transition: `top ${motionDurationSlow} ease-in-out`,
width: lineWidthBold,
backgroundColor: colorPrimary,
[`&${componentCls}-ink-visible`]: {
display: 'inline-block'
}
}
}
},
[`${componentCls}-fixed ${componentCls}-ink ${componentCls}-ink`]: {
display: 'none'
}
}
};
};
const genSharedAnchorHorizontalStyle = token => {
const {
componentCls,
motionDurationSlow,
lineWidthBold,
colorPrimary
} = token;
return {
[`${componentCls}-wrapper-horizontal`]: {
position: 'relative',
'&::before': {
position: 'absolute',
left: {
_skip_check_: true,
value: 0
},
right: {
_skip_check_: true,
value: 0
},
bottom: 0,
borderBottom: `${unit(token.lineWidth)} ${token.lineType} ${token.colorSplit}`,
content: '" "'
},
[componentCls]: {
overflowX: 'scroll',
position: 'relative',
display: 'flex',
scrollbarWidth: 'none' /* Firefox */,
'&::-webkit-scrollbar': {
display: 'none' /* Safari and Chrome */
},
[`${componentCls}-link:first-of-type`]: {
paddingInline: 0
},
[`${componentCls}-ink`]: {
position: 'absolute',
bottom: 0,
transition: `left ${motionDurationSlow} ease-in-out, width ${motionDurationSlow} ease-in-out`,
height: lineWidthBold,
backgroundColor: colorPrimary
}
}
}
};
};
export const prepareComponentToken = token => ({
linkPaddingBlock: token.paddingXXS,
linkPaddingInlineStart: token.padding
});
// ============================== Export ==============================
export default genStyleHooks('Anchor', token => {
const {
fontSize,
fontSizeLG,
paddingXXS,
calc
} = token;
const anchorToken = mergeToken(token, {
holderOffsetBlock: paddingXXS,
anchorPaddingBlockSecondary: calc(paddingXXS).div(2).equal(),
anchorTitleBlock: calc(fontSize).div(14).mul(3).equal(),
anchorBallSize: calc(fontSizeLG).div(2).equal()
});
return [genSharedAnchorStyle(anchorToken), genSharedAnchorHorizontalStyle(anchorToken)];
}, prepareComponentToken);