Skip to content

Commit

Permalink
minor improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
bhouston committed Jun 12, 2023
1 parent 7003e21 commit 43ea8b2
Show file tree
Hide file tree
Showing 27 changed files with 254 additions and 227 deletions.
5 changes: 3 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"unicorn/no-this-assignment": "error",
"unicorn/no-unreadable-array-destructuring": "error",
"unicorn/no-unreadable-iife": "error",
"unicorn/no-unsafe-regex": "error",
"unicorn/no-unsafe-regex": "warn",
"unicorn/no-unused-properties": "error",
"unicorn/no-useless-length-check": "error",
"unicorn/no-useless-promise-resolve-reject": "error",
Expand Down Expand Up @@ -95,6 +95,7 @@
"unicorn/require-array-join-separator": "error",
"unicorn/require-number-to-fixed-digits-argument": "error",
"unicorn/string-content": "error",
"unicorn/throw-new-error": "error"
"unicorn/throw-new-error": "error",
"prefer-const": "warn"
}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ dist
node-spec.json
*.blend1
node-spec.csv
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"reserialization",
"reserialized",
"Slerp",
"threeify"
"threeify",
"fortawesome",
"reactflow"
],
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": ["source.formatDocument", "source.fixAll.eslint"]
Expand Down
9 changes: 4 additions & 5 deletions examples/exec-graph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,25 @@
"version": "0.0.1",
"source": "src/index.ts",
"type": "module",
"sideEffects": false,
"scripts": {
"watch": "tsc -w",
"build": "tsc",
"start": "node --enable-source-maps --loader ts-node/esm ./src/index.ts --profile"
},
"bin": {
"exec-graph": "./dist/index.js"
},
"bin": "./dist/index.js",
"devDependencies": {
"@types/glob": "^8.0.0",
"@types/node": "^18.0.6",
"ts-node": "^10.9.1",
"typescript": "^4.8.4"
},
"peerDependencies": {
"@behave-graph/core": "*"
},
"description": "Run a graph",
"author": "",
"license": "ISC",
"dependencies": {
"@behave-graph/core": "*",
"commander": "^9.4.1",
"glob": "^8.0.3"
}
Expand Down
9 changes: 4 additions & 5 deletions examples/export-node-spec/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@
"version": "0.0.1",
"source": "src/index.ts",
"type": "module",
"sideEffects": false,
"scripts": {
"watch": "tsc -w",
"build": "tsc",
"start": "node --enable-source-maps --loader ts-node/esm ./src/index.ts"
},
"bin": {
"export-node-spec": "./dist/index.js"
},
"bin": "./dist/index.js",
"devDependencies": {
"@types/glob": "^8.0.0",
"@types/node": "^18.0.6",
Expand All @@ -22,9 +19,11 @@
"author": "",
"license": "ISC",
"dependencies": {
"@behave-graph/core": "*",
"commander": "^9.4.1",
"csv-stringify": "^6.2.1",
"glob": "^8.0.3"
},
"peerDependencies": {
"@behave-graph/core": "*"
}
}
2 changes: 1 addition & 1 deletion examples/graph-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
},
"devDependencies": {
"@vitejs/plugin-react": "^2.2.0",
"tailwindcss": "^3.2.4",
"autoprefixer": "^10.4.13",
"postcss": "^8.4.19",
"tailwindcss": "^3.2.4",
"ts-node": "^10.9.1",
"typescript": "^4.7.3",
"vite": "^3.2.3",
Expand Down
33 changes: 17 additions & 16 deletions examples/graph-editor/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
import React from "react";
import ReactDOM from "react-dom/client";
import { Examples, Flow } from "@behave-graph/flow";
import { GraphJSON } from "@behave-graph/core";
import rawGraph from "./graph.json"
import 'reactflow/dist/style.css';
import './index.css';

import "reactflow/dist/style.css";
import "./index.css";
import { GraphJSON } from '@behave-graph/core';
import { Examples, Flow } from '@behave-graph/flow';
import React from 'react';
import ReactDOM from 'react-dom/client';

const graph = rawGraph as GraphJSON
import rawGraph from './graph.json';

const graph = rawGraph as GraphJSON;

const root = ReactDOM.createRoot(
document.getElementById("root") as HTMLElement
document.getElementById('root') as HTMLElement
);

import Branch from "../../../graphs/core/flow/Branch.json";
import Delay from "../../../graphs/core/time/Delay.json";
import HelloWorld from "../../../graphs/core//HelloWorld.json";
import Polynomial from "../../../graphs/core/logic/Polynomial.json";
import SetGet from "../../../graphs/core/variables/SetGet.json";
import HelloWorld from '../../../graphs/core//HelloWorld.json';
import Branch from '../../../graphs/core/flow/Branch.json';
import Polynomial from '../../../graphs/core/logic/Polynomial.json';
import Delay from '../../../graphs/core/time/Delay.json';
import SetGet from '../../../graphs/core/variables/SetGet.json';

// TODO remove when json types fixed in behave-graph
const examples: Examples = {
branch: Branch as unknown as GraphJSON,
delay: Delay as unknown as GraphJSON,
helloWorld: HelloWorld as unknown as GraphJSON,
polynomial: Polynomial as unknown as GraphJSON,
setGet: SetGet as unknown as GraphJSON,
setGet: SetGet as unknown as GraphJSON
} as Record<string, GraphJSON>;

root.render(
<React.StrictMode>
<Flow graph={graph} examples={examples}/>
<Flow graph={graph} examples={examples} />
</React.StrictMode>
);
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@
}
}
]
}
}
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@behave-graph/monorepo",
"name": "behave-graph-monorepo",
"version": "0.9.10",
"description": "Simple, extensible behavior graph engine",
"private": true,
Expand Down Expand Up @@ -30,11 +30,11 @@
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.0.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^8.0.0",
"eslint-plugin-unicorn": "^44.0.0",
"eslint-plugin-unused-imports": "^2.0.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"ts-node": "^10.9.1",
"typedoc": "^0.23.15",
"typescript": "^4.7.3"
Expand All @@ -46,19 +46,19 @@
"format": "npx eslint \"{examples,packages}/**/src/**/*.{js,ts,tsx,json}\" --fix && npx prettier \"{examples,packages}/**/src/**/*.{js,ts,tsx,json}\" --check --write",
"docs": "typedoc",
"test": "npm run test-flow && npm run test-core",
"test:flow": "npm run test --workspace=@behave-graph/flow",
"test:core": "npm run test --workspace=@behave-graph/core",
"start": "npm run three-viewer",
"start:exec-graph": "npm run start --workspace=@behave-graph/examples-exec-graph",
"start:export-node-spec": "npm run start --workspace=@behave-graph/examples-export-node-spec",
"start:three-viewer": "npm run start --workspace=@behave-graph/examples-three-viewer",
"start:graph-editor": "npm run start --workspace=examples/graph-editor",
"build:exec-graph": "npm run build --workspace=@behave-graph/examples-exec-graph",
"build:export-node-spec": "npm run build --workspace=@behave-graph/examples-export-node-spec",
"build:three-viewer": "npm run build --workspace=@behave-graph/examples-three-viewer",
"test:flow": "yarn run test --workspace=@behave-graph/flow",
"test:core": "yarn run test --workspace=@behave-graph/core",
"start": "yarn run three-viewer",
"start:exec-graph": "yarn run start --workspace=@behave-graph/examples-exec-graph",
"start:export-node-spec": "yarn run start --workspace=@behave-graph/examples-export-node-spec",
"start:three-viewer": "yarn run start --workspace=@behave-graph/examples-three-viewer",
"start:graph-editor": "yarn run start --workspace=examples/graph-editor",
"build:exec-graph": "yarn run build --workspace=@behave-graph/examples-exec-graph",
"build:export-node-spec": "yarn run build --workspace=@behave-graph/examples-export-node-spec",
"build:three-viewer": "yarn run build --workspace=@behave-graph/examples-three-viewer",
"changeset:add": "changeset add",
"vers": "npm run changeset version",
"release": "npm run build && npm run changeset publish"
"vers": "yarn run changeset version",
"release": "yarn run build && npm run changeset publish"
},
"workspaces": [
"packages/*",
Expand All @@ -68,7 +68,7 @@
"dependencies": {
"@changesets/changelog-git": "^0.1.14",
"@changesets/cli": "^2.26.0",
"lerna": "^6.6.2",
"lerna": "^7.0.0",
"microbundle": "^0.15.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
10 changes: 0 additions & 10 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,7 @@
"@types/glob": "^8.0.0",
"@types/jest": "^29.1.1",
"@types/node": "^18.0.6",
"@typescript-eslint/eslint-plugin": "^5.38.1",
"eslint": "^8.24.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.0.1",
"eslint-plugin-simple-import-sort": "^8.0.0",
"eslint-plugin-unicorn": "^44.0.0",
"eslint-plugin-unused-imports": "^2.0.0",
"jest": "^29.1.2",
"prettier": "^2.7.1",
"ts-jest": "^29.0.3",
"ts-jest-resolver": "^2.0.0",
"typescript": "^4.8.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import {
vec2Dot,
vec2FromArray,
vec2Length,
vec2MultiplyByScalar,
vec2Negate,
vec2Normalize,
vec2Parse,
vec2MultiplyByScalar,
vec2Subtract,
vec2ToArray,
vec2ToString
Expand Down
1 change: 0 additions & 1 deletion packages/flow/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"@fortawesome/fontawesome-svg-core": "^6.1.2",
"@fortawesome/free-solid-svg-icons": "^6.1.2",
"@fortawesome/react-fontawesome": "^0.2.0",
"behave-graph": "^0.9.9",
"classnames": "^2.3.1",
"downshift": "^6.1.7",
"typescript": "^4.7.4",
Expand Down
20 changes: 10 additions & 10 deletions packages/flow/src/components/AutoSizeInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ import {
useCallback,
useEffect,
useRef,
useState,
} from "react";
useState
} from 'react';

export type AutoSizeInputProps = HTMLProps<HTMLInputElement> & {
minWidth?: number;
};

const baseStyles: CSSProperties = {
position: "absolute",
position: 'absolute',
top: 0,
left: 0,
visibility: "hidden",
visibility: 'hidden',
height: 0,
width: "auto",
whiteSpace: "pre",
width: 'auto',
whiteSpace: 'pre'
};

export const AutoSizeInput: FC<AutoSizeInputProps> = ({
Expand All @@ -35,9 +35,9 @@ export const AutoSizeInput: FC<AutoSizeInputProps> = ({
if (input) {
const styles = window.getComputedStyle(input);
setStyles({
fontSize: styles.getPropertyValue("font-size"),
paddingLeft: styles.getPropertyValue("padding-left"),
paddingRight: styles.getPropertyValue("padding-right"),
fontSize: styles.getPropertyValue('font-size'),
paddingLeft: styles.getPropertyValue('padding-left'),
paddingRight: styles.getPropertyValue('padding-right')
});
}
inputRef.current = input;
Expand All @@ -49,7 +49,7 @@ export const AutoSizeInput: FC<AutoSizeInputProps> = ({
if (inputRef.current === null) return;

const width = measureRef.current.clientWidth;
inputRef.current.style.width = Math.max(minWidth, width) + "px";
inputRef.current.style.width = Math.max(minWidth, width) + 'px';
}, [props.value, minWidth, styles]);

return (
Expand Down

0 comments on commit 43ea8b2

Please sign in to comment.