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

Attempt to fix API docs in #1894 #1897

Draft
wants to merge 1 commit into
base: chrisw--tsc-4
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion packages/visx-annotation/src/components/Annotation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export type AnnotationProps = Pick<AnnotationContextType, 'x' | 'y' | 'dx' | 'dy
children: React.ReactNode;
};

export default function Annotation({ x, y, dx, dy, children }: AnnotationProps) {
export default Annotation;
function Annotation({ x, y, dx, dy, children }: AnnotationProps) {
const value = useMemo(() => ({ x, y, dx, dy }), [x, y, dx, dy]);
return <AnnotationContext.Provider value={value}>{children}</AnnotationContext.Provider>;
}
3 changes: 2 additions & 1 deletion packages/visx-annotation/src/components/CircleSubject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export type CircleSubjectProps = Pick<AnnotationContextType, 'x' | 'y'> & {
radius?: number;
};

export default function CircleSubject({
export default CircleSubject;
function CircleSubject({
className,
x: propsX,
y: propsY,
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-annotation/src/components/Connector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export type ConnectorProps = Pick<AnnotationContextType, 'x' | 'y' | 'dx' | 'dy'
pathProps?: React.SVGProps<SVGPathElement>;
};

export default function Connector({
export default Connector;
function Connector({
className,
x: propsX,
y: propsY,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ const defaultDragHandleProps = {
strokeWidth: 2,
};

export default function EditableAnnotation({
export default EditableAnnotation;
function EditableAnnotation({
canEditLabel = true,
canEditSubject = true,
children,
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-annotation/src/components/HtmlLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ export type HtmlLabelProps = Pick<
/** Optional styles to apply to the HTML container. */
containerStyle?: React.CSSProperties;
};
export default function HtmlLabel({
export default HtmlLabel;
function HtmlLabel({
anchorLineStroke = '#222',
children,
className,
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-annotation/src/components/Label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ function getCompletePadding(padding: LabelProps['backgroundPadding']) {
return { ...DEFAULT_PADDING, ...padding };
}

export default function Label({
export default Label;
function Label({
anchorLineStroke = '#222',
backgroundFill = '#eaeaea',
backgroundPadding,
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-annotation/src/components/LabelAnchorLine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ interface AnchorLineProps {
height: number;
}

export default function AnchorLine({
export default AnchorLine;
function AnchorLine({
anchorLineOrientation,
anchorLineStroke,
verticalAnchor,
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-annotation/src/components/LineSubject.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export type LineSubjectProps = {
max: number;
};

export default function LineSubject({
export default LineSubject;
function LineSubject({
className,
x: propsX,
y: propsY,
Expand Down
49 changes: 28 additions & 21 deletions packages/visx-demo/next.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-disable no-undef */
const path = require('path');
const ReactDocgenTypescriptPlugin = require('react-docgen-typescript-plugin').default;

const isProd = process.env.NODE_ENV === 'production';

Expand All @@ -22,27 +23,33 @@ const nextConfig = {
const babelConfig = config.module.rules[1];
babelConfig.include.push(/visx-.*\/src/);

config.module.rules.push({
test: /\.tsx?$/,
use: [
{
loader: 'react-docgen-typescript-loader',
options: {
// display types from outside a component's source even tho
// we hide these with the propFilter below, if we don't do
// this the component's own props become `any`
tsconfigPath: path.resolve(__dirname, './tsconfig.json'),
// filter props like React.HTMLProps/React.SVGProps
propFilter(prop) {
if (prop.parent) {
return !prop.parent.fileName.includes('node_modules');
}
return true;
},
},
},
],
});
config.plugins.push(
new ReactDocgenTypescriptPlugin({
tsconfigPath: path.resolve(__dirname, './tsconfig.json'),
}),
);

// config.module.rules.push({
// test: /\.tsx?$/,
// use: [
// {
// loader: 'react-docgen-typescript-loader',
// options: {
// // display types from outside a component's source even tho
// // we hide these with the propFilter below, if we don't do
// // this the component's own props become `any`
// tsconfigPath: path.resolve(__dirname, './tsconfig.json'),
// // filter props like React.HTMLProps/React.SVGProps
// propFilter(prop) {
// if (prop.parent) {
// return !prop.parent.fileName.includes('node_modules');
// }
// return true;
// },
// },
// },
// ],
// });

return config;
},
Expand Down
7 changes: 4 additions & 3 deletions packages/visx-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"scripts": {
"build": "NODE_OPTIONS=--openssl-legacy-provider next build && NODE_OPTIONS=--openssl-legacy-provider next export",
"deploy": "rm -rf out && yarn build && cd out && touch .nojekyll && git init && git add . && git commit -m \"Deploy commit\" && git remote add origin [email protected]:airbnb/visx.git && git push -f origin master:gh-pages",
"dev": "NODE_OPTIONS=--openssl-legacy-provider next",
"dev": "NODE_OPTIONS=--openssl-legacy-provider NEXT_PRIVATE_LOCAL_WEBPACK=1 next",
"happo": "happo",
"happo-ci-github-actions": "NODE_OPTIONS=--openssl-legacy-provider happo-ci-github-actions",
"preview": "yarn build && cd ./out && npx serve",
Expand Down Expand Up @@ -86,13 +86,14 @@
"prismjs": "^1.19.0",
"raw-loader": "^4.0.0",
"react": "^19.0.0",
"react-docgen-typescript-loader": "3.7.2",
"react-docgen-typescript-plugin": "^1.0.8",
"react-dom": "^19.0.0",
"react-github-button": "^0.1.10",
"react-markdown": "^4.3.1",
"react-tilt": "^0.1.4",
"recompose": "^0.26.0",
"topojson-client": "^3.0.0"
"topojson-client": "^3.0.0",
"webpack": "^5.0.0"
},
"publishConfig": {
"access": "public"
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-demo/src/components/ApiTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ type Props = {
const alphaSort = (a: PropInfo, b: PropInfo) => a.name.localeCompare(b.name);

/** Renders a list of props for the passed docgenInfo */
export default function ApiTable({ docgenInfo }: Props) {
export default ApiTable;
function ApiTable({ docgenInfo }: Props) {
const { displayName = '' } = docgenInfo;
const anchorId = displayName;

Expand Down
3 changes: 2 additions & 1 deletion packages/visx-demo/src/components/Codeblock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ function Lines({ lines }: { lines: number[] }) {
);
}

export default function ({ children }: { children: string }) {
export default ;
function ({ children }: { children: string }) {
const match = children.match(/\n(?!$)/g);
const linesNum = match ? match.length + 1 : 1;
const lines: number[] = new Array(linesNum + 1).fill(1);
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-demo/src/components/DocPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ type Props = {
readme: string;
};

export default function DocPage({ components, examples, visxPackage, readme }: Props) {
export default DocPage;
function DocPage({ components, examples, visxPackage, readme }: Props) {
return (
<Page wrapper={false} title={`@visx/${visxPackage} documentation`}>
<div className="doc-container">
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-demo/src/components/Gallery/AnnotationTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ const exampleProps = { compact: true };
const exampleRenderer: React.FC<AnnotationProps> = (props) =>
props.width > 0 && props.height > 0 ? <Annotation {...props} /> : null;

export default function AnnotationTile() {
export default AnnotationTile;
function AnnotationTile() {
return (
<GalleryTile<AnnotationProps>
title="Annotation"
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-demo/src/components/Gallery/AreaTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export { default as packageJson } from '../../sandboxes/visx-area/package.json';
const tileStyles = { background };
const detailsStyles = { color: accentColor };

export default function AreaTile() {
export default AreaTile;
function AreaTile() {
return (
<GalleryTile<AreaProps>
title="AreaClosed"
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-demo/src/components/Gallery/AxisTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const tileStyles = { backgroundColor };
const detailsStyles = { color: labelColor };
const exampleProps = { showControls: false };

export default function AxisTile() {
export default AxisTile;
function AxisTile() {
return (
<GalleryTile<AxisProps>
title="Axes & scales"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const tileStyles = { background };
const detailsStyles = { color: green };
const exampleProps = { margin: { top: 20, bottom: 70, left: 50, right: 20 } };

export default function BarGroupHorizontalTile() {
export default BarGroupHorizontalTile;
function BarGroupHorizontalTile() {
return (
<GalleryTile<BarGroupHorizontalProps>
title="Bar Group Horizontal"
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-demo/src/components/Gallery/BarGroupTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export { default as packageJson } from '../../sandboxes/visx-bargroup/package.js
const tileStyles = { background };
const detailsStyles = { color: green };

export default function BarGroupTile() {
export default BarGroupTile;
function BarGroupTile() {
return (
<GalleryTile<BarGroupProps>
title="Bar Group"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export { default as packageJson } from '../../sandboxes/visx-barstack-horizontal
const tileStyles = { background };
const detailsStyles = { color: purple3, zIndex: 1 };

export default function BarStackHorizontalTile() {
export default BarStackHorizontalTile;
function BarStackHorizontalTile() {
return (
<GalleryTile<BarStackHorizontalProps>
title="Bar Stack Horizontal"
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-demo/src/components/Gallery/BarStackTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export { default as packageJson } from '../../sandboxes/visx-barstack/package.js
const tileStyles = { background };
const detailsStyles = { color: purple3, zIndex: 1 };

export default function BarStackTile() {
export default BarStackTile;
function BarStackTile() {
return (
<GalleryTile<BarStackProps>
title="Bar Stack"
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-demo/src/components/Gallery/BarsTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export { default as packageJson } from '../../sandboxes/visx-bars/package.json';
const tileStyles = { background: '#5290e7' };
const detailsStyles = { color: 'rgba(25, 231, 217, 1)' };

export default function BarsTile() {
export default BarsTile;
function BarsTile() {
return (
<GalleryTile<BarsProps>
title="Bars"
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-demo/src/components/Gallery/BrushTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const tileStyles = { border: `1px solid ${accentColor}` };
const detailsStyles = { color: background };
const exampleProps = { compact: true, margin: { top: 10, left: 50, bottom: 60, right: 20 } };

export default function BrushTile() {
export default BrushTile;
function BrushTile() {
return (
<GalleryTile<BrushProps>
title="Brush"
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-demo/src/components/Gallery/ChordTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export { default as packageJson } from '../../sandboxes/visx-chord/package.json'
const tileStyles = { background: '#e4e3d8' };
const detailsStyles = { color: '#111' };

export default function ChordTile() {
export default ChordTile;
function ChordTile() {
return (
<GalleryTile<ChordProps>
title="Chord"
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-demo/src/components/Gallery/CurvesTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const tileStyles = { border: '1px solid lightgray' };
const detailsStyles = { color: '#222' };
const exampleProps = { showControls: false };

export default function CurvesTile() {
export default CurvesTile;
function CurvesTile() {
return (
<GalleryTile<CurveProps>
title="Curves"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const tileStyles = {
};
const detailsStyles = { background: 'white', color: '#5B247A', borderRadius: '0 0 14px 14px' };

export default function DelaunayTriangulationTile() {
export default DelaunayTriangulationTile;
function DelaunayTriangulationTile() {
return (
<GalleryTile<DelaunayTriangulationProps>
title="Delaunay Triangulation"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ const tileStyles = {
};
const detailsStyles = { background: 'white', color: '#eb6d88', borderRadius: '0 0 14px 14px' };

export default function DelaunayTile() {
export default DelaunayTile;
function DelaunayTile() {
return (
<GalleryTile<VoronoiProps>
title="Voronoi Overlay"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const tileStyles = { background };
const detailsStyles = { color: green };
const exampleProps = { margin: { top: 40, left: 0, right: 0, bottom: 90 } };

export default function DendrogramsTile() {
export default DendrogramsTile;
function DendrogramsTile() {
return (
<GalleryTile<DendrogramProps>
title="Dendrograms"
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-demo/src/components/Gallery/DotsTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const tileStyles = { background: '#fd6e7f' };
const detailsStyles = { color: '#f6c431' };
const exampleProps = { showControls: false };

export default function DotsTile() {
export default DotsTile;
function DotsTile() {
return (
<GalleryTile<DotsProps>
title="Dots"
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-demo/src/components/Gallery/DragIITile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ const tileStyles = { background: '#04002b', borderRadius: 14 };
const detailsStyles = { color: '#ff614e', zIndex: 1 };
const exampleProps = { data: drawData };

export default function DragIITile() {
export default DragIITile;
function DragIITile() {
return (
<GalleryTile<DragIIProps>
title="Drag ii"
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-demo/src/components/Gallery/DragITile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export { default as packageJson } from '../../sandboxes/visx-drag-i/package.json
const tileStyles = { background: '#c4c3cb', borderRadius: 14 };
const detailsStyles = { color: '#6437d6', zIndex: 1 };

export default function DragITile() {
export default DragITile;
function DragITile() {
return (
<GalleryTile<DragIProps>
title="Drag i"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export { default as packageJson } from '../../sandboxes/visx-geo-albers-usa/pack
const tileStyles = { background };
const detailsStyles = { color: colors[1] };

export default function GeoAlbersUsaTile() {
export default GeoAlbersUsaTile;
function GeoAlbersUsaTile() {
return (
<GalleryTile<GeoAlbersUsaProps>
title="AlbersUsa"
Expand Down
3 changes: 2 additions & 1 deletion packages/visx-demo/src/components/Gallery/GeoCustomTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const tileStyles = { background };
const detailsStyles = { color: '#019ece' };
const exampleProps = { events: false };

export default function GeoCustomTile() {
export default GeoCustomTile;
function GeoCustomTile() {
return (
<GalleryTile<GeoCustomProps>
title="Custom Projection"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ export { default as packageJson } from '../../sandboxes/visx-geo-mercator/packag
const tileStyles = { background };
const detailsStyles = { color: '#f63a48' };

export default function GeoMercatorTile() {
export default GeoMercatorTile;
function GeoMercatorTile() {
return (
<GalleryTile<GeoMercatorProps>
title="Mercator"
Expand Down
Loading