Skip to content

Commit

Permalink
test-bed fixes (#432)
Browse files Browse the repository at this point in the history
* install viewer library in test bed and adjust configs, imports, extensions to fix build

* add js extension to type imports for VisDataCache
  • Loading branch information
interim17 authored Dec 3, 2024
1 parent 323c295 commit b09f4a6
Show file tree
Hide file tree
Showing 18 changed files with 5,329 additions and 6,580 deletions.
9,464 changes: 4,530 additions & 4,934 deletions examples/package-lock.json

Large diffs are not rendered by default.

53 changes: 27 additions & 26 deletions examples/package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
{
"name": "testbed_viewer",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"serve-example": "webpack serve --config webpack.dev.js",
"prebuild-example": "npm install",
"build-example": "webpack --config webpack.dev.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"detect-collisions": "^9.2.3",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^6.9.1",
"html-webpack-plugin": "^5.6.0",
"mini-css-extract-plugin": "^2.7.7",
"webpack": "^5.95.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4"
}
"name": "testbed_viewer",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"serve-example": "webpack serve --config webpack.dev.js",
"prebuild-example": "npm install",
"build-example": "webpack --config webpack.dev.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"@aics/simularium-viewer": "file:../",
"detect-collisions": "^9.2.3",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^6.9.1",
"html-webpack-plugin": "^5.6.0",
"mini-css-extract-plugin": "^2.7.7",
"webpack": "^5.95.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4"
}
}
4 changes: 2 additions & 2 deletions examples/src/Components/ConversionForm/CollectionInput.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { map, reduce } from "lodash";
import React from "react";
import BaseInput from "./BaseInput.js"
import { CustomParameters } from "../Viewer.js"
import BaseInput from "./BaseInput"
import { CustomParameters } from "../../types";

