diff --git a/ide/packages/common/src/lib.ts b/ide/packages/common/src/lib.ts index 71afec4..90ec146 100644 --- a/ide/packages/common/src/lib.ts +++ b/ide/packages/common/src/lib.ts @@ -180,6 +180,12 @@ export type CallArgus = ( // Type predicates (these shouldn't really exist ...) +export function isSysMsg( + obj: any +): obj is SystemToPanoptesMsg { + return typeof obj === "object" && "command" in obj; +} + export function isSysMsgOpenError( msg: SystemToPanoptesMsg ): msg is SystemToPanoptesMsg<"open-error"> { diff --git a/ide/packages/panoptes/package.json b/ide/packages/panoptes/package.json index 3caeff1..e48da89 100644 --- a/ide/packages/panoptes/package.json +++ b/ide/packages/panoptes/package.json @@ -1,6 +1,7 @@ { "name": "@argus/panoptes", "version": "0.0.1", + "main": "dist/panoptes.iife.js", "depot": { "platform": "browser" }, @@ -31,4 +32,4 @@ "react-json-view": "^1.21.3", "vite": "^4.4.9" } -} \ No newline at end of file +} diff --git a/ide/packages/panoptes/src/App.tsx b/ide/packages/panoptes/src/App.tsx index 01f55e6..fa89c0a 100644 --- a/ide/packages/panoptes/src/App.tsx +++ b/ide/packages/panoptes/src/App.tsx @@ -3,8 +3,7 @@ import { EvaluationMode, PanoptesConfig, SystemSpec, - SystemToPanoptesCmds, - SystemToPanoptesMsg, + isSysMsg, isSysMsgOpenError, isSysMsgOpenFile, isSysMsgReset, @@ -53,9 +52,10 @@ const App = observer(({ config }: { config: PanoptesConfig }) => { const { payload, }: { - payload: SystemToPanoptesMsg; + payload: any; } = e.data; + if (!isSysMsg(payload)) return; console.debug("Received message from system", payload); if (isSysMsgOpenError(payload)) { diff --git a/ide/packages/panoptes/src/TreeView/TreeInfo.ts b/ide/packages/panoptes/src/TreeView/TreeInfo.ts index befbc17..61d7f0b 100644 --- a/ide/packages/panoptes/src/TreeView/TreeInfo.ts +++ b/ide/packages/panoptes/src/TreeView/TreeInfo.ts @@ -10,8 +10,6 @@ import { } from "@argus/common/bindings"; import _ from "lodash"; -import { isHiddenObl, isTraitClause } from "../utilities/func"; - type MultiRecord = Record; type Direction = "to-root" | "from-root"; diff --git a/ide/packages/panoptes/src/main.tsx b/ide/packages/panoptes/src/main.tsx index 13fc951..bed343f 100644 --- a/ide/packages/panoptes/src/main.tsx +++ b/ide/packages/panoptes/src/main.tsx @@ -1,8 +1,4 @@ -import { - ConfigConsts, - PanoptesConfig, - maybeStringToConfig, -} from "@argus/common/lib"; +import { ConfigConsts, maybeStringToConfig } from "@argus/common/lib"; import * as React from "react"; import * as ReactDOM from "react-dom/client"; @@ -29,6 +25,6 @@ window.initializeArgusBlocks = (root: HTMLElement) => { window.addEventListener( "load", - () => initializeArgusBlocks(document.body), + () => window.initializeArgusBlocks(document.body), false ); diff --git a/ide/packages/panoptes/src/print/private/ty.tsx b/ide/packages/panoptes/src/print/private/ty.tsx index c77adeb..5d1360d 100644 --- a/ide/packages/panoptes/src/print/private/ty.tsx +++ b/ide/packages/panoptes/src/print/private/ty.tsx @@ -38,7 +38,6 @@ import { PrintConst } from "./const"; import { PrintDefPath } from "./path"; import { Angled, - CBraced, CommaSeparated, DBraced, Parenthesized,