Skip to content

Commit

Permalink
Merge branch 'main' into 375-query-by-set
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeWags authored Feb 12, 2025
2 parents 9405df9 + 566a031 commit 207a001
Show file tree
Hide file tree
Showing 49 changed files with 3,813 additions and 12,918 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
Expand Down Expand Up @@ -163,3 +162,4 @@ sketch

# End of https://www.toptal.com/developers/gitignore/api/react,node,joed
.turbo/cookies/0.cookie
.turbo/
6 changes: 3 additions & 3 deletions e2e-tests/common.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Page } from '@playwright/test';
import mockData from '../playwright/mock-data/simpsons/simpsons_data.json';
import mockAnnotations from '../playwright/mock-data/simpsons/simpsons_annotations.json';
import mockAltText from '../playwright/mock-data/simpsons/simpsons_alttxt.json';
import mockData from '../playwright/mock-data/simpsons/simpsons_data.json' assert { type: 'json' };
import mockAnnotations from '../playwright/mock-data/simpsons/simpsons_annotations.json' assert { type: 'json' };
import mockAltText from '../playwright/mock-data/simpsons/simpsons_alttxt.json' assert { type: 'json' };

export const alttxt = {
upsetIntroduction: 'This is an UpSet plot that visualizes set intersection. To learn about UpSet plots, visit https://upset.app.',
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/elementView.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ async function setQuery(page: Page, att: string, type: string, query: string): P
test('Query Selection', async ({ page }) => {
await page.goto('http://localhost:3000/?workspace=Upset+Examples&table=simpsons&sessionId=193');
await page.getByLabel('Element View Sidebar Toggle').click();
await page.locator('[id="Subset_School\\~\\&\\~Male"] g').filter({ hasText: /^Blue Hair$/ }).locator('circle').click();
await page.locator('[id="Subset_School\\~\\&\\~Male"]').getByLabel('Blue Hair').locator('circle').click();

// Selected elements for testing
const ralphCell = page.getByRole('cell', { name: 'Ralph' });
Expand Down
13 changes: 0 additions & 13 deletions lerna.json

This file was deleted.

22 changes: 6 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "upset-monorepo",
"private": true,
"type": "module",
"workspaces": [
"packages/*"
],
Expand All @@ -10,9 +11,6 @@
"storybook": "turbo run storybook",
"test": "playwright test",
"build": "turbo run build --force",
"prepublish": "lerna run prepublish",
"publish-canary": "echo 'Do something'",
"publish-stable": "echo 'Do something'",
"lint": "turbo run lint --parallel --no-cache",
"doc": "typedoc --options typedoc.json"
},
Expand All @@ -27,27 +25,19 @@
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.28.0",
"eslint-plugin-react-hooks": "^4.3.0",
"lerna": "^4.0.0",
"rollup-plugin-postcss": "^4.0.2",
"turbo": "^1.0.24",
"turbo": "^2.4.1",
"typedoc": "^0.25.12",
"typedoc-plugin-missing-exports": "^2.2.0",
"typescript": "^4.5.5"
},
"prettier": {
"printWidth": 80,
"semi": true,
"singleQuote": true,
"trailingComma": "all"
},
"packageManager": "yarn@1.22.19",
"dependencies": {
"@playwright/test": "^1.49.1",
"@vitejs/plugin-react": "^4.0.4",
"@vitejs/plugin-react": "^4.3.4",
"eslint-config-react-app": "^7.0.1",
"react": "^18.0.2",
"vite": "^4.4.9",
"vite-plugin-dts": "^3.5.1",
"vite-tsconfig-paths": "^4.2.0"
"react": "^18.3.1",
"vite": "^6.1.0",
"vite-plugin-dts": "^3.5.1"
}
}
19 changes: 9 additions & 10 deletions packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "@visdesignlab/app",
"version": "0.1.0",
"private": true,
"type": "module",
"dependencies": {
"@emotion/css": "^11.10.5",
"@emotion/react": "^11.10.5",
Expand All @@ -18,23 +19,21 @@
"@types/jest": "^27.4.0",
"@types/node": "^16.11.22",
"@types/react": "^17.0.39",
"@types/react-dom": "^17.0.11",
"@visdesignlab/upset2-core": "^0.1.0",
"@visdesignlab/upset2-react": "^0.1.0",
"@types/react-dom": "^18.3.1",
"@visdesignlab/upset2-core": "*",
"@visdesignlab/upset2-react": "*",
"localforage": "^1.10.0",
"multinet": "0.23.3",
"react": "^18.0.2",
"react": "^18.3.1",
"react-dom": "^18.0.2",
"react-router-dom": "^6.14.1",
"recoil": "^0.6.1",
"typescript": "^4.5.5",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "vite --port 3000",
"dev": "yarn start",
"build": "vite build",
"serve": "vite preview"
"dev": "vite dev --port 3000",
"build": "vite build"
},
"eslintConfig": {
"extends": [
Expand All @@ -55,7 +54,7 @@
]
},
"devDependencies": {
"@vitejs/plugin-react": "^4.0.4",
"vite": "^4.4.9"
"@vitejs/plugin-react": "^4.3.4",
"vite": "^6.1.0"
}
}
5 changes: 3 additions & 2 deletions packages/app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from '@visdesignlab/upset2-react';
import { useRecoilValue, useSetRecoilState } from 'recoil';
import { BrowserRouter, Route, Routes } from 'react-router-dom';
import { convertConfig, DefaultConfig, UpsetConfig } from '@visdesignlab/upset2-core';
import { convertConfig, deepCopy, DefaultConfig, UpsetConfig } from '@visdesignlab/upset2-core';
import { CircularProgress } from '@mui/material';
import { ProvenanceGraph } from '@trrack/core/graph/graph-slice';
import { dataSelector, encodedDataAtom } from './atoms/dataAtom';
Expand All @@ -18,6 +18,7 @@ import { queryParamAtom } from './atoms/queryParamAtom';
import { getMultinetSession } from './api/session';

