Skip to content

Commit

Permalink
chore: auto merge branches (ant-design#49564)
Browse files Browse the repository at this point in the history
chore: merge master into feature
  • Loading branch information
github-actions[bot] authored Jun 23, 2024
2 parents 05d107c + 1a5308a commit ee40b3d
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 81 deletions.
47 changes: 21 additions & 26 deletions .dumi/theme/builtins/DemoWrapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,27 @@ const DemoWrapper: typeof DumiDemoGrid = ({ items }) => {

const demos = React.useMemo(
() =>
items.reduce(
(acc, item) => {
const { previewerProps } = item;
const { debug } = previewerProps;

if (debug && !showDebug) {
return acc;
}

return acc.concat({
...item,
previewerProps: {
...previewerProps,
expand: expandAll,
// always override debug property, because dumi will hide debug demo in production
debug: false,
/**
* antd extra marker for the original debug
* @see https://github.com/ant-design/ant-design/pull/40130#issuecomment-1380208762
*/
originDebug: debug,
},
});
},
[] as typeof items,
),
items.reduce<typeof items>((acc, item) => {
const { previewerProps } = item;
const { debug } = previewerProps;
if (debug && !showDebug) {
return acc;
}
return acc.concat({
...item,
previewerProps: {
...previewerProps,
expand: expandAll,
// always override debug property, because dumi will hide debug demo in production
debug: false,
/**
* antd extra marker for the original debug
* @see https://github.com/ant-design/ant-design/pull/40130#issuecomment-1380208762
*/
originDebug: debug,
},
});
}, []),
[expandAll, showDebug],
);

Expand Down
2 changes: 1 addition & 1 deletion components/carousel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const Carousel = React.forwardRef<CarouselRef, CarouselProps>((props, ref) => {
[slickRef.current],
);

const prevCount = React.useRef(React.Children.count(props.children));
const prevCount = React.useRef<number>(React.Children.count(props.children));

React.useEffect(() => {
if (prevCount.current !== React.Children.count(props.children)) {
Expand Down
2 changes: 1 addition & 1 deletion components/menu/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const InternalMenu = forwardRef<RcMenuRef, InternalMenuProps>((props, ref) => {
return cloneElement(mergedIcon, {
className: classNames(
`${prefixCls}-submenu-expand-icon`,
React.isValidElement(mergedIcon) ? mergedIcon.props?.className : undefined,
React.isValidElement<any>(mergedIcon) ? mergedIcon.props?.className : undefined,
),
});
}, [expandIcon, overrideObj?.expandIcon, menu?.expandIcon, prefixCls]);
Expand Down
4 changes: 2 additions & 2 deletions components/modal/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ let runtimeLocale: ModalLocale = {
let localeList: ModalLocale[] = [];

const generateLocale = () =>
localeList.reduce(
localeList.reduce<ModalLocale>(
(merged, locale) => ({ ...merged, ...locale }),
defaultLocale.Modal as ModalLocale,
defaultLocale.Modal!,
);

export function changeConfirmLocale(newLocale?: ModalLocale) {
Expand Down
5 changes: 3 additions & 2 deletions components/tabs/demo/extra.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ const App: React.FC = () => {
const [position, setPosition] = useState<PositionType[]>(['left', 'right']);

const slot = useMemo(() => {
if (position.length === 0) return null;

if (position.length === 0) {
return null;
}
return position.reduce(
(acc, direction) => ({ ...acc, [direction]: OperationsSlot[direction] }),
{},
Expand Down
27 changes: 7 additions & 20 deletions components/theme/themes/dark/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { generate } from '@ant-design/colors';
import type { DerivativeFunc } from '@ant-design/cssinjs';

import type {
ColorPalettes,
LegacyColorPalettes,
MapToken,
PresetColorType,
SeedToken,
} from '../../interface';
import type { MapToken, PresetColorType, SeedToken } from '../../interface';
import defaultAlgorithm from '../default';
import { defaultPresetColors } from '../seed';
import genColorMapToken from '../shared/genColorMapToken';
Expand All @@ -17,24 +11,17 @@ const derivative: DerivativeFunc<SeedToken, MapToken> = (token, mapToken) => {
const colorPalettes = Object.keys(defaultPresetColors)
.map((colorKey) => {
const colors = generate(token[colorKey as keyof PresetColorType], { theme: 'dark' });

return new Array(10).fill(1).reduce((prev, _, i) => {
prev[`${colorKey}-${i + 1}`] = colors[i];
prev[`${colorKey}${i + 1}`] = colors[i];
return prev;
}, {}) as ColorPalettes & LegacyColorPalettes;
}, {});
})
.reduce(
(prev, cur) => {
// biome-ignore lint/style/noParameterAssign: it is a reduce
prev = {
...prev,
...cur,
};
return prev;
},
{} as ColorPalettes & LegacyColorPalettes,
);
.reduce((prev, cur) => {
// biome-ignore lint/style/noParameterAssign: it is a reduce
prev = { ...prev, ...cur };
return prev;
}, {});

const mergedMapToken = mapToken ?? defaultAlgorithm(token);

Expand Down
27 changes: 7 additions & 20 deletions components/theme/themes/default/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import { generate } from '@ant-design/colors';

import type {
ColorPalettes,
LegacyColorPalettes,
MapToken,
PresetColorType,
SeedToken,
} from '../../interface';
import type { MapToken, PresetColorType, SeedToken } from '../../interface';
import { defaultPresetColors } from '../seed';
import genColorMapToken from '../shared/genColorMapToken';
import genCommonMapToken from '../shared/genCommonMapToken';
Expand All @@ -19,24 +13,17 @@ export default function derivative(token: SeedToken): MapToken {
const colorPalettes = Object.keys(defaultPresetColors)
.map((colorKey) => {
const colors = generate(token[colorKey as keyof PresetColorType]);

return new Array(10).fill(1).reduce((prev, _, i) => {
prev[`${colorKey}-${i + 1}`] = colors[i];
prev[`${colorKey}${i + 1}`] = colors[i];
return prev;
}, {}) as ColorPalettes & LegacyColorPalettes;
}, {});
})
.reduce(
(prev, cur) => {
// biome-ignore lint/style/noParameterAssign: it is a reduce
prev = {
...prev,
...cur,
};
return prev;
},
{} as ColorPalettes & LegacyColorPalettes,
);
.reduce((prev, cur) => {
// biome-ignore lint/style/noParameterAssign: it is a reduce
prev = { ...prev, ...cur };
return prev;
}, {});

return {
...token,
Expand Down
5 changes: 2 additions & 3 deletions components/theme/util/genPresetColor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ export default function genPresetColor<Token extends TokenWithCommonCls<AliasTok
token: Token,
genCss: GenCSS,
): CSSObject {
return PresetColors.reduce((prev: CSSObject, colorKey: PresetColorKey) => {
return PresetColors.reduce<CSSObject>((prev: CSSObject, colorKey: PresetColorKey) => {
const lightColor = token[`${colorKey}1`];
const lightBorderColor = token[`${colorKey}3`];
const darkColor = token[`${colorKey}6`];
const textColor = token[`${colorKey}7`];

return {
...prev,
...genCss(colorKey, { lightColor, lightBorderColor, darkColor, textColor }),
};
}, {} as CSSObject);
}, {});
}
12 changes: 10 additions & 2 deletions contributors.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@
"Chuck",
"Chuns Chen",
"Claudio Restifo",
"CodeCompilerConduct",
"Cody Chan",
"Cole",
"Colton Pierson",
Expand Down Expand Up @@ -451,6 +452,7 @@
"Jimmy",
"Jin ZHANG",
"JinXin",
"Jinbao1001",
"Jing Ma",
"Jingsong Gao",
"Jinke Li",
Expand Down Expand Up @@ -504,6 +506,7 @@
"Kaan KÜÇÜK",
"Kaien Liao",
"Kamal Mahmudi",
"KarelVerschraegen",
"Karott",
"Kasra Bigdeli",
"Katsiaryna Pustakhod",
Expand Down Expand Up @@ -531,6 +534,7 @@
"Kirill Alexander Khalitov",
"Kirill Stiopin",
"Kirk Ross",
"Kiryll Ye",
"Kiyan",
"Knacktus",
"Knut Olav Bøhmer",
Expand Down Expand Up @@ -617,6 +621,7 @@
"Martin Litvaj",
"Martin Novák",
"Mateusz Burzyński",
"Mateusz Wierzbicki",
"Mathew",
"Mathieu Anderson",
"Matias Orellana",
Expand Down Expand Up @@ -802,7 +807,7 @@
"Roman Soroka",
"Ron Šmeral",
"Rongjian Zhang",
"Roxannej",
"RoxanneF",
"Rrrandom",
"RunningCoderLee",
"Ryan Lee",
Expand Down Expand Up @@ -1166,6 +1171,7 @@
"douxc",
"dpyzo0o",
"dujun",
"duqigit",
"duzliang",
"edc-hui",
"edgji",
Expand Down Expand Up @@ -1302,6 +1308,7 @@
"liekkas",
"lihao",
"lihqi",
"lijianan",
"lilun",
"limingxin",
"linqiqi077",
Expand All @@ -1327,6 +1334,7 @@
"lyon.han",
"mArker",
"maks",
"mansion-sun",
"maomao",
"max",
"maximest-pierre",
Expand Down Expand Up @@ -1473,6 +1481,7 @@
"whtang906",
"whwangms",
"willc001",
"winches",
"wizawu",
"wleven",
"wonyun",
Expand Down Expand Up @@ -1630,7 +1639,6 @@
"松子",
"林煌东",
"柚子男",
"栗嘉男",
"栗康",
"梓安",
"沐霖",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@
"tar-fs": "^3.0.6",
"terser": "^5.31.1",
"tsx": "4.11.2",
"typedoc": "^0.25.13",
"typescript": "~5.4.5",
"typedoc": "^0.26.0",
"typescript": "~5.5.0",
"vanilla-jsoneditor": "^0.23.7",
"vanilla-tilt": "^1.8.1",
"webpack": "^5.92.0",
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate-token-meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const main = async () => {
}
});

const finalMeta = Object.entries(tokenMeta).reduce((acc, [key, value]) => {
const finalMeta = Object.entries(tokenMeta).reduce<any>((acc, [key, value]) => {
if (key !== 'components') {
(value as any[]).forEach((item) => {
acc.global = acc.global || {};
Expand All @@ -124,7 +124,7 @@ const main = async () => {
acc.components = value;
}
return acc;
}, {} as any);
}, {});

fs.writeJsonSync(output, finalMeta, 'utf8');
// eslint-disable-next-line no-console
Expand Down

0 comments on commit ee40b3d

Please sign in to comment.