diff --git a/bun.lock b/bun.lock index c095a86c5..3ba2c0b19 100644 --- a/bun.lock +++ b/bun.lock @@ -35,7 +35,7 @@ "electron-vite": "^5.0.0", "esbuild": "^0.28.2", "node-addon-api": "^8.9.2", - "postcss": "^8.5.28", + "postcss": "^8.5.29", "rollup-plugin-visualizer": "^7.1.1", "stylelint": "^17.16.0", "stylelint-config-standard": "^40.0.0", @@ -988,7 +988,7 @@ "plist": ["plist@3.1.0", "", { "dependencies": { "@xmldom/xmldom": "^0.8.8", "base64-js": "^1.5.1", "xmlbuilder": "^15.1.1" } }, "sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ=="], - "postcss": ["postcss@8.5.28", "", { "dependencies": { "nanoid": "^3.3.18", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A=="], + "postcss": ["postcss@8.5.29", "", { "dependencies": { "nanoid": "^3.3.19", "picocolors": "^1.1.1", "source-map-js": "^1.2.2" } }, "sha512-49cGhUbXj8Qenv0iTMxA1cFBzxXoctpC9Ujd77t1WcbJIr6nF/eI7g/8MgxrYldFRuAXvja7xQRwavoW7kgrxQ=="], "postcss-safe-parser": ["postcss-safe-parser@7.1.0", "", { "peerDependencies": { "postcss": "^8.4.31" } }, "sha512-1WzZxRLaAFwEh6Do+zyGpjWV3nGJNxxhuh7Ubu/q1ICImMgZJnLwhoaEpRbG4pJppp2Y1ncL9ffA2f+LhrefQg=="], @@ -1248,7 +1248,7 @@ "@tailwindcss/oxide-wasm32-wasi/@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.3", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g=="], - "@tailwindcss/oxide-wasm32-wasi/@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.2.4", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" }, "bundled": true }, "sha512-AJxoUD2/15ESHbvpcyjU274nsAPLuOtPHCk0vKJM5pj//Fg/B1FXNWjPnXTT9PymCYYiHo4zPj0ZomXBKhoy7g=="], + "@tailwindcss/oxide-wasm32-wasi/@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.2.5", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" }, "bundled": true }, "sha512-HshSvXzmBxNzqejd3k/KemgQ3hdREUYFRRrgxOZ+gPljDIsO2SDZrVZMd4Z/HsxudQbE62OVyVFE8z9BCurfjA=="], "@tailwindcss/oxide-wasm32-wasi/@tybys/wasm-util": ["@tybys/wasm-util@0.10.4", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A=="], diff --git a/package.json b/package.json index 6b9bc4b98..c65bf6d99 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "url": "git+https://github.com/opencor/webapp.git" }, "type": "module", - "version": "1.20261005.0", + "version": "1.20261005.1", "engines": { "bun": ">=1.2.0" }, @@ -86,7 +86,7 @@ "electron-vite": "^5.0.0", "esbuild": "^0.28.2", "node-addon-api": "^8.9.2", - "postcss": "^8.5.28", + "postcss": "^8.5.29", "rollup-plugin-visualizer": "^7.1.1", "stylelint": "^17.16.0", "stylelint-config-standard": "^40.0.0", diff --git a/src/renderer/bun.lock b/src/renderer/bun.lock index 28fb19bef..4fc3d4854 100644 --- a/src/renderer/bun.lock +++ b/src/renderer/bun.lock @@ -25,7 +25,7 @@ "@vue/tsconfig": "^0.9.1", "autoprefixer": "^10.6.1", "esbuild": "^0.28.2", - "postcss": "^8.5.28", + "postcss": "^8.5.29", "rollup-plugin-visualizer": "^7.1.1", "stylelint": "^17.16.0", "stylelint-config-standard": "^40.0.0", @@ -623,7 +623,7 @@ "pkg-types": ["pkg-types@2.3.3", "", { "dependencies": { "confbox": "^0.3.1", "exsolve": "^1.1.1", "pathe": "^2.0.3" } }, "sha512-j/lCFdcppV0JxWpCEITdbDltBxPP6cHT+yNJ6Go2OgoSA9518X847X9z0p6LtA4Nc16+eQzCZjRrWanTGvHJ5w=="], - "postcss": ["postcss@8.5.28", "", { "dependencies": { "nanoid": "^3.3.18", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A=="], + "postcss": ["postcss@8.5.29", "", { "dependencies": { "nanoid": "^3.3.19", "picocolors": "^1.1.1", "source-map-js": "^1.2.2" } }, "sha512-49cGhUbXj8Qenv0iTMxA1cFBzxXoctpC9Ujd77t1WcbJIr6nF/eI7g/8MgxrYldFRuAXvja7xQRwavoW7kgrxQ=="], "postcss-safe-parser": ["postcss-safe-parser@7.1.0", "", { "peerDependencies": { "postcss": "^8.4.31" } }, "sha512-1WzZxRLaAFwEh6Do+zyGpjWV3nGJNxxhuh7Ubu/q1ICImMgZJnLwhoaEpRbG4pJppp2Y1ncL9ffA2f+LhrefQg=="], @@ -753,7 +753,7 @@ "@tailwindcss/oxide-wasm32-wasi/@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.3", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g=="], - "@tailwindcss/oxide-wasm32-wasi/@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.2.4", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" }, "bundled": true }, "sha512-AJxoUD2/15ESHbvpcyjU274nsAPLuOtPHCk0vKJM5pj//Fg/B1FXNWjPnXTT9PymCYYiHo4zPj0ZomXBKhoy7g=="], + "@tailwindcss/oxide-wasm32-wasi/@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.2.5", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" }, "bundled": true }, "sha512-HshSvXzmBxNzqejd3k/KemgQ3hdREUYFRRrgxOZ+gPljDIsO2SDZrVZMd4Z/HsxudQbE62OVyVFE8z9BCurfjA=="], "@tailwindcss/oxide-wasm32-wasi/@tybys/wasm-util": ["@tybys/wasm-util@0.10.4", "", { "dependencies": { "tslib": "^2.4.0" }, "bundled": true }, "sha512-W3c4gRigFS0T/Ma4qIYF3GDAc5AQdHb1yL5znJT1Zv1YaD9Kitx656wBjvr19qbiosmZT8lWDM5BEMynUqX65A=="], diff --git a/src/renderer/package.json b/src/renderer/package.json index f588496ba..e867220ff 100644 --- a/src/renderer/package.json +++ b/src/renderer/package.json @@ -42,7 +42,7 @@ }, "./style.css": "./dist/opencor.css" }, - "version": "1.20261005.0", + "version": "1.20261005.1", "libopencorVersion": "1.20260803.0", "scripts": { "build": "vite build && bun scripts/generate.version.ts", @@ -87,7 +87,7 @@ "@vue/tsconfig": "^0.9.1", "autoprefixer": "^10.6.1", "esbuild": "^0.28.2", - "postcss": "^8.5.28", + "postcss": "^8.5.29", "rollup-plugin-visualizer": "^7.1.1", "stylelint": "^17.16.0", "stylelint-config-standard": "^40.0.0", diff --git a/src/renderer/src/components/views/SimulationExperimentInteractiveView.vue b/src/renderer/src/components/views/SimulationExperimentInteractiveView.vue index 4aefaa7cc..314124ead 100644 --- a/src/renderer/src/components/views/SimulationExperimentInteractiveView.vue +++ b/src/renderer/src/components/views/SimulationExperimentInteractiveView.vue @@ -284,7 +284,7 @@ const uiJsonEmpty = vue.computed(() => { }); const mathEval = new math.Float64ArrayMath(); -const model = document.model(0); +const model = isDocumentValid ? document.model(0) : null; const isSimulating = vue.ref(false); const liveData = vue.ref([]); let margins: Record = {}; @@ -1049,9 +1049,9 @@ const reinstantiateInstance = (): locApi.SedInstance => { // Run the interactive simulation. const updateSimulation = async (): Promise => { - // Make sure that the view is usable, i.e. that we have an instance. + // Make sure that the view is usable, i.e. that we have a model and an instance. - if (!instance) { + if (!model || !instance) { return; } @@ -1649,7 +1649,7 @@ const onToggleRunColorPopover = (index: number, event: MouseEvent): void => { const onDownloadCombineArchive = (): void => { const jsZip = new dependencies._jsZip(); const baseFileName = common.fileName(props.file.path()).replace(/\.[^/.]+$/, ''); - const modelFile = model.file(); + const modelFile = model?.file(); if (!modelFile) { emit('error', 'Cannot create COMBINE archive: no model file available.'); diff --git a/src/renderer/src/libopencor/locFileApi.ts b/src/renderer/src/libopencor/locFileApi.ts index 8c1f5f12a..4cec3b221 100644 --- a/src/renderer/src/libopencor/locFileApi.ts +++ b/src/renderer/src/libopencor/locFileApi.ts @@ -141,7 +141,7 @@ export class File { } document(): SedDocument { - return new SedDocument(this._path, this._wasmFile); + return new SedDocument(this._path, this._wasmFile, this._issues); } uiJson(): IUiJson | undefined { diff --git a/src/renderer/src/libopencor/locSedApi.ts b/src/renderer/src/libopencor/locSedApi.ts index 27e5d73a8..19420ae4f 100644 --- a/src/renderer/src/libopencor/locSedApi.ts +++ b/src/renderer/src/libopencor/locSedApi.ts @@ -38,7 +38,16 @@ export class SedDocument { private _wasmSedDocument: IWasmSedDocument = {} as IWasmSedDocument; private _issues: IIssue[] = []; - constructor(filePath: string, wasmFile: IWasmFile) { + constructor(filePath: string, wasmFile: IWasmFile, fileIssues: IIssue[]) { + // If the file has some errors (e.g., an invalid CellML file), then report its issues rather than those of the + // SED-ML document (since those are likely to be a consequence of the file's errors). + + if (fileIssues.some((issue: IIssue) => issue.type === EIssueType.ERROR)) { + this._issues = [...fileIssues]; + + return; + } + // Create the SED-ML document. if (cppVersion()) { @@ -53,6 +62,12 @@ export class SedDocument { ? _cppLocApi.sedDocumentIssues(this._cppDocumentId) : wasmIssuesToIssues(this._wasmSedDocument.issues); + // Don't check anything else if the SED-ML document already has some errors. + + if (this._issues.some((issue: IIssue) => issue.type === EIssueType.ERROR)) { + return; + } + // TODO: we only support a limited subset of SED-ML for now, so we need to check a few more things. Might wnat to // check https://github.com/opencor/opencor/blob/master/src/plugins/support/SEDMLSupport/src/sedmlfile.cpp#L579-L1492.