Skip to content

Commit

Permalink
Add typedoc internal docs
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeWags committed Mar 12, 2024
1 parent efd419f commit 12be303
Show file tree
Hide file tree
Showing 11 changed files with 111 additions and 218 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,7 @@ sketch
/blob-report/
/playwright/.cache/

# typedoc
/docs/

# End of https://www.toptal.com/developers/gitignore/api/react,node,joed
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"publish-canary": "echo 'Do something'",
"publish-stable": "echo 'Do something'",
"lint": "turbo run lint --parallel --no-cache",
"doc": "typedoc --options typedoc.json"
"doc": "typedoc --options typedoc.json --plugin typedoc-plugin-missing-exports"
},
"devDependencies": {
"@playwright/test": "^1.15.0",
Expand All @@ -30,6 +30,7 @@
"rollup-plugin-postcss": "^4.0.2",
"turbo": "^1.0.24",
"typedoc": "^0.25.12",
"typedoc-plugin-missing-exports": "^2.2.0",
"typescript": "^4.5.5"
},
"prettier": {
Expand Down
47 changes: 3 additions & 44 deletions packages/app/README.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,5 @@
# Getting Started with Create React App
# UpSet 2.0 App Package

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
This package represents the Multinet wrapper around the UpSet react component. This handles any interaction with Multinet as a sort of middleware.

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
Any API calls to Multinet are made from here, and any information regarding UI that is NOT part of the Upset plot is handled and passed on here.
103 changes: 0 additions & 103 deletions packages/core/README.md
Original file line number Diff line number Diff line change
@@ -1,103 +0,0 @@
# TSDX User Guide

Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it.

> This TSDX setup is meant for developing libraries (not apps!) that can be published to NPM. If you’re looking to build a Node app, you could use `ts-node-dev`, plain `ts-node`, or simple `tsc`.
> If you’re new to TypeScript, checkout [this handy cheatsheet](https://devhints.io/typescript)
## Commands

TSDX scaffolds your new library inside `/src`.

To run TSDX, use:

```bash
npm start # or yarn start
```

This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`.

To do a one-off build, use `npm run build` or `yarn build`.

To run tests, use `npm test` or `yarn test`.

## Configuration

Code quality is set up for you with `prettier`, `husky`, and `lint-staged`. Adjust the respective fields in `package.json` accordingly.

### Jest

Jest tests are set up to run with `npm test` or `yarn test`.

### Bundle Analysis

[`size-limit`](https://github.com/ai/size-limit) is set up to calculate the real cost of your library with `npm run size` and visualize the bundle with `npm run analyze`.

#### Setup Files

This is the folder structure we set up for you:

```txt
/src
index.tsx # EDIT THIS
/test
blah.test.tsx # EDIT THIS
.gitignore
package.json
README.md # EDIT THIS
tsconfig.json
```

### Rollup

TSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details.

### TypeScript

`tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`. Adjust according to your needs.

## Continuous Integration

### GitHub Actions

Two actions are added by default:

- `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
- `size` which comments cost comparison of your library on every pull request using [`size-limit`](https://github.com/ai/size-limit)

## Optimizations

Please see the main `tsdx` [optimizations docs](https://github.com/palmerhq/tsdx#optimizations). In particular, know that you can take advantage of development-only optimizations:

```js
// ./types/index.d.ts
declare var __DEV__: boolean;

// inside your code...
if (__DEV__) {
console.log('foo');
}
```

You can also choose to install and use [invariant](https://github.com/palmerhq/tsdx#invariant) and [warning](https://github.com/palmerhq/tsdx#warning) functions.

## Module Formats

CJS, ESModules, and UMD module formats are supported.

The appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found.

## Named Exports

Per Palmer Group guidelines, [always use named exports.](https://github.com/palmerhq/typescript#exports) Code split inside your React app instead of your React library.

## Including Styles

There are many ways to ship styles, including with CSS-in-JS. TSDX has no opinion on this, configure how you like.

For vanilla CSS, you can include it at the root directory and add it to the `files` section in your `package.json`, so that it can be imported separately by your users and run through their bundler's loader.

## Publishing to NPM

We recommend using [np](https://github.com/sindresorhus/np).
46 changes: 19 additions & 27 deletions packages/upset/src/components/Upset.tsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,31 @@
import { Box, ThemeProvider } from '@mui/material';
import { CoreUpsetData, UpsetConfig, DefaultConfig } from '@visdesignlab/upset2-core';
import { UpsetConfig, DefaultConfig } from '@visdesignlab/upset2-core';
import React, { FC, useMemo } from 'react';
import { RecoilRoot } from 'recoil';

import { UpsetActions, UpsetProvenance } from '../provenance';
import defaultTheme from '../utils/theme';
import { Root } from './Root';

export type UpsetProps = {
parentHasHeight?: boolean;
data: CoreUpsetData;
config?: Partial<UpsetConfig>;
loadAttributes?: number;
extProvenance?: {
provenance: UpsetProvenance;
actions: UpsetActions;
};
yOffset?: number;
provVis?: {
open: boolean;
close: () => void;
};
elementSidebar?: {
open: boolean;
close: () => void;
};
altTextSidebar?: {
open: boolean;
close: () => void;
};
generateAltText?: () => Promise<string>;
};
import { UpsetProps } from '../types';

const defaultVisibleSets = 6;

/**
* Renders the Upset component.
*
* @component
* @param {Object} props - The component props.
* @param {Object} props.data - The data for the Upset component.
* @param {boolean} [props.parentHasHeight=false] - Indicates if the parent has a fixed height.
* @param {number} [props.yOffset=0] - The offset from the top of the viewport.
* @param {Object} [props.config={}] - The configuration options for the Upset component.
* @param {number} [props.loadAttributes=0] - The number of attributes to load.
* @param {Object} [props.extProvenance] - The external provenance data.
* @param {Object} [props.provVis] - The provenance visualization options.
* @param {Object} [props.elementSidebar] - The element sidebar options.
* @param {Object} [props.altTextSidebar] - The alternative text sidebar options.
* @param {Function} [props.generateAltText] - The function to generate alternative text.
* @returns {JSX.Element} The rendered Upset component.
*/
export const Upset: FC<UpsetProps> = ({
data,
parentHasHeight = false,
Expand Down
2 changes: 2 additions & 0 deletions packages/upset/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export { Upset } from './components/Upset';

export * from './types';

export * from './provenance/index';

export {
Expand Down
69 changes: 69 additions & 0 deletions packages/upset/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { CoreUpsetData, UpsetConfig } from '@visdesignlab/upset2-core';
import { UpsetProvenance, UpsetActions } from './provenance';

/**
* Represents the props for the Upset component.
*/
export interface UpsetProps {
/**
* Specifies whether the parent component has a fixed height.
*/
parentHasHeight?: boolean;

/**
* The data for the Upset component.
*/
data: CoreUpsetData;

/**
* Optional configuration for the Upset component.
*/
config?: Partial<UpsetConfig>;

/**
* The number of attributes to load.
*/
loadAttributes?: number;

/**
* External provenance information for the Upset component.
*/
extProvenance?: {
provenance: UpsetProvenance;
actions: UpsetActions;
};

/**
* The vertical offset for the Upset component.
*/
yOffset?: number;

/**
* Visualization settings for the provenance component.
*/
provVis?: {
open: boolean;
close: () => void;
};

/**
* Sidebar settings for the element component.
*/
elementSidebar?: {
open: boolean;
close: () => void;
};

/**
* Sidebar settings for the alt text component.
*/
altTextSidebar?: {
open: boolean;
close: () => void;
};

/**
* Generates alternative text for the Upset component.
*/
generateAltText?: () => Promise<string>;
}
11 changes: 0 additions & 11 deletions packages/upset/test/blah.test.tsx

This file was deleted.

1 change: 1 addition & 0 deletions typedoc.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
"$schema": "https://typedoc.org/schema.json",
"includeVersion": true,
"skipErrorChecking": true,
"excludeExternals": true,
}
25 changes: 0 additions & 25 deletions typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,5 @@
"entryPointStrategy": "packages",
"out": "docs",
"exclude": ["**.d.ts**","**.test.tsx**","**.test.ts**","**.spec.tsx**","**.spec","**/node_modules/**"],
"externalPattern": [
"**/node_modules/**"
],
"excludeExternals": true,
"excludeNotDocumented": true,
"excludeNotDocumentedKinds": [
"Module",
"Namespace",
"Enum",
"Variable",
"Function",
"Class",
"Interface",
"Constructor",
"Property",
"Method",
"CallSignature",
"IndexSignature",
"ConstructorSignature",
"Accessor",
"GetSignature",
"SetSignature",
"TypeAlias",
"Reference"
],
"skipErrorChecking": true,
}
Loading

0 comments on commit 12be303

Please sign in to comment.