diff --git a/package-lock.json b/package-lock.json index cca89fd..8d032e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@gillianplatform/sedap", - "version": "0.0.3", + "version": "0.0.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@gillianplatform/sedap", - "version": "0.0.3", + "version": "0.0.4", "workspaces": [ "./types", "./react", @@ -9866,7 +9866,7 @@ }, "react": { "name": "@gillianplatform/sedap-react", - "version": "0.0.3", + "version": "0.0.4", "license": "ISC", "dependencies": { "@xyflow/react": "^12.3.6", @@ -9878,7 +9878,7 @@ "@eslint/compat": "^1.2.4", "@eslint/eslintrc": "^3.2.0", "@eslint/js": "^9.17.0", - "@gillianplatform/sedap-types": "0.0.3", + "@gillianplatform/sedap-types": "0.0.4", "@storybook/addon-essentials": "^8.4.7", "@storybook/addon-interactions": "^8.4.7", "@storybook/addon-onboarding": "^8.4.7", @@ -9912,7 +9912,7 @@ }, "types": { "name": "@gillianplatform/sedap-types", - "version": "0.0.3", + "version": "0.0.4", "license": "ISC", "devDependencies": { "json-schema-to-typescript": "^15.0.3", @@ -9922,14 +9922,14 @@ }, "vscode/ext": { "name": "@gillianplatform/sedap-vscode-ext", - "version": "0.0.3", + "version": "0.0.4", "license": "ISC", "devDependencies": { "@eslint/compat": "^1.2.4", "@eslint/eslintrc": "^3.2.0", "@eslint/js": "^9.17.0", - "@gillianplatform/sedap-types": "0.0.3", - "@gillianplatform/sedap-vscode-types": "0.0.3", + "@gillianplatform/sedap-types": "0.0.4", + "@gillianplatform/sedap-vscode-types": "0.0.4", "@types/vscode": "^1.96.0", "@typescript-eslint/eslint-plugin": "^8.18.2", "@typescript-eslint/parser": "^8.18.2", @@ -9948,16 +9948,16 @@ }, "vscode/types": { "name": "@gillianplatform/sedap-vscode-types", - "version": "0.0.3", + "version": "0.0.4", "license": "ISC", "devDependencies": { - "@gillianplatform/sedap-types": "0.0.3", + "@gillianplatform/sedap-types": "0.0.4", "typescript": "^5.7.2" } }, "vscode/ui": { "name": "@gillianplatform/sedap-vscode-ui", - "version": "0.0.3", + "version": "0.0.4", "license": "ISC", "dependencies": { "@xyflow/react": "^12.3.6", @@ -9969,8 +9969,8 @@ "@eslint/compat": "^1.2.4", "@eslint/eslintrc": "^3.2.0", "@eslint/js": "^9.17.0", - "@gillianplatform/sedap-types": "0.0.3", - "@gillianplatform/sedap-vscode-types": "0.0.3", + "@gillianplatform/sedap-types": "0.0.4", + "@gillianplatform/sedap-vscode-types": "0.0.4", "@types/react": "^19.0.2", "@types/vscode-webview": "^1.57.5", "@typescript-eslint/eslint-plugin": "^8.18.2", @@ -9990,7 +9990,7 @@ "vite-plugin-dts": "^4.4.0" }, "peerDependencies": { - "@gillianplatform/sedap-react": "0.0.3", + "@gillianplatform/sedap-react": "0.0.4", "react": "^19.0.0", "react-icons": "^5.4.0" } diff --git a/package.json b/package.json index f970714..40bad2e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gillianplatform/sedap", - "version": "0.0.4", + "version": "0.0.5", "description": "Monorepo for JavaScript libraries for SEDAP", "repository":"https://github.com/gillianplatform/sedap-js", "workspaces": [ @@ -12,6 +12,7 @@ ], "scripts": { "check-versions": "node ./scripts/checkVersion.cjs", + "bump-versions": "node ./scripts/bumpVersion.cjs", "build": "npm run build --workspaces --if-present", "lint": "npm run lint --workspaces --if-present", "lint-check": "npm run lint-check --workspaces --if-present" diff --git a/react/package.json b/react/package.json index 7f6f951..15f82e6 100644 --- a/react/package.json +++ b/react/package.json @@ -1,6 +1,6 @@ { "name": "@gillianplatform/sedap-react", - "version": "0.0.4", + "version": "0.0.5", "description": "React components for SEDAP", "repository":"https://github.com/gillianplatform/sedap-js", "type": "module", @@ -27,7 +27,7 @@ "@eslint/compat": "^1.2.4", "@eslint/eslintrc": "^3.2.0", "@eslint/js": "^9.17.0", - "@gillianplatform/sedap-types": "0.0.4", + "@gillianplatform/sedap-types": "0.0.5", "@storybook/addon-essentials": "^8.4.7", "@storybook/addon-interactions": "^8.4.7", "@storybook/addon-onboarding": "^8.4.7", diff --git a/react/src/components/nodes/BasicNode.tsx b/react/src/components/nodes/BasicNode.tsx index 7bc7eef..32d9ce8 100644 --- a/react/src/components/nodes/BasicNode.tsx +++ b/react/src/components/nodes/BasicNode.tsx @@ -10,6 +10,8 @@ import CenterButton from "./util/CenterButton"; import styled from "styled-components"; import NodeBox from "./util/NodeBox"; import { isNodeExpanded } from "./util/node"; +import { HighlightIcon } from "./util/HighlightIcon"; +import Row from "./util/Row"; const baseWidth = 150; const baseHeight = 50; @@ -39,7 +41,7 @@ const TraceViewBasicNode = (props: NodeComponentProps) => { return ; } - const { display, selectable = true, extras } = options; + const { display, selectable = true, extras, highlight } = options; let selected: Selected; if ((selectedNodes?.primary || []).includes(node.id)) { @@ -64,7 +66,8 @@ const TraceViewBasicNode = (props: NodeComponentProps) => { } })(); - const items: Record = {}; + // #region Items + const items: [string, ReactNode][] = []; if (selectable) { const Button = componentOverrides.selectNodeButton || componentOverrides.button || CenterButton; const selectButton = ( @@ -76,15 +79,17 @@ const TraceViewBasicNode = (props: NodeComponentProps) => { ); - items.selectButton = selectButton; + items.push(["selectButton", selectButton]); } - items.expandButton = ExpandButton({ + const expandButton = ExpandButton({ enabled: !busy, expandedNodes, setNodeExpanded, node, componentOverrides, }) as ReactNode; + items.push(["expandButton", expandButton]); + // #endregion const tooltips: ReactNode[] = []; if (nodeTooltips) { @@ -104,7 +109,7 @@ const TraceViewBasicNode = (props: NodeComponentProps) => { sourceHandle={hasSourceHandle} tooltips={tooltips} tooltipVisible={nodeHovered} - highlight={options?.highlight} + highlight={highlight} > { setNodeHovered(false); }} > - {display} + + + {display} + diff --git a/react/src/components/nodes/util/HighlightIcon.tsx b/react/src/components/nodes/util/HighlightIcon.tsx new file mode 100644 index 0000000..36807d8 --- /dev/null +++ b/react/src/components/nodes/util/HighlightIcon.tsx @@ -0,0 +1,23 @@ +import { VscError, VscInfo, VscPass, VscWarning } from "react-icons/vsc"; + +export type highlight = "error" | "warning" | "info" | "success"; + +export type HighlightIconProps = { + highlight: highlight | undefined; +}; + +export function HighlightIcon({ highlight }: HighlightIconProps) { + const hightlight = (() => { + switch (highlight) { + case "error": + return ; + case "warning": + return ; + case "info": + return ; + case "success": + return ; + } + })(); + return highlight &&
{hightlight}
; +} diff --git a/react/src/components/nodes/util/NodeItems.tsx b/react/src/components/nodes/util/NodeItems.tsx index 90f0c0d..2aa88de 100644 --- a/react/src/components/nodes/util/NodeItems.tsx +++ b/react/src/components/nodes/util/NodeItems.tsx @@ -1,32 +1,24 @@ import { Fragment } from "react"; import { MapNodeExtra } from "@gillianplatform/sedap-types"; import renderExtras from "./renderExtras"; -import styled from "styled-components"; +import Row from "./Row"; type NodeItemsProps = { - items?: Record; + items?: [string, React.ReactNode][]; extras?: MapNodeExtra[]; }; -const NodeItemRow = styled.div` - width: 100%; - display: flex; - flex-direction: row; - justify-content: center; - gap: 0.25em; -`; - const NodeItems: React.FC = ({ items, extras }) => { - const filteredItems = Object.entries(items || {}).filter(([, v]) => v); + const filteredItems = (items || []).filter(([, v]) => v); const renderedExtras = renderExtras(extras || []).map((e, i) => [`extra-${i}`, e] as const); const allItems = [...renderedExtras, ...filteredItems]; if (allItems.length === 0) return null; return ( - + {allItems.map(([key, item]) => ( {item} ))} - + ); }; diff --git a/react/src/components/nodes/util/Row.tsx b/react/src/components/nodes/util/Row.tsx new file mode 100644 index 0000000..8dbb944 --- /dev/null +++ b/react/src/components/nodes/util/Row.tsx @@ -0,0 +1,14 @@ +import styled from "styled-components"; + +const Row = styled.div` + width: 100%; + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + gap: 0.25em; + padding: 0 0.25em; + box-sizing: border-box; +`; + +export default Row; diff --git a/scripts/bumpVersion.cjs b/scripts/bumpVersion.cjs new file mode 100644 index 0000000..9f5a0ea --- /dev/null +++ b/scripts/bumpVersion.cjs @@ -0,0 +1,20 @@ +const { getPackageJSONPaths } = require("./util.cjs"); +const fs = require("fs"); + +const versionPattern = /("version"\s*:\s*"\d+\.\d+\.)(\d+)"/g; +const depPattern = /("@gillianplatform\/sedap-.+"\s*:\s*"\d+\.\d+\.)(\d+)"/g; + +const replaceVersion = (_, pre, n) => pre + (parseInt(n) + 1) + '"'; + +function processFile(path) { + const content = fs.readFileSync(path).toString(); + const newContent = content + .replace(versionPattern, replaceVersion) + .replaceAll(depPattern, replaceVersion); + fs.writeFileSync(path, newContent); +} + +const paths = getPackageJSONPaths(); +for (const path of paths) { + processFile(path) +} diff --git a/scripts/util.cjs b/scripts/util.cjs index ce29d94..15995eb 100644 --- a/scripts/util.cjs +++ b/scripts/util.cjs @@ -6,8 +6,21 @@ function loadJSON(filename) { return obj; } +function getRootPkg() { + return loadJSON("./package.json"); +} + +function getPackageJSONPaths() { + const rootPkg = getRootPkg(); + const paths = ["./package.json"]; + for (const workspace of rootPkg.workspaces) { + paths.push(`${workspace}/package.json`); + }; + return paths; +} + function loadPackages({ log = false } = {}) { - const rootPkg = loadJSON("./package.json"); + const rootPkg = getRootPkg(); const pkgs = {}; for (const workspace of rootPkg.workspaces) { const pkg = loadJSON(`${workspace}/package.json`); @@ -25,4 +38,4 @@ const dependencyKeys = [ "optionalDependencies" ]; -module.exports = { loadJSON, loadPackages, dependencyKeys }; +module.exports = { loadJSON, getRootPkg, getPackageJSONPaths, loadPackages, dependencyKeys }; diff --git a/types/package.json b/types/package.json index 416a39e..9b3e0d4 100644 --- a/types/package.json +++ b/types/package.json @@ -1,6 +1,6 @@ { "name": "@gillianplatform/sedap-types", - "version": "0.0.4", + "version": "0.0.5", "description": "SEDAP types for TypeScript", "repository":"https://github.com/gillianplatform/sedap-js", "types": "./src/index.d.ts", diff --git a/vscode/ext/package.json b/vscode/ext/package.json index 19cf043..ca73d2e 100644 --- a/vscode/ext/package.json +++ b/vscode/ext/package.json @@ -1,6 +1,6 @@ { "name": "@gillianplatform/sedap-vscode-ext", - "version": "0.0.4", + "version": "0.0.5", "description": "SEDAP-related utilities for VSCode extensions", "repository":"https://github.com/gillianplatform/sedap-js", "type": "commonjs", @@ -27,8 +27,8 @@ "@eslint/compat": "^1.2.4", "@eslint/eslintrc": "^3.2.0", "@eslint/js": "^9.17.0", - "@gillianplatform/sedap-types": "0.0.4", - "@gillianplatform/sedap-vscode-types": "0.0.4", + "@gillianplatform/sedap-types": "0.0.5", + "@gillianplatform/sedap-vscode-types": "0.0.5", "@types/vscode": "^1.96.0", "@typescript-eslint/eslint-plugin": "^8.18.2", "@typescript-eslint/parser": "^8.18.2", diff --git a/vscode/types/package.json b/vscode/types/package.json index 4698edc..d09be0c 100644 --- a/vscode/types/package.json +++ b/vscode/types/package.json @@ -1,6 +1,6 @@ { "name": "@gillianplatform/sedap-vscode-types", - "version": "0.0.4", + "version": "0.0.5", "description": "Types for SEDAP VSCode helper libraries", "repository":"https://github.com/gillianplatform/sedap-js", "types": "./src/index.d.ts", @@ -8,7 +8,7 @@ "author": "", "license": "ISC", "devDependencies": { - "@gillianplatform/sedap-types": "0.0.4", + "@gillianplatform/sedap-types": "0.0.5", "typescript": "^5.7.2" } } diff --git a/vscode/ui/package.json b/vscode/ui/package.json index 2947334..04810b3 100644 --- a/vscode/ui/package.json +++ b/vscode/ui/package.json @@ -1,6 +1,6 @@ { "name": "@gillianplatform/sedap-vscode-ui", - "version": "0.0.4", + "version": "0.0.5", "description": "SEDAP-related utilities for webviews inside VSCode extensions", "repository":"https://github.com/gillianplatform/sedap-js", "type": "module", @@ -25,8 +25,8 @@ "@eslint/compat": "^1.2.4", "@eslint/eslintrc": "^3.2.0", "@eslint/js": "^9.17.0", - "@gillianplatform/sedap-types": "0.0.4", - "@gillianplatform/sedap-vscode-types": "0.0.4", + "@gillianplatform/sedap-types": "0.0.5", + "@gillianplatform/sedap-vscode-types": "0.0.5", "@types/react": "^19.0.2", "@types/vscode-webview": "^1.57.5", "@typescript-eslint/eslint-plugin": "^8.18.2", @@ -46,7 +46,7 @@ "vite-plugin-dts": "^4.4.0" }, "peerDependencies": { - "@gillianplatform/sedap-react": "0.0.4", + "@gillianplatform/sedap-react": "0.0.5", "react": "^19.0.0", "react-icons": "^5.4.0" },