Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Branch] chore(merge): Merge master branch #720

Merged
merged 44 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
b9387ea
improve(design): Upgrade @oceanbase/aliyun-theme and update less vari…
dengfuping Aug 8, 2024
c1d8bc8
chore(deps): Upgrade all deps to fix ci
dengfuping Aug 8, 2024
8fd1b2c
fix(ci): TS error
dengfuping Aug 8, 2024
745a76d
chore: Remove husky pre-commit script
dengfuping Aug 8, 2024
1802623
fix(test): Update snapshots
dengfuping Aug 8, 2024
d0c9b0f
Merge pull request #668 from oceanbase/dengfuping-dev
dengfuping Aug 8, 2024
bf069b2
feat(docs): Add @oceanbase/ui and vite docs
dengfuping Aug 8, 2024
4d5ac55
Merge pull request #673 from oceanbase/dengfuping-dev
dengfuping Aug 8, 2024
b3335c6
feat(docs): Add spec and blog
dengfuping Aug 24, 2024
0a757c9
Merge pull request #682 from oceanbase/dengfuping-dev
dengfuping Aug 29, 2024
fc210fe
improve(site): Docs max-width 1280px => 1100px
dengfuping Aug 29, 2024
7721755
Merge pull request #683 from oceanbase/dengfuping-dev
dengfuping Aug 29, 2024
a4a159b
fix(charts): Remove tooltip `white-space: nowrap` style
dengfuping Aug 29, 2024
a356bdb
Merge pull request #684 from oceanbase/dengfuping-dev
dengfuping Aug 29, 2024
9a2ffcd
fix(codemod): normal function and anonymous function should use token…
dengfuping Aug 29, 2024
1f1ba29
chore(deps-dev): Bump webpack from 5.93.0 to 5.94.0
dependabot[bot] Aug 31, 2024
474fbfa
fix(docs): typo in README and Typography
dengfuping Sep 2, 2024
183b77d
Merge pull request #685 from oceanbase/dengfuping-dev
dengfuping Sep 2, 2024
38979a7
Merge pull request #690 from oceanbase/dengfuping-dev
dengfuping Sep 2, 2024
4f7765d
improve(docs): Style for spec and blog
dengfuping Sep 2, 2024
b4238c0
Merge pull request #691 from oceanbase/dengfuping-dev
dengfuping Sep 2, 2024
43d65b6
demo(design): Add remote search demo for Select
dengfuping Sep 2, 2024
a963b6d
Merge pull request #692 from oceanbase/dengfuping-dev
dengfuping Sep 2, 2024
6c4f640
Merge pull request #689 from oceanbase/dependabot/npm_and_yarn/webpac…
dengfuping Sep 3, 2024
730a812
improve(docs): Style for spec and blog
dengfuping Sep 3, 2024
59707ad
Merge pull request #698 from oceanbase/dengfuping-dev
dengfuping Sep 3, 2024
a083653
fix(build): SelectProps type error
dengfuping Sep 3, 2024
4c71fe5
fix: correct `preview-build` comment (#686)
DemoYeti Sep 3, 2024
3d6ccb0
Merge pull request #699 from oceanbase/dengfuping-dev
dengfuping Sep 3, 2024
ad48a78
improve(docs): Style for product graphic
dengfuping Sep 4, 2024
7628529
Merge pull request #700 from oceanbase/dengfuping-dev
dengfuping Sep 4, 2024
34ca460
feat(docs): Add theme token API table
dengfuping Sep 4, 2024
2d05b36
Merge pull request #701 from oceanbase/dengfuping-dev-token
dengfuping Sep 4, 2024
a06a704
fix(Tag): The ellipsis with icons should work (#687)
linhf123 Sep 5, 2024
a9d0f4f
feat(codemod): Add techui-and-pro-components-to-oceanbase-ui transformer
dengfuping Sep 5, 2024
450edc0
feat(codemod): Add techui-and-pro-components-to-oceanbase-ui transfor…
dengfuping Sep 5, 2024
0555984
improve(docs): Style for loading, chart-color and chart-semantic-pale…
dengfuping Sep 5, 2024
802ba9b
Merge branch 'master' of github.com:oceanbase/oceanbase-design into d…
dengfuping Sep 5, 2024
9e39b2c
improve(docs): Style for loading, chart-color and chart-semantic-pale…
dengfuping Sep 5, 2024
4c8ff1a
Merge branch 'master' of github.com:oceanbase/oceanbase-design into d…
dengfuping Sep 10, 2024
a2001cf
feat(codemod): Add more migrate objects for pro-components
dengfuping Sep 10, 2024
18f13b5
Merge pull request #718 from oceanbase/dengfuping-dev
dengfuping Sep 11, 2024
b5fd779
feat(ui): Action.Group add buttonSize prop and Action.Button add size…
dengfuping Sep 11, 2024
54713ca
Merge pull request #719 from oceanbase/dengfuping-dev
dengfuping Sep 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 112 additions & 0 deletions .dumi/rehypePlugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import assert from 'assert';
import type { HastRoot, UnifiedTransformer } from 'dumi';
import { unistUtilVisit } from 'dumi';

/**
* plugin for modify hast tree when docs compiling
*/
function rehypeAntd(): UnifiedTransformer<HastRoot> {
return (tree, vFile) => {
const { filename } = vFile.data.frontmatter as any;

unistUtilVisit.visit(tree, 'element', (node, i, parent) => {
if (node.tagName === 'DumiDemoGrid') {
// replace DumiDemoGrid to DemoWrapper, to implement demo toolbar
node.tagName = 'DemoWrapper';
} else if (node.tagName === 'ResourceCards') {
const propNames = ['title', 'cover', 'description', 'src', 'official'];
const contentNode = node.children[0];

assert(
contentNode.type === 'text',
`ResourceCards content must be plain text!\nat ${filename}`
);

// clear children
node.children = [];

// generate JSX props
(node as any).JSXAttributes = [
{
type: 'JSXAttribute',
name: 'resources',
value: JSON.stringify(
contentNode.value
.trim()
.split('\n')
.reduce<any>((acc, cur) => {
// match text from ` - 桌面组件 Sketch 模板包`
const [, isProp, val] = cur.match(/(\s+)?-\s(.+)/)!;

if (!isProp) {
// create items when match title
acc.push({ [propNames[0]]: val });
} else {
// add props when match others
const prev = acc[acc.length - 1];

prev[propNames[Object.keys(prev).length]] = val;
}

return acc;
}, [])
),
},
];
} else if (
node.type === 'element' &&
node.tagName === 'Table' &&
(/^packages\/design/.test(filename) ||
/^packages\/ui/.test(filename) ||
/^packages\/charts/.test(filename))
) {
if (!node.properties) return;
node.properties.className ??= [];
(node.properties.className as string[]).push('component-api-table');
} else if (node.type === 'element' && (node.tagName === 'Link' || node.tagName === 'a')) {
const href = (node.properties?.href || node.properties?.to) as string;
// 外部链接新开标签页跳转
if (href?.startsWith('http')) {
node.properties!.target = '_blank';
}
// node.properties!.sourceType = tagName;
// node.tagName = 'LocaleLink';
}
// else if (node.type === 'element' && node.tagName === 'video') {
// node.tagName = 'VideoPlayer';
// }
else if (node.tagName === 'SourceCode') {
const { lang } = node.properties!;

if (typeof lang === 'string' && lang.startsWith('sandpack')) {
const code = (node.children[0] as any).value as string;
const configRegx = /^const sandpackConfig = ([\S\s]*?});/;
const [configString] = code.match(configRegx) || [];
/* biome-ignore lint/security/noGlobalEval: used in documentation */ /* eslint-disable-next-line no-eval */
const config = configString && eval(`(${configString.replace(configRegx, '$1')})`);
Object.keys(config || {}).forEach(key => {
if (typeof config[key] === 'object') {
config[key] = JSON.stringify(config[key]);
}
});

parent!.children.splice(i!, 1, {
type: 'element',
tagName: 'Sandpack',
properties: {
...config,
},
children: [
{
type: 'text',
value: code.replace(configRegx, '').trim(),
},
],
});
}
}
});
};
}

export default rehypeAntd;
15 changes: 15 additions & 0 deletions .dumi/remarkPlugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { unistUtilVisit } from 'dumi';
import type { UnifiedTransformer } from 'dumi';

function remarkMeta(): UnifiedTransformer<any> {
return (tree, vFile) => {
// read frontmatter
unistUtilVisit.visit(tree, 'yaml', (node) => {
if (!/(^|[\n\r])description:/.test(node.value)) {
(vFile.data.frontmatter as any).__autoDescription = true;
}
});
};
}

export default remarkMeta;
22 changes: 22 additions & 0 deletions .dumi/theme/SiteThemeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,28 @@ import SiteContext from './slots/SiteContext';
import zhCN from '../../packages/design/src/locale/zh-CN';
import useSiteToken from '../hooks/useSiteToken';

interface NewToken {
bannerHeight: number;
headerHeight: number;
menuItemBorder: number;
mobileMaxWidth: number;
siteMarkdownCodeBg: string;
antCls: string;
iconCls: string;
marginFarXS: number;
marginFarSM: number;
marginFar: number;
codeFamily: string;
contentMarginTop: number;
anchorTop: number;
}

// 通过给 antd-style 扩展 CustomToken 对象类型定义,可以为 useTheme 中增加相应的 token 对象
declare module 'antd-style' {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface CustomToken extends NewToken {}
}

const SiteThemeProvider: FC<
ThemeProviderProps<any> & {
theme: ThemeConfig;
Expand Down
25 changes: 25 additions & 0 deletions .dumi/theme/builtins/Caution.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import { css } from '@emotion/react';
import useSiteToken from '../../hooks/useSiteToken';

export interface CautionProps {
title: React.ReactNode;
filename?: string;
}

const useStyle = () => {
const { token } = useSiteToken();

return {
do: css`
font-size: 20px;
color: ${token.colorWarningText};
`,
};
};

export default function Caution({}: CautionProps) {
const styles = useStyle();

return <div css={styles.do}>Caution</div>;
}
45 changes: 45 additions & 0 deletions .dumi/theme/builtins/ColorChunk/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import * as React from 'react';
import type { ColorInput } from '@ctrl/tinycolor';
import { TinyColor } from '@ctrl/tinycolor';
import { createStyles } from 'antd-style';

const useStyle = createStyles(({ token, css }) => ({
codeSpan: css`
padding: 0.2em 0.4em;
font-size: 0.9em;
background: ${token.siteMarkdownCodeBg};
border-radius: ${token.borderRadius}px;
font-family: monospace;
`,
dot: css`
display: inline-block;
width: 6px;
height: 6px;
border-radius: 50%;
margin-inline-end: ${token.marginXXS}px;
border: 1px solid ${token.colorSplit};
`,
}));

interface ColorChunkProps {
value?: ColorInput;
}

const ColorChunk: React.FC<React.PropsWithChildren<ColorChunkProps>> = (props) => {
const { styles } = useStyle();
const { value, children } = props;

const dotColor = React.useMemo(() => {
const _color = new TinyColor(value).toHex8String();
return _color.endsWith('ff') ? _color.slice(0, -2) : _color;
}, [value]);

return (
<span className={styles.codeSpan}>
<span className={styles.dot} style={{ backgroundColor: dotColor }} />
{children ?? dotColor}
</span>
);
};

export default ColorChunk;
3 changes: 1 addition & 2 deletions .dumi/theme/builtins/DemoWrapper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const DemoWrapper: typeof DumiDemoGrid = ({ items }) => {
(acc, item) => {
const { previewerProps } = item;
const { debug } = previewerProps;
console.log(debug);

if (debug && !showDebug) return acc;

Expand All @@ -37,8 +38,6 @@ const DemoWrapper: typeof DumiDemoGrid = ({ items }) => {
previewerProps: {
...previewerProps,
expand: expandAll,
// always override debug property, because dumi will hide debug demo in production
debug: false,
/**
* extra marker for the original debug
*/
Expand Down
25 changes: 25 additions & 0 deletions .dumi/theme/builtins/Do.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import { css } from '@emotion/react';
import useSiteToken from '../../hooks/useSiteToken';

export interface DoProps {
title: React.ReactNode;
filename?: string;
}

const useStyle = () => {
const { token } = useSiteToken();

return {
do: css`
font-size: 20px;
color: ${token.colorSuccessText};
`,
};
};

export default function Do({}: DoProps) {
const styles = useStyle();

return <div css={styles.do}>Do</div>;
}
25 changes: 25 additions & 0 deletions .dumi/theme/builtins/Donot.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import { css } from '@emotion/react';
import useSiteToken from '../../hooks/useSiteToken';

export interface DonotProps {
title: React.ReactNode;
filename?: string;
}

const useStyle = () => {
const { token } = useSiteToken();

return {
do: css`
font-size: 20px;
color: ${token.colorErrorText};
`,
};
};

export default function Do({}: DonotProps) {
const styles = useStyle();

return <div css={styles.do}>Don't</div>;
}
Loading
Loading