interface CollectionParameters extends CustomParameters {
length: number;
Expand Down
4 changes: 2 additions & 2 deletions examples/src/Components/ConversionForm/InputSwitch.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { map } from "lodash";
import React from "react";
import BaseInput from "./BaseInput.js"
import CollectionInput from "./CollectionInput.js"
import BaseInput from "./BaseInput"
import CollectionInput from "./CollectionInput"

interface InputSwitchProps {
handler: (path: string[], key: string, value: any) => void;
Expand Down
2 changes: 1 addition & 1 deletion examples/src/Components/ConversionForm/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { map } from "lodash";
import React from "react";
import InputSwitch from "./InputSwitch.js"
import InputSwitch from "./InputSwitch"

interface InputFormProps {
template: { [key: string]: any };
Expand Down
63 changes: 26 additions & 37 deletions examples/src/Viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,7 @@ import { isEqual, findIndex, reduce } from "lodash";
import { v4 as uuidv4 } from "uuid";
import { InputParams } from "tweakpane";

/**
* NOTE: if you are debugging an import/build issue
* on the front end, you may need to switch to the
* following import statements to reproduce the issue
* here.
*/
// import SimulariumViewer, {
// SimulariumController,
// RenderStyle,
// loadSimulariumFile,
// FrontEndError,
// ErrorLevel,
// } from "../es";
// viewer package imports
import SimulariumViewer, {
SimulariumController,
RenderStyle,
Expand All @@ -24,41 +12,42 @@ import SimulariumViewer, {
ErrorLevel,
NetConnectionParams,
TrajectoryFileInfo,
} from "../../src/index.js";
import { nullAgent, TrajectoryType } from "../../src/constants.js";

nullAgent,
TrajectoryType,
} from "@aics/simularium-viewer";
import type {
ISimulariumFile,
UIDisplayData,
SelectionStateInfo,
SelectionEntry,
} from "../../type-declarations/index.js";
import { AgentData } from "../../type-declarations/simularium/types.js";
import PointSimulator from "./simulators/PointSimulator.js";
import BindingSimulator from "./simulators/BindingSimulator2D.js";
import PointSimulatorLive from "./simulators/PointSimulatorLive.js";
import PdbSimulator from "./simulators/PdbSimulator.js";
import SinglePdbSimulator from "./simulators/SinglePdbSimulator.js";
import CurveSimulator from "./simulators/CurveSimulator.js";
import SingleCurveSimulator from "./simulators/SingleCurveSimulator.js";
import MetaballSimulator from "./simulators/MetaballSimulator.js";

import ColorPicker from "./Components/ColorPicker.js";
import RecordMovieComponent from "./Components/RecordMovieComponent.js";
import ConversionForm from "./Components/ConversionForm/index.js";
import AgentMetadata from "./Components/AgentMetadata.js";

import { agentColors } from "./constants.js";
import { BaseType, CustomType } from "./types.js";
AgentData,
} from "@aics/simularium-viewer";
import "../../style/style.css";

// local test bed imports
import PointSimulator from "./simulators/PointSimulator";
import BindingSimulator from "./simulators/BindingSimulator2D";
import PointSimulatorLive from "./simulators/PointSimulatorLive";
import PdbSimulator from "./simulators/PdbSimulator";
import SinglePdbSimulator from "./simulators/SinglePdbSimulator";
import CurveSimulator from "./simulators/CurveSimulator";
import SingleCurveSimulator from "./simulators/SingleCurveSimulator";
import MetaballSimulator from "./simulators/MetaballSimulator";

import ColorPicker from "./Components/ColorPicker";
import RecordMovieComponent from "./Components/RecordMovieComponent";
import ConversionForm from "./Components/ConversionForm";
import AgentMetadata from "./Components/AgentMetadata";
import { agentColors } from "./constants";
import { BaseType, CustomType } from "./types";
import {
SMOLDYN_TEMPLATE,
UI_BASE_TYPES,
UI_CUSTOM_TYPES,
UI_TEMPLATE_DOWNLOAD_URL_ROOT,
UI_TEMPLATE_URL_ROOT,
} from "./api-settings.js";
} from "./api-settings";

import "../../style/style.css";
import "./style.css";

let playbackFile = "TEST_LIVEMODE_API";
Expand Down Expand Up @@ -470,7 +459,7 @@ class Viewer extends React.Component<InputParams, ViewerState> {
},
[]
);
const uniqueTags: string[] = [...new Set(allTags)];
const uniqueTags: string[] = [...new Set(allTags)] as string[];
if (
isEqual(uiDisplayData, this.state.selectionStateInfo.appliedColors)
) {
Expand Down
2 changes: 1 addition & 1 deletion examples/src/simulators/BindingSimulator2D.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
VisDataMessage,
DEFAULT_CAMERA_SPEC,
VisTypes,
} from "../../../src.js";
} from "@aics/simularium-viewer";

class BindingInstance extends Circle {
id: number;
Expand Down
8 changes: 3 additions & 5 deletions examples/src/simulators/CurveSimulator.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import {
IClientSimulatorImpl,
ClientMessageEnum,
} from "../../../src/simularium/localSimulators/IClientSimulatorImpl.js";
import {
EncodedTypeMapping,
TrajectoryFileInfo,
VisDataMessage,
} from "../../../src/simularium/types.js";
import VisTypes from "../../../src/simularium/VisTypes.js";
import { DEFAULT_CAMERA_SPEC } from "../../../src/constants.js";
VisTypes,
DEFAULT_CAMERA_SPEC,
} from "@aics/simularium-viewer";

export default class CurveSim implements IClientSimulatorImpl {
nCurves: number;
Expand Down
8 changes: 3 additions & 5 deletions examples/src/simulators/MetaballSimulator.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import {
IClientSimulatorImpl,
ClientMessageEnum,
} from "../../../src/simularium/localSimulators/IClientSimulatorImpl.js";
import {
EncodedTypeMapping,
TrajectoryFileInfo,
VisDataMessage,
} from "../../../src/simularium/types.js";
import VisTypes from "../../../src/simularium/VisTypes.js";
import { GeometryDisplayType } from "../../../src/visGeometry/types.js";
VisTypes,
GeometryDisplayType,
} from "@aics/simularium-viewer";

export default class MetaballSimulator implements IClientSimulatorImpl {
currentFrame: number;
Expand Down
8 changes: 3 additions & 5 deletions examples/src/simulators/PdbSimulator.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import {
IClientSimulatorImpl,
ClientMessageEnum,
} from "../../../src/simularium/localSimulators/IClientSimulatorImpl.js";
import {
EncodedTypeMapping,
TrajectoryFileInfo,
VisDataMessage,
} from "../../../src/simularium/types.js";
import VisTypes from "../../../src/simularium/VisTypes.js";
import { GeometryDisplayType } from "../../../src/visGeometry/types.js";
VisTypes,
GeometryDisplayType,
} from "@aics/simularium-viewer";

export default class PdbSim implements IClientSimulatorImpl {
nPoints: number;
Expand Down
8 changes: 3 additions & 5 deletions examples/src/simulators/PointSimulator.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import {
IClientSimulatorImpl,
ClientMessageEnum,
} from "../../../src/simularium/localSimulators/IClientSimulatorImpl.js";
import {
EncodedTypeMapping,
TrajectoryFileInfo,
VisDataMessage,
} from "../../../src/simularium/types.js";
import VisTypes from "../../../src/simularium/VisTypes.js";
import { DEFAULT_CAMERA_SPEC } from "../../../src/constants.js";
VisTypes,
DEFAULT_CAMERA_SPEC,
} from "@aics/simularium-viewer";

export default class PointSim implements IClientSimulatorImpl {
nPoints: number;
Expand Down
8 changes: 3 additions & 5 deletions examples/src/simulators/PointSimulatorLive.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import {
IClientSimulatorImpl,
ClientMessageEnum,
} from "../../../src/simularium/localSimulators/IClientSimulatorImpl.js";
import {
EncodedTypeMapping,
TrajectoryFileInfo,
VisDataMessage,
} from "../../../src/simularium/types.js";
import VisTypes from "../../../src/simularium/VisTypes.js";
import { DEFAULT_CAMERA_SPEC } from "../../../src/constants.js";
VisTypes,
DEFAULT_CAMERA_SPEC,
} from "@aics/simularium-viewer";

export default class PointSimLive implements IClientSimulatorImpl {
nPoints: number;
Expand Down
8 changes: 3 additions & 5 deletions examples/src/simulators/SingleCurveSimulator.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import {
IClientSimulatorImpl,
ClientMessageEnum,
} from "../../../src/simularium/localSimulators/IClientSimulatorImpl.js";
import {
EncodedTypeMapping,
TrajectoryFileInfo,
VisDataMessage,
} from "../../../src/simularium/types.js";
import VisTypes from "../../../src/simularium/VisTypes.js";
import { DEFAULT_CAMERA_SPEC } from "../../../src/constants.js";
VisTypes,
DEFAULT_CAMERA_SPEC,
} from "@aics/simularium-viewer";

export default class SingleCurveSim implements IClientSimulatorImpl {
curveData: number[];
Expand Down
8 changes: 3 additions & 5 deletions examples/src/simulators/SinglePdbSimulator.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import {
IClientSimulatorImpl,
ClientMessageEnum,
} from "../../../src/simularium/localSimulators/IClientSimulatorImpl.js";
import {
EncodedTypeMapping,
TrajectoryFileInfo,
VisDataMessage,
} from "../../../src/simularium/types.js";
import VisTypes from "../../../src/simularium/VisTypes.js";
import { GeometryDisplayType } from "../../../src/visGeometry/types.js";
VisTypes,
GeometryDisplayType,
} from "@aics/simularium-viewer";

export default class PdbSim implements IClientSimulatorImpl {
pdbType: string;
Expand Down
7 changes: 7 additions & 0 deletions examples/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"compilerOptions": {
"jsx": "preserve",
"esModuleInterop": true,
"downlevelIteration": true
}
}
Loading

0 comments on commit b09f4a6

Please sign in to comment.