/** @jsxImportSource @emotion/react */
// eslint-disable-next-line @typescript-eslint/no-unused-vars

const defaultVisibleSets = 6;

Expand Down Expand Up @@ -79,7 +80,7 @@ function App() {
);

if (sessionState && sessionState !== 'not found') {
prov.importObject(structuredClone(sessionState));
prov.importObject(deepCopy(sessionState));
}

// Make sure the config atom stays up-to-date with the provenance
Expand Down
4 changes: 2 additions & 2 deletions packages/app/src/components/Body.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AltText, Upset, getAltTextConfig } from '@visdesignlab/upset2-react';
import { CoreUpsetData, UpsetConfig } from '@visdesignlab/upset2-core';
import { CoreUpsetData, deepCopy, UpsetConfig } from '@visdesignlab/upset2-core';
import { useRecoilValue, useRecoilState } from 'recoil';
import {
useCallback, useContext, useEffect, useState,
Expand Down Expand Up @@ -83,7 +83,7 @@ export const Body = ({ data, config }: Props) => {
const getAltText: () => Promise<AltText> = useCallback(async () => {
const state = provObject.provenance.getState();
// Rows must be cloned to avoid a recoil error triggered far down in this call chain when a function writes rows
const ATConfig = getAltTextConfig(state, data, structuredClone(rows));
const ATConfig = getAltTextConfig(state, data, deepCopy(rows));

if (ATConfig.firstAggregateBy !== 'None') {
throw new Error("Alt text generation is not yet supported for aggregated plots. To generate an alt text, set aggregation to 'None' in the left sidebar.");
Expand Down
14 changes: 5 additions & 9 deletions packages/app/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import '@fontsource/roboto/700.css';

import { Box, CircularProgress, ThemeProvider } from '@mui/material';
import React, { Suspense } from 'react';
import ReactDOM from 'react-dom';
import { RecoilRoot } from 'recoil';
import { createRoot } from 'react-dom/client';

import App from './App';
import DefaultTheme from './components/theme';
Expand Down Expand Up @@ -61,7 +61,9 @@ oAuth.maybeRestoreLogin().then(() => {
invalidateSharedLoginCookie();
}

ReactDOM.render(
const container = document.getElementById('root') as HTMLElement
const root = createRoot(container);
root.render(
<React.StrictMode>
<ThemeProvider theme={DefaultTheme}>
<RecoilRoot>
Expand All @@ -86,12 +88,6 @@ oAuth.maybeRestoreLogin().then(() => {
</Suspense>
</RecoilRoot>
</ThemeProvider>
</React.StrictMode>,
document.getElementById('root'),
</React.StrictMode>
);
});

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
// reportWebVitals(console.log);
4 changes: 2 additions & 2 deletions packages/app/src/utils/oneHotEncoding.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { CoreUpsetData, process } from "@visdesignlab/upset2-core";
import { CoreUpsetData, deepCopy, process } from "@visdesignlab/upset2-core";

export const oneHotEncode = (encodeList: string[], data: CoreUpsetData, empty?: boolean) => {
const newColNames: string[] = []
const encodedData: CoreUpsetData = structuredClone(data);
const encodedData: CoreUpsetData = deepCopy(data);

// close the error window
if (empty) {
Expand Down
33 changes: 13 additions & 20 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
{
"name": "@visdesignlab/upset2-core",
"version": "0.1.0",
"version": "1.0.0",
"license": "MIT",
"main": "dist/index.js",
"type": "module",
"main": "dist/index.cjs",
"typings": "dist/index.d.ts",
"module": "dist/index.mjs",
"module": "dist/index.js",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"files": [
"dist",
"src"
],
"engines": {
"node": ">=10"
"node": ">=18"
},
"scripts": {
"start": "vite build --watch",
"dev": "yarn run start",
"dev": "vite build --watch",
"build": "vite build",
"lint": "eslint src --fix"
},
Expand All @@ -24,23 +30,10 @@
"pre-commit": "eslint src"
}
},
"author": "Kiran Gadhave (kirangadhave2@gmail.com), Jake Wagoner",
"size-limit": [
{
"path": "dist/packagescore.cjs.production.min.js",
"limit": "10 KB"
},
{
"path": "dist/packagescore.esm.js",
"limit": "10 KB"
}
],
"author": "Kiran Gadhave (kirangadhave2@gmail.com), Jake Wagoner, Nate Lanza",
"devDependencies": {
"@size-limit/preset-small-lib": "^7.0.5",
"@types/d3": "^7.1.0",
"husky": "^7.0.4",
"size-limit": "^7.0.5",
"tsdx": "^0.14.1",
"tslib": "^2.3.1",
"typescript": "^4.5.4"
},
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/convertConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,6 @@ export function convertConfig(config: unknown): UpsetConfig {
default:
void 0;
}
/* eslint-enable no-fallthrough */
/* eslint-enable no-void */

if (!isUpsetConfig(config)) {
// eslint-disable-next-line no-console
Expand Down
16 changes: 10 additions & 6 deletions packages/core/src/process.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { DSVRowArray } from 'd3-dsv';

import {
max, mean, median, min, quantile,
max, mean, median, min, quantile,
} from 'd3-array';

import {
AttributeList,
BaseIntersection,
ColumnDefs,
ColumnName,
CoreUpsetData,
Expand Down Expand Up @@ -223,11 +224,14 @@ function getSets(
type: 'Set',
size: setMembership[col].length,
setMembership: { ...setMembershipStatus, [col]: 'Yes' },
attributes: getSixNumberSummary(
items,
setMembership[col],
attributeColumns,
),
attributes: {
...getSixNumberSummary(
items,
setMembership[col],
attributeColumns,
),
deviation: 0,
},
};

sets[set.id] = set;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from './types';

/**
* DEPRECATED: Currently serves only as an alias for structuredClone; use that instead.
* Version safe deep copy using structured cloning.
* Create a deep copy (with all fields recursively copied) of an object using structured cloning;
* if structured cloning fails, falls back to JSON serialization.
* @param obj the object to copy
Expand Down
8 changes: 1 addition & 7 deletions packages/core/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/// <reference types="vitest" />
import { defineConfig } from 'vite';

import { join } from 'path';
import dts from 'vite-plugin-dts';
import viteTsConfigPaths from 'vite-tsconfig-paths';

export default defineConfig({
cacheDir: '../../node_modules/.vite/core',
Expand All @@ -13,10 +11,6 @@ export default defineConfig({
// Faster builds by skipping tests. Set this to false to enable type checking.
skipDiagnostics: true,
}),

viteTsConfigPaths({
root: '../../',
}),
],
server: { hmr: process.env.NODE_TESTING !== 'true' },

Expand All @@ -29,7 +23,7 @@ export default defineConfig({
// Could also be a dictionary or array of multiple entry points.
entry: 'src/index.ts',
fileName: 'index',
formats: ['es'],
formats: ['es', 'cjs'],
},
rollupOptions: {
// External packages that should not be bundled into your library.
Expand Down
Loading

0 comments on commit 207a001

Please sign in to comment.