diff --git a/.gitignore b/.gitignore index e5e9d9fd..f62cca7f 100644 --- a/.gitignore +++ b/.gitignore @@ -157,4 +157,7 @@ sketch /blob-report/ /playwright/.cache/ +# typedoc +/docs/ + # End of https://www.toptal.com/developers/gitignore/api/react,node,joed diff --git a/package.json b/package.json index 20165153..f7209c7d 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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": { diff --git a/packages/app/README.md b/packages/app/README.md index b87cb004..88d32238 100644 --- a/packages/app/README.md +++ b/packages/app/README.md @@ -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. diff --git a/packages/core/README.md b/packages/core/README.md index 93eb55df..e69de29b 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -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). diff --git a/packages/upset/src/components/Upset.tsx b/packages/upset/src/components/Upset.tsx index 6c044d1e..50be8a1f 100644 --- a/packages/upset/src/components/Upset.tsx +++ b/packages/upset/src/components/Upset.tsx @@ -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; - 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; -}; +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 = ({ data, parentHasHeight = false, diff --git a/packages/upset/src/index.tsx b/packages/upset/src/index.tsx index b796de93..f8b5198d 100644 --- a/packages/upset/src/index.tsx +++ b/packages/upset/src/index.tsx @@ -1,5 +1,7 @@ export { Upset } from './components/Upset'; +export * from './types'; + export * from './provenance/index'; export { diff --git a/packages/upset/src/types.ts b/packages/upset/src/types.ts new file mode 100644 index 00000000..695788c5 --- /dev/null +++ b/packages/upset/src/types.ts @@ -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; + + /** + * 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; +} diff --git a/packages/upset/test/blah.test.tsx b/packages/upset/test/blah.test.tsx deleted file mode 100644 index dd73ee47..00000000 --- a/packages/upset/test/blah.test.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import React from 'react'; -import * as ReactDOM from 'react-dom'; -import { Default as Thing } from '../stories/Thing.stories'; - -describe('Thing', () => { - it('renders without crashing', () => { - const div = document.createElement('div'); - ReactDOM.render(, div); - ReactDOM.unmountComponentAtNode(div); - }); -}); diff --git a/typedoc.base.json b/typedoc.base.json index bad83a05..f254c066 100644 --- a/typedoc.base.json +++ b/typedoc.base.json @@ -2,4 +2,5 @@ "$schema": "https://typedoc.org/schema.json", "includeVersion": true, "skipErrorChecking": true, + "excludeExternals": true, } \ No newline at end of file diff --git a/typedoc.json b/typedoc.json index 0c60678c..929dd66a 100644 --- a/typedoc.json +++ b/typedoc.json @@ -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, } \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 7c409dfc..7270932e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6059,7 +6059,7 @@ ansi-regex@^5.0.0, ansi-regex@^5.0.1: ansi-sequence-parser@^1.1.0: version "1.1.1" - resolved "https://registry.yarnpkg.com/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz#e0aa1cdcbc8f8bb0b5bca625aac41f5f056973cf" + resolved "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz" integrity sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg== ansi-styles@^3.2.0, ansi-styles@^3.2.1: @@ -12738,7 +12738,7 @@ json5@^1.0.1, json5@^1.0.2: jsonc-parser@^3.2.0: version "3.2.1" - resolved "https://registry.yarnpkg.com/jsonc-parser/-/jsonc-parser-3.2.1.tgz#031904571ccf929d7670ee8c547545081cb37f1a" + resolved "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz" integrity sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA== jsonfile@^4.0.0: @@ -13170,7 +13170,7 @@ lru-cache@^6.0.0: lunr@^2.3.9: version "2.3.9" - resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.9.tgz#18b123142832337dd6e964df1a5a7707b25d35e1" + resolved "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz" integrity sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow== lz-string@^1.5.0: @@ -13309,7 +13309,7 @@ marked@^0.3.12: marked@^4.3.0: version "4.3.0" - resolved "https://registry.yarnpkg.com/marked/-/marked-4.3.0.tgz#796362821b019f734054582038b116481b456cf3" + resolved "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz" integrity sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A== marksy@^8.0.0: @@ -17220,7 +17220,7 @@ shellwords@^0.1.1: shiki@^0.14.7: version "0.14.7" - resolved "https://registry.yarnpkg.com/shiki/-/shiki-0.14.7.tgz#c3c9e1853e9737845f1d2ef81b31bcfb07056d4e" + resolved "https://registry.npmjs.org/shiki/-/shiki-0.14.7.tgz" integrity sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg== dependencies: ansi-sequence-parser "^1.1.0" @@ -18649,6 +18649,11 @@ typedarray@^0.0.6: resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz" integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA== +typedoc-plugin-missing-exports@^2.2.0: + version "2.2.0" + resolved "https://registry.npmjs.org/typedoc-plugin-missing-exports/-/typedoc-plugin-missing-exports-2.2.0.tgz" + integrity sha512-2+XR1IcyQ5UwXZVJe9NE6HrLmNufT9i5OwoIuuj79VxuA3eYq+Y6itS9rnNV1D7UeQnUSH8kISYD73gHE5zw+w== + typedoc@^0.25.12: version "0.25.12" resolved "https://registry.npmjs.org/typedoc/-/typedoc-0.25.12.tgz" @@ -19599,12 +19604,12 @@ vm-browserify@^1.0.1: vscode-oniguruma@^1.7.0: version "1.7.0" - resolved "https://registry.yarnpkg.com/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz#439bfad8fe71abd7798338d1cd3dc53a8beea94b" + resolved "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz" integrity sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA== vscode-textmate@^8.0.0: version "8.0.0" - resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-8.0.0.tgz#2c7a3b1163ef0441097e0b5d6389cd5504b59e5d" + resolved "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz" integrity sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg== vue-template-compiler@^2.7.14: