Skip to content

AI-native design editor. Open-source Figma alternative.

fix: explain unsupported browsers instead of a blank window (#745)

Danila Poyarkov8131401ead4f
diff --git a/AGENTS.md b/AGENTS.md
index 2a9e63686..fff9dcd10 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -181,6 +181,7 @@ Private tooling belongs under `tools/<domain>/{src,tests}`, with kebab-case doma
- Components must not hold module-level mutable state. Share repeated logic/constants rather than copying it.
- Keep Kiwi runtime changes minimal; prefer wrappers for project policy.
- Guard browser globals explicitly in Core. Name repeated/cross-feature constants; app-wide values belong in `src/constants.ts`.
+- The supported browser baseline lives in `src/app/shell/support/baseline.ts` and feeds the Vite `build.target`, the startup gate, and the documented system requirements; change all three together, including `desktop/tauri.conf.json` `minimumSystemVersion`. Vite lowers syntax but never polyfills APIs, so two data-driven checks enforce the baseline: the app and browser-shipped packages pin TypeScript `lib` to ES2023 (the last edition those engines implement fully), so newer built-ins fail type-checking, and `compat/compat` (`eslint-plugin-compat` under oxlint, fed the same browsers from `settings.browsers`) rejects Web APIs they lack. Do not raise the lib to `ESNext` in those tsconfigs; use `createDeferred()` from `src/app/runtime/deferred.ts` instead of `Promise.withResolvers()`. Node-only packages (`cli`, `mcp`, `harness`) are exempt from both. `tests/app/shell/support/baseline.test.ts` keeps the tsconfigs and oxlint browsers in step with the baseline. `src/main.ts` must stay a tiny gate that only dynamically imports `src/boot.ts`, so an unsupported engine can still render `src/app/shell/support/` guidance.
## Issue and PR writing
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9d40fd849..7ecf21caf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,15 @@
## Unreleased
+### Breaking changes
+
+- The desktop app now requires macOS 13 or later; the web app supports Chrome 111, Edge 111, Firefox 128, and Safari 16.4 or later.
+
+### Fixed
+
+- Show what to update instead of a blank window when the browser or system WebView is too old, naming the detected macOS, Safari, Chrome, Edge, Firefox, WebKitGTK, or WebView2 version and linking a prefilled bug report, and explain a failed start the same way (#744).
+- Start on macOS 13 with WebKit older than Safari 17.4, which previously failed with `Promise.withResolvers is not a function` (#744).
+
## 0.15.1 — 2026-09-18
### Added
diff --git a/README.md b/README.md
index 2de909d38..eb459dbc4 100644
--- a/README.md
+++ b/README.md
@@ -23,6 +23,8 @@ brew install --cask openpencil
Or download from the [releases page](https://github.com/open-pencil/open-pencil/releases/latest), or [use the web app](https://app.openpencil.dev) — no install needed.
+Requires macOS 13 or later with current Safari updates, Windows 10 or later, or Linux with WebKitGTK 2.40+; the web app needs Chrome 111, Edge 111, Firefox 128, or Safari 16.4 or later. See [system requirements](https://openpencil.dev/getting-started#system-requirements).
+
## What it does
- **Opens `.fig` and `.pen` files** — read and write native Figma files, open supported Pencil documents from the app or OS file browser, copy & paste nodes between apps
diff --git a/bun.lock b/bun.lock
index cb40799e1..70925c001 100644
--- a/bun.lock
+++ b/bun.lock
@@ -44,6 +44,7 @@
"@tauri-apps/plugin-dialog": "^2.7.2",
"@tauri-apps/plugin-fs": "^2.5.1",
"@tauri-apps/plugin-opener": "^2.5.4",
+ "@tauri-apps/plugin-os": "^2.3.2",
"@tauri-apps/plugin-process": "^2.3.1",
"@tauri-apps/plugin-shell": "^2.3.5",
"@tauri-apps/plugin-updater": "^2.10.1",
@@ -124,6 +125,7 @@
"changelog-parser": "^4.1.0",
"cloudflare-redirect-parser": "^1.0.0",
"esbuild": "^0.27.7",
+ "eslint-plugin-compat": "^7.0.2",
"expect-webdriverio": "5.7.0",
"fake-indexeddb": "^6.2.5",
"franc": "^6.2.0",
@@ -1257,6 +1259,8 @@
"@markmend/parser": ["@markmend/[email protected]", "", { "dependencies": { "@markmend/core": "2.0.0-beta.5", "comark": "^0.7.0", "markdown-it-cjk-friendly": "^3.0.0" } }, "sha512-mmunqKU/O2kuJnYOLhBd47h+ordfwnv+J+fNGuZLz4mk42YNb0Qq1r/Nb97hE09FNqt42cWVZbP/EDuC81ck+A=="],
+ "@mdn/browser-compat-data": ["@mdn/[email protected]", "", {}, "sha512-PzdZZzRhcXvKB0begee28n5lvwAcinGKYuLZOVxHAZm+n7y01ddEGfdS1ZXRuVcV+ndG6mSEAE8vgudom5UjYg=="],
+
"@mdx-js/react": ["@mdx-js/[email protected]", "", { "dependencies": { "@types/mdx": "^2.0.0" }, "peerDependencies": { "@types/react": ">=16", "react": ">=16" } }, "sha512-f++rKLQgUVYDAtECQ6fn/is15GkEH9+nZPM3MS0RcxVqoTfawHvDlSCH7JbMhAM6uJ32v3eXLvLmLvjGu7PTQw=="],
"@mistralai/mistralai": ["@mistralai/[email protected]", "", { "dependencies": { "@opentelemetry/semantic-conventions": "^1.40.0", "ws": "^8.18.0", "zod": "^3.25.0 || ^4.0.0", "zod-to-json-schema": "^3.25.0" }, "peerDependencies": { "@opentelemetry/api": "^1.9.0", "@opentelemetry/exporter-trace-otlp-http": "^0.220.0", "@opentelemetry/resources": "^2.9.0", "@opentelemetry/sdk-trace-base": "^2.9.0" }, "optionalPeers": ["@opentelemetry/api", "@opentelemetry/exporter-trace-otlp-http", "@opentelemetry/resources", "@opentelemetry/sdk-trace-base"] }, "sha512-4nOSDZTJXnmfsDtPFZEX4tAaJwIP2xyZwka9XK7ueNmOX0DuVhu2Ph2uWEeBMaNjpXbnVgmXLZ2Q58vFd8gsgg=="],
@@ -1829,6 +1833,8 @@
"@tauri-apps/plugin-opener": ["@tauri-apps/[email protected]", "", { "dependencies": { "@tauri-apps/api": "^2.11.0" } }, "sha512-1HnPkb+AmgO29HBazm4uPLKB+r7zzcTBW1d0fyYp1uP+jwtpoiNDGKMMzz58SFp49nOIrxdE3aUJtT57lfO9CQ=="],
+ "@tauri-apps/plugin-os": ["@tauri-apps/[email protected]", "", { "dependencies": { "@tauri-apps/api": "^2.8.0" } }, "sha512-n+nXWeuSeF9wcEsSPmRnBEGrRgOy6jjkSU+UVCOV8YUGKb2erhDOxis7IqRXiRVHhY8XMKks00BJ0OAdkpf6+A=="],
+
"@tauri-apps/plugin-process": ["@tauri-apps/[email protected]", "", { "dependencies": { "@tauri-apps/api": "^2.8.0" } }, "sha512-nCa4fGVaDL/B9ai03VyPOjfAHRHSBz5v6F/ObsB73r/dA3MHHhZtldaDMIc0V/pnUw9ehzr2iEG+XkSEyC0JJA=="],
"@tauri-apps/plugin-shell": ["@tauri-apps/[email protected]", "", { "dependencies": { "@tauri-apps/api": "^2.10.1" } }, "sha512-jewtULhiQ7lI7+owCKAjc8tYLJr92U16bPOeAa472LHJdgaibLP83NcfAF2e+wkEcA53FxKQAZ7byDzs2eeizg=="],
@@ -2217,6 +2223,8 @@
"ast-kit": ["[email protected]", "", { "dependencies": { "@babel/parser": "^7.28.5", "pathe": "^2.0.3" } }, "sha512-m1Q/RaVOnTp9JxPX+F+Zn7IcLYMzM8kZofDImfsKZd8MbR+ikdOzTeztStWqfrqIxZnYWryyI9ePm3NGjnZgGw=="],
+ "ast-metadata-inferer": ["[email protected]", "", { "dependencies": { "@mdn/browser-compat-data": "^5.6.19" } }, "sha512-ht3Dm6Zr7SXv6t1Ra6gFo0+kLDglHGrEbYihTkcycrbHw7WCcuhBzPlJYHEsIpycaUwzsJHje+vUcxXUX4ztTA=="],
+
"ast-module-types": ["[email protected]", "", {}, "sha512-6KuK/7nZ/2Qh7sGuVEiwxjCxzTY2Pdb5mTo5z1e6/J8BA0tvjR7G8vQJKrQMTqwmnA3UPEyKIFX4YUS1DO1Hvw=="],
"ast-types": ["[email protected]", "", { "dependencies": { "tslib": "^2.0.1" } }, "sha512-6t10qk83GOG8p0vKmaCr8eiilZwO171AvbROMtvvNiwrTly62t+7XkA8RdIIVbpMhCASAsxgAzdRSwh6nw/5Dg=="],
@@ -2267,7 +2275,7 @@
"base64-js": ["[email protected]", "", {}, "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA=="],
- "baseline-browser-mapping": ["[email protected]", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-FwMjJJ7HnyZpWe+oWxegG0fezZyBZUagI5LZEoO3GCbtbKNwRfMH9Ue5d5v01PNePBy1QSfPSDTTeVL0Hb9EzA=="],
+ "baseline-browser-mapping": ["[email protected]", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-gMmEShwwq7FJqMwvfRwvCl00v4kN+KOfJqXn+f4nrufak5gNHJOksd/60Dvjuz7sI8Y5WiSFBa8FEYr+zoyqCw=="],
"basic-ftp": ["[email protected]", "", {}, "sha512-bopVNp6ugyA150DDuZfPFdt1KZ5a94ZDiwX4hMgZDzF+GttD80lEy8kj98kbyhLXnPvhtIo93mdnLIjpCAeeOw=="],
@@ -2299,7 +2307,7 @@
"browser-stdout": ["[email protected]", "", {}, "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw=="],
- "browserslist": ["[email protected]", "", { "dependencies": { "baseline-browser-mapping": "^2.11.12", "caniuse-lite": "^1.0.30001809", "electron-to-chromium": "^1.5.402", "node-releases": "^2.0.53", "update-browserslist-db": "^1.3.0" }, "bin": { "browserslist": "cli.js" } }, "sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA=="],
+ "browserslist": ["[email protected]", "", { "dependencies": { "baseline-browser-mapping": "^2.11.23", "caniuse-lite": "^1.0.30001810", "electron-to-chromium": "^1.5.427", "node-releases": "^2.0.55", "update-browserslist-db": "^1.3.3" }, "bin": { "browserslist": "cli.js" } }, "sha512-3GSvyjvDI4Dur1Meg2BekJquu5uF+9R9a1+5M1Mde192eZoXbeXjzgOsgqPS2V8D5wrrip0gR5Hf/GhWQ9ZzaA=="],
"buffer": ["[email protected]", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.2.1" } }, "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA=="],
@@ -2327,7 +2335,7 @@
"camelcase": ["[email protected]", "", {}, "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA=="],
- "caniuse-lite": ["[email protected]", "", {}, "sha512-xxWVywk6a6Arlk+hymeycyn/VgqEfLDxupvhH/xiY5SJ/18kmi9o6MiO320DCUzypORHLtvh0I4i04tUhCNHNQ=="],
+ "caniuse-lite": ["[email protected]", "", {}, "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg=="],
"canvaskit-wasm": ["[email protected]", "", { "dependencies": { "@webgpu/types": "0.1.21" } }, "sha512-gO2rNMIE0lOQ8MaarM4qNeq2zZAEknAObKP2XAKidMSAY8P5sURGdFkrx1TSdHuBFqTf5w35JqjuUzjibqkD5g=="],
@@ -2593,7 +2601,7 @@
"ejs": ["[email protected]", "", { "dependencies": { "jake": "^10.8.5" }, "bin": { "ejs": "bin/cli.js" } }, "sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA=="],
- "electron-to-chromium": ["[email protected]", "", {}, "sha512-gglkxzokjHfawpGxq75XdBV2/l3BAPzrsMs70qgaZdTW5rpV1tC4MdgJVP9fN126bODA4ZJQkn1wryEzJyQXIg=="],
+ "electron-to-chromium": ["[email protected]", "", {}, "sha512-5lCAbyZBjtmUt/RAGHRqrL2q0oEFRThDAsZHHDn9XHa89Qw7gMYOeSicBTy+AHfvo0r6vwsZvqNJTQIQy1BLzA=="],
"emoji-regex": ["[email protected]", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
@@ -2645,6 +2653,8 @@
"eslint": ["[email protected]", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.2", "@eslint/config-array": "^0.23.5", "@eslint/config-helpers": "^0.7.0", "@eslint/core": "^1.2.1", "@eslint/plugin-kit": "^0.7.2", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "ajv": "^6.14.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^9.1.2", "eslint-visitor-keys": "^5.0.1", "espree": "^11.2.0", "esquery": "^1.7.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "minimatch": "^10.2.5", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-9VaAkDURekixUQJy0oJYl2DcN6oKMfxay7XzaGYAWQwsb6qfKf+x76R2k1L8kb1boc+FyCAaTA9GmiKaaiaF+A=="],
+ "eslint-plugin-compat": ["[email protected]", "", { "dependencies": { "@mdn/browser-compat-data": "^6.1.1", "ast-metadata-inferer": "^0.8.1", "browserslist": "^4.25.2", "find-up": "^5.0.0", "globals": "^15.7.0", "lodash.memoize": "^4.1.2", "semver": "^7.6.2" }, "peerDependencies": { "eslint": "^9.0.0 || ^10.0.0" } }, "sha512-gN8hF+4NzMsHUbr4m/TYZK0FtW3DcV4g8rXpTsY2EV5xiRD8jsilUlB9lNSkGGX0veDCxMhKSWbSd+faJByQDA=="],
+
"eslint-scope": ["[email protected]", "", { "dependencies": { "@types/esrecurse": "^4.3.1", "@types/estree": "^1.0.8", "esrecurse": "^4.3.0", "estraverse": "^5.2.0" } }, "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ=="],
"eslint-visitor-keys": ["[email protected]", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="],
@@ -2861,6 +2871,8 @@
"global-directory": ["[email protected]", "", { "dependencies": { "ini": "6.0.0" } }, "sha512-1pgFdhK3J2LeM+dVf2Pd424yHx2ou338lC0ErNP2hPx4j8eW1Sp0XqSjNxtk6Tc4Kr5wlWtSvz8cn2yb7/SG/w=="],
+ "globals": ["[email protected]", "", {}, "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg=="],
+
"globalthis": ["[email protected]", "", { "dependencies": { "define-properties": "^1.2.1", "gopd": "^1.0.1" } }, "sha512-DpLKbNU4WylpxJykQujfCcwYWiV/Jhm50Goo0wrVILAv5jOr9d+H+UR3PhSCD2rCCEIg0uc+G+muBTwD54JhDQ=="],
"globby": ["[email protected]", "", { "dependencies": { "@sindresorhus/merge-streams": "^2.1.0", "fast-glob": "^3.3.3", "ignore": "^7.0.3", "path-type": "^6.0.0", "slash": "^5.1.0", "unicorn-magic": "^0.3.0" } }, "sha512-0Ia46fDOaT7k4og1PDW4YbodWWr3scS2vAr2lTbsplOt2WkKp0vQbkI9wKis/T5LV/dqPjO3bpS/z6GTJB82LA=="],
@@ -3263,6 +3275,8 @@
"lodash.flattendeep": ["[email protected]", "", {}, "sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ=="],
+ "lodash.memoize": ["[email protected]", "", {}, "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag=="],
+
"lodash.pickby": ["[email protected]", "", {}, "sha512-AZV+GsS/6ckvPOVQPXSiFFacKvKB4kOQu6ynt9wz0F3LO4R9Ij4K1ddYsIytDpSgLz88JHd9P+oaLeej5/Sl7Q=="],
"lodash.union": ["[email protected]", "", {}, "sha512-c4pB2CdGrGdjMKYLA+XiRDO7Y0PRQbm/Gzg8qMj+QH+pFVAoTp5sBpO0odL3FjoPCGjK96p6qsP+yQoiLoOBcw=="],
@@ -3485,7 +3499,7 @@
"node-liblzma": ["[email protected]", "", { "dependencies": { "node-addon-api": "^8.5.0", "node-gyp-build": "^4.8.4" }, "bin": { "nxz": "lib/cli/nxz.js" } }, "sha512-s0KzNOWwOJJgPG6wxg6cKohnAl9Wk/oW1KrQaVzJBjQwVcUGPQCzpR46Ximygjqj/3KhOrtJXnYMp/xYAXp75g=="],
- "node-releases": ["[email protected]", "", {}, "sha512-D9UOmYG3UH1V+ENW56t5QXBwJw1YEY18ruVeus89Rw+SyIgjPkCO84bRzO3uNIYosJbNwiabWVn48o3uJLjxFQ=="],
+ "node-releases": ["[email protected]", "", {}, "sha512-x0InOIyzgdk+eyaWaRJFH5snEtiImgBgblZ2CyPrLmqqcuMQkEvcDPHbzqbD8eDsSeJbVOjn+crzyzHaM4D+/A=="],
"node-sarif-builder": ["[email protected]", "", { "dependencies": { "@types/sarif": "^2.1.7", "fs-extra": "^11.1.1" } }, "sha512-IWqZF6u0EI/07HTBm+zZ+MgXgWl09dnSJRGaDCPBSlOqilDcx6pj3Mpb3HvPN8V2Gr+ISw7ZrMsL7STWs1F++w=="],
@@ -4283,7 +4297,7 @@
"upath": ["[email protected]", "", {}, "sha512-aZwGpamFO61g3OlfT7OQCHqhGnW43ieH9WZeP7QxN/G/jS4jfqUkZxoryvJgVPEcrl5NL/ggHsSmLMHuH64Lhg=="],
- "update-browserslist-db": ["[email protected]", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-ZZ61DsRsOnakl74HAmp3oSN4aXUmEWXf+i/yv0h7tIBfICc3VdrFErQKUUKPgu3AMsTUMbcongALEN4l6GSUrQ=="],
+ "update-browserslist-db": ["[email protected]", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-pJ2sYawQS0R/WI928Gj5GlPhTGzbMelq0+4INtSYNDV9ErKJcX6xjGWkoG/VnB3dpUm00zALaqkrUD77pO5TDQ=="],
"uri-js": ["[email protected]", "", { "dependencies": { "punycode": "^2.1.0" } }, "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg=="],
@@ -4515,6 +4529,8 @@
"@babel/generator/@babel/types": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-string-parser": "^8.0.0", "@babel/helper-validator-identifier": "^8.0.4" } }, "sha512-eY+Yn3dCqTGmyiq2QRU66lA5FL8lqqqvecHt0fF3uHONIa7ToYsaCiWV8lOKqAs0Rb2SjixiKFROngnulPtt2g=="],
+ "@babel/helper-compilation-targets/browserslist": ["[email protected]", "", { "dependencies": { "baseline-browser-mapping": "^2.11.12", "caniuse-lite": "^1.0.30001809", "electron-to-chromium": "^1.5.402", "node-releases": "^2.0.53", "update-browserslist-db": "^1.3.0" }, "bin": { "browserslist": "cli.js" } }, "sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA=="],
+
"@babel/helper-compilation-targets/lru-cache": ["[email protected]", "", { "dependencies": { "yallist": "^3.0.2" } }, "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w=="],
"@babel/helper-compilation-targets/semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
@@ -4701,6 +4717,8 @@
"archiver-utils/is-stream": ["[email protected]", "", {}, "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg=="],
+ "ast-metadata-inferer/@mdn/browser-compat-data": ["@mdn/[email protected]", "", {}, "sha512-7xdrMX0Wk7grrTZQwAoy1GkvPMFoizStUoL+VmtUkAxegbCCec+3FKwOM6yc/uGU5+BEczQHXAlWiqvM8JeENg=="],
+
"babel-plugin-polyfill-corejs2/semver": ["[email protected]", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="],
"blamer/execa": ["[email protected]", "", { "dependencies": { "cross-spawn": "^7.0.0", "get-stream": "^5.0.0", "human-signals": "^1.1.1", "is-stream": "^2.0.0", "merge-stream": "^2.0.0", "npm-run-path": "^4.0.0", "onetime": "^5.1.0", "signal-exit": "^3.0.2", "strip-final-newline": "^2.0.0" } }, "sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA=="],
@@ -4729,6 +4747,8 @@
"concat-stream/readable-stream": ["[email protected]", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="],
+ "core-js-compat/browserslist": ["[email protected]", "", { "dependencies": { "baseline-browser-mapping": "^2.11.12", "caniuse-lite": "^1.0.30001809", "electron-to-chromium": "^1.5.402", "node-releases": "^2.0.53", "update-browserslist-db": "^1.3.0" }, "bin": { "browserslist": "cli.js" } }, "sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA=="],
+
"cosmiconfig-typescript-loader/jiti": ["[email protected]", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ=="],
"create-wdio/chalk": ["[email protected]", "", {}, "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA=="],
@@ -5017,6 +5037,16 @@
"@babel/generator/@babel/types/@babel/helper-validator-identifier": ["@babel/[email protected]", "", {}, "sha512-4wFaiLd0bVo4cIoTXI3zKI038NIWE/cr3jvBjejOVYVxV/m8Ltav1USiGzG1fmS5J2RhgEOgXNNK46cRPnRsrg=="],
+ "@babel/helper-compilation-targets/browserslist/baseline-browser-mapping": ["[email protected]", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-FwMjJJ7HnyZpWe+oWxegG0fezZyBZUagI5LZEoO3GCbtbKNwRfMH9Ue5d5v01PNePBy1QSfPSDTTeVL0Hb9EzA=="],
+
+ "@babel/helper-compilation-targets/browserslist/caniuse-lite": ["[email protected]", "", {}, "sha512-xxWVywk6a6Arlk+hymeycyn/VgqEfLDxupvhH/xiY5SJ/18kmi9o6MiO320DCUzypORHLtvh0I4i04tUhCNHNQ=="],
+
+ "@babel/helper-compilation-targets/browserslist/electron-to-chromium": ["[email protected]", "", {}, "sha512-gglkxzokjHfawpGxq75XdBV2/l3BAPzrsMs70qgaZdTW5rpV1tC4MdgJVP9fN126bODA4ZJQkn1wryEzJyQXIg=="],
+
+ "@babel/helper-compilation-targets/browserslist/node-releases": ["[email protected]", "", {}, "sha512-D9UOmYG3UH1V+ENW56t5QXBwJw1YEY18ruVeus89Rw+SyIgjPkCO84bRzO3uNIYosJbNwiabWVn48o3uJLjxFQ=="],
+
+ "@babel/helper-compilation-targets/browserslist/update-browserslist-db": ["[email protected]", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-ZZ61DsRsOnakl74HAmp3oSN4aXUmEWXf+i/yv0h7tIBfICc3VdrFErQKUUKPgu3AMsTUMbcongALEN4l6GSUrQ=="],
+
"@commitlint/config-validator/ajv/json-schema-traverse": ["[email protected]", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
"@earendil-works/pi-agent-core/@earendil-works/pi-ai/@aws-sdk/client-bedrock-runtime": ["@aws-sdk/[email protected]", "", { "dependencies": { "@aws-crypto/sha256-browser": "5.2.0", "@aws-crypto/sha256-js": "5.2.0", "@aws-sdk/core": "^3.974.11", "@aws-sdk/credential-provider-node": "^3.972.42", "@aws-sdk/eventstream-handler-node": "^3.972.16", "@aws-sdk/middleware-eventstream": "^3.972.12", "@aws-sdk/middleware-websocket": "^3.972.19", "@aws-sdk/token-providers": "3.1048.0", "@aws-sdk/types": "^3.973.8", "@smithy/core": "^3.24.2", "@smithy/fetch-http-handler": "^5.4.2", "@smithy/node-http-handler": "^4.7.2", "@smithy/types": "^4.14.1", "tslib": "^2.6.2" } }, "sha512-u+NT61JZEkRFtpL0CAw1N1dwxnaLgwVXQl/zjJxTGgLyS/jTIdg2SdoEoCTHxgDyCnqa1HEi9QOoE9/pYRNpOQ=="],
@@ -5223,6 +5253,16 @@
"comark/htmlparser2/domutils": ["[email protected]", "", { "dependencies": { "dom-serializer": "^3.0.0", "domelementtype": "^3.0.0", "domhandler": "^6.0.0" } }, "sha512-qI4JLRKnSzqFqr7hAlS5xQDusBCjKSEG4t4+7aNrIQMHBcsC2TGEhuyABJdYkgSewL57PNLYEiibY2iPKhKpaA=="],
+ "core-js-compat/browserslist/baseline-browser-mapping": ["[email protected]", "", { "bin": { "baseline-browser-mapping": "dist/cli.cjs" } }, "sha512-FwMjJJ7HnyZpWe+oWxegG0fezZyBZUagI5LZEoO3GCbtbKNwRfMH9Ue5d5v01PNePBy1QSfPSDTTeVL0Hb9EzA=="],
+
+ "core-js-compat/browserslist/caniuse-lite": ["[email protected]", "", {}, "sha512-xxWVywk6a6Arlk+hymeycyn/VgqEfLDxupvhH/xiY5SJ/18kmi9o6MiO320DCUzypORHLtvh0I4i04tUhCNHNQ=="],
+
+ "core-js-compat/browserslist/electron-to-chromium": ["[email protected]", "", {}, "sha512-gglkxzokjHfawpGxq75XdBV2/l3BAPzrsMs70qgaZdTW5rpV1tC4MdgJVP9fN126bODA4ZJQkn1wryEzJyQXIg=="],
+
+ "core-js-compat/browserslist/node-releases": ["[email protected]", "", {}, "sha512-D9UOmYG3UH1V+ENW56t5QXBwJw1YEY18ruVeus89Rw+SyIgjPkCO84bRzO3uNIYosJbNwiabWVn48o3uJLjxFQ=="],
+
+ "core-js-compat/browserslist/update-browserslist-db": ["[email protected]", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-ZZ61DsRsOnakl74HAmp3oSN4aXUmEWXf+i/yv0h7tIBfICc3VdrFErQKUUKPgu3AMsTUMbcongALEN4l6GSUrQ=="],
+
"create-wdio/yargs/cliui": ["[email protected]", "", { "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ=="],
"create-wdio/yargs/yargs-parser": ["[email protected]", "", {}, "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw=="],
diff --git a/desktop/Cargo.lock b/desktop/Cargo.lock
index 35543e3e3..22ef2cfe8 100644
--- a/desktop/Cargo.lock
+++ b/desktop/Cargo.lock
@@ -2870,6 +2870,18 @@ version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
+[[package]]
+name = "nix"
+version = "0.31.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d"
+dependencies = [
+ "bitflags 2.13.1",
+ "cfg-if",
+ "cfg_aliases",
+ "libc",
+]
+
[[package]]
name = "nom"
version = "8.0.0"
@@ -3308,6 +3320,7 @@ dependencies = [
"tauri-plugin-dialog",
"tauri-plugin-fs",
"tauri-plugin-opener",
+ "tauri-plugin-os",
"tauri-plugin-process",
"tauri-plugin-shell",
"tauri-plugin-single-instance",
@@ -3351,6 +3364,22 @@ dependencies = [
"pin-project-lite",
]
+[[package]]
+name = "os_info"
+version = "3.15.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9cf20a545b305cf1da722b236b5155c9bb35f1d5ceb28c048bd96ca842f41b5b"
+dependencies = [
+ "android_system_properties",
+ "log",
+ "nix",
+ "objc2",
+ "objc2-foundation",
+ "objc2-ui-kit",
+ "serde",
+ "windows-sys 0.61.2",
+]
+
[[package]]
name = "os_pipe"
version = "1.2.3"
@@ -4729,6 +4758,15 @@ dependencies = [
"syn 2.0.119",
]
+[[package]]
+name = "sys-locale"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8eab9a99a024a169fe8a903cf9d4a3b3601109bcc13bd9e3c6fff259138626c4"
+dependencies = [
+ "libc",
+]
+
[[package]]
name = "system-deps"
version = "6.2.2"
@@ -5060,6 +5098,24 @@ dependencies = [
"zbus",
]
+[[package]]
+name = "tauri-plugin-os"
+version = "2.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d8f08346c8deb39e96f86973da0e2d76cbb933d7ac9b750f6dc4daf955a6f997"
+dependencies = [
+ "gethostname",
+ "log",
+ "os_info",
+ "serde",
+ "serde_json",
+ "serialize-to-javascript",
+ "sys-locale",
+ "tauri",
+ "tauri-plugin",
+ "thiserror 2.0.20",
+]
+
[[package]]
name = "tauri-plugin-process"
version = "2.3.1"
diff --git a/desktop/Cargo.toml b/desktop/Cargo.toml
index 1b31ae825..9faa471cd 100644
--- a/desktop/Cargo.toml
+++ b/desktop/Cargo.toml
@@ -38,6 +38,7 @@ font-kit = "0.14.3"
fix-path-env = { git = "https://github.com/tauri-apps/fix-path-env-rs", branch = "dev" }
tauri-plugin-updater = "2"
tauri-plugin-process = "2"
+tauri-plugin-os = "2"
tauri-plugin-clipboard-manager = "2"
tauri-plugin-deep-link = "2"
keyring = "4.1.5"
diff --git a/desktop/src/lib.rs b/desktop/src/lib.rs
index 39d2d4229..30cb693a2 100644
--- a/desktop/src/lib.rs
+++ b/desktop/src/lib.rs
@@ -50,6 +50,15 @@ fn take_pending_open(state: tauri::State<PendingOpen>) -> Vec<PendingOpenFile> {
.unwrap_or_default()
}
+/// Version of the system WebView engine the app is rendering in, so the
+/// startup support gate can name it when the engine is too old. Uses the
+/// WebKit bundle version on macOS, the WebKitGTK version on Linux, and the
+/// WebView2 runtime version on Windows; `None` when the runtime cannot report it.
+#[tauri::command]
+fn webview_version() -> Option<String> {
+ tauri::webview_version().ok()
+}
+
#[tauri::command]
fn set_recent_files(app: tauri::AppHandle, paths: Vec<String>) -> Result<(), String> {
install_app_menu(&app, &paths).map_err(|error| error.to_string())
@@ -301,7 +310,8 @@ pub fn run() {
set_recent_files,
native_menu_checked,
set_native_menu_checked,
- take_pending_open
+ take_pending_open,
+ webview_version
])
.plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_dialog::init())
@@ -310,6 +320,7 @@ pub fn run() {
.plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_updater::Builder::new().build())
.plugin(tauri_plugin_process::init())
+ .plugin(tauri_plugin_os::init())
.on_menu_event(|app, event| {
handle_menu_event(app, event.id().0.as_str());
})
diff --git a/desktop/tauri.conf.json b/desktop/tauri.conf.json
index 7cb199240..92e085f5b 100644
--- a/desktop/tauri.conf.json
+++ b/desktop/tauri.conf.json
@@ -60,6 +60,7 @@
}
},
"macOS": {
+ "minimumSystemVersion": "13.0",
"signingIdentity": "Developer ID Application: Danila Poyarkov (N7D7M3Q3CD)"
}
},
diff --git a/index.html b/index.html
index ae2559ca9..3eca6d31a 100644
--- a/index.html
+++ b/index.html
@@ -64,6 +64,44 @@
0% { transform: translateX(-100%); }
100% { transform: translateX(350%); }
}
+ /* Pre-boot support notice; the app CSS never loads when it shows. */
+ #boot-notice {
+ box-sizing: border-box;
+ min-height: 100vh;
+ padding: 48px 24px;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: 12px;
+ max-width: 560px;
+ margin: 0 auto;
+ text-align: center;
+ color: rgb(var(--loader-fg));
+ background: var(--loader-bg);
+ font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
+ }
+ #boot-notice img { width: 40px; height: 40px; margin-bottom: 8px; }
+ #boot-notice h1 { margin: 0; font-size: 18px; font-weight: 600; }
+ #boot-notice p { margin: 0; color: rgba(var(--loader-fg), 0.75); }
+ #boot-notice nav { margin-top: 8px; color: rgba(var(--loader-fg), 0.45); }
+ #boot-notice a { color: rgb(var(--loader-fg)); text-underline-offset: 3px; }
+ #boot-notice details { margin-top: 16px; max-width: 100%; color: rgba(var(--loader-fg), 0.6); }
+ #boot-notice summary { cursor: pointer; }
+ #boot-notice pre {
+ margin: 8px 0 0;
+ padding: 12px;
+ max-height: 40vh;
+ overflow: auto;
+ text-align: left;
+ white-space: pre-wrap;
+ word-break: break-word;
+ font-size: 12px;
+ border-radius: 6px;
+ background: rgba(var(--loader-fg), 0.06);
+ user-select: text;
+ -webkit-user-select: text;
+ }
</style>
</head>
diff --git a/oxlint.json b/oxlint.json
index d803c823d..d4d141278 100644
--- a/oxlint.json
+++ b/oxlint.json
@@ -9,8 +9,12 @@
"node"
],
"jsPlugins": [
- "./lint/plugin.js"
+ "./lint/plugin.js",
+ "eslint-plugin-compat"
],
+ "settings": {
+ "browsers": ["chrome 111", "edge 111", "firefox 128", "safari 16.4", "ios_saf 16.4"]
+ },
"env": {
"browser": true,
"es2024": true
@@ -446,6 +450,15 @@
"open-pencil/no-useless-pass-through-wrappers": "error"
}
},
+ {
+ "files": [
+ "src/**/*.{ts,vue}",
+ "packages/{scene-graph,pen,kiwi,fig,core,dom-css,vue}/src/**/*.{ts,vue}"
+ ],
+ "rules": {
+ "compat/compat": "error"
+ }
+ },
{
"files": [
"**/kiwi/schema-runtime/**",
diff --git a/package.json b/package.json
index 64e10ea49..0d5169fc7 100644
--- a/package.json
+++ b/package.json
@@ -123,6 +123,7 @@
"@tauri-apps/plugin-dialog": "^2.7.2",
"@tauri-apps/plugin-fs": "^2.5.1",
"@tauri-apps/plugin-opener": "^2.5.4",
+ "@tauri-apps/plugin-os": "^2.3.2",
"@tauri-apps/plugin-process": "^2.3.1",
"@tauri-apps/plugin-shell": "^2.3.5",
"@tauri-apps/plugin-updater": "^2.10.1",
@@ -203,6 +204,7 @@
"changelog-parser": "^4.1.0",
"cloudflare-redirect-parser": "^1.0.0",
"esbuild": "^0.27.7",
+ "eslint-plugin-compat": "^7.0.2",
"expect-webdriverio": "5.7.0",
"fake-indexeddb": "^6.2.5",
"franc": "^6.2.0",
diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json
index 7c9c2d41a..0dffea387 100644
--- a/packages/core/tsconfig.json
+++ b/packages/core/tsconfig.json
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "ES2022",
- "lib": ["ESNext", "DOM"],
+ "lib": ["ES2023", "DOM"],
"module": "ESNext",
"moduleResolution": "bundler",
"allowArbitraryExtensions": true,
diff --git a/packages/docs/getting-started.md b/packages/docs/getting-started.md
index 946d3f57e..94dada657 100644
--- a/packages/docs/getting-started.md
+++ b/packages/docs/getting-started.md
@@ -18,6 +18,18 @@ Pre-built binaries for macOS, Windows, and Linux are available on the [releases
| Windows (ARM) | `.msi` / `.exe` |
| Linux (x64) | `.AppImage` / `.deb` |
+## System Requirements
+
+OpenPencil renders with CanvasKit on WebGL and relies on current web platform features, so it needs a recent browser engine. The web app supports Chrome 111, Edge 111, Firefox 128, and Safari 16.4 or later; Chromium-based browsers such as Brave and Opera follow their Chrome version. The desktop app renders in the system WebView, so its floor is the operating system's engine:
+
+| Platform | Requirement |
+| -------- | ----------- |
+| macOS | macOS 13 Ventura or later with the current Safari updates installed (Safari 16.4 shipped with macOS 13.3). |
+| Windows | Windows 10 or later with the Microsoft Edge WebView2 Evergreen runtime, which updates itself. |
+| Linux | WebKitGTK 2.40 or later (`webkit2gtk-4.1`). |
+
+When the engine is too old, OpenPencil shows what to update instead of a blank window. If you see that notice on a system that meets the requirements, use its "Report a problem" link, which prefills the browser and engine details.
+
## macOS via Homebrew
```sh
diff --git a/packages/dom-css/tsconfig.json b/packages/dom-css/tsconfig.json
index 337e5295d..126d11199 100644
--- a/packages/dom-css/tsconfig.json
+++ b/packages/dom-css/tsconfig.json
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "ES2022",
- "lib": ["ESNext", "DOM", "DOM.Iterable"],
+ "lib": ["ES2023", "DOM", "DOM.Iterable"],
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
diff --git a/packages/fig/tsconfig.json b/packages/fig/tsconfig.json
index ca29f4cfb..6916560ba 100644
--- a/packages/fig/tsconfig.json
+++ b/packages/fig/tsconfig.json
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "ES2022",
- "lib": ["ESNext", "DOM", "DOM.Iterable"],
+ "lib": ["ES2023", "DOM", "DOM.Iterable"],
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
diff --git a/packages/pen/tsconfig.json b/packages/pen/tsconfig.json
index 0268fb9cb..9f560ea66 100644
--- a/packages/pen/tsconfig.json
+++ b/packages/pen/tsconfig.json
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "ES2022",
- "lib": ["ESNext", "DOM", "DOM.Iterable"],
+ "lib": ["ES2023", "DOM", "DOM.Iterable"],
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
diff --git a/packages/vue/tsconfig.json b/packages/vue/tsconfig.json
index 23d81539b..99ef91aaf 100644
--- a/packages/vue/tsconfig.json
+++ b/packages/vue/tsconfig.json
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "ES2022",
- "lib": ["ESNext", "DOM", "DOM.Iterable"],
+ "lib": ["ES2023", "DOM", "DOM.Iterable"],
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
diff --git a/src/app/editor/session/create.ts b/src/app/editor/session/create.ts
index 4c7ef7a04..69efce9dc 100644
--- a/src/app/editor/session/create.ts
+++ b/src/app/editor/session/create.ts
@@ -28,6 +28,7 @@ import {
} from '@/app/editor/session/modules'
import { createInitialAppEditorState, type AppEditorState } from '@/app/editor/session/types'
import { notificationMessages } from '@/app/i18n/notifications'
+import { createDeferred } from '@/app/runtime/deferred'
import { toast } from '@/app/shell/ui'
import { IS_BROWSER, IS_TAURI } from '@/constants'
@@ -54,7 +55,7 @@ export function createEditorStore(initialGraph?: SceneGraph) {
height: IS_BROWSER ? window.innerHeight : 1080
}
})
- const canvasReadiness = Promise.withResolvers<undefined>()
+ const canvasReadiness = createDeferred<undefined>()
const io = new IORegistry(BUILTIN_IO_FORMATS)
bindClipboardNotifications(editor)
diff --git a/src/app/runtime/deferred.ts b/src/app/runtime/deferred.ts
new file mode 100644
index 000000000..3c66e67c0
--- /dev/null
+++ b/src/app/runtime/deferred.ts
@@ -0,0 +1,22 @@
+export interface Deferred<T> {
+ readonly promise: Promise<T>
+ readonly resolve: (value: T | PromiseLike<T>) => void
+ readonly reject: (reason?: unknown) => void
+}
+
+/**
+ * A promise whose settlement is owned by the caller.
+ *
+ * Equivalent to `Promise.withResolvers()`, which is newer than the supported
+ * browser baseline (`@/app/shell/support/baseline`) and therefore outside the
+ * ES2023 lib; `es-toolkit` offers no counterpart.
+ */
+export function createDeferred<T>(): Deferred<T> {
+ let resolve: Deferred<T>['resolve'] = () => undefined
+ let reject: Deferred<T>['reject'] = () => undefined
+ const promise = new Promise<T>((res, rej) => {
+ resolve = res
+ reject = rej
+ })
+ return { promise, resolve, reject }
+}
diff --git a/src/app/shell/support/baseline.ts b/src/app/shell/support/baseline.ts
new file mode 100644
index 000000000..ea810bafb
--- /dev/null
+++ b/src/app/shell/support/baseline.ts
@@ -0,0 +1,124 @@
+/**
+ * Minimum browser engines OpenPencil supports.
+ *
+ * This is the single source for the Vite `build.target` (syntax lowering), the
+ * startup support gate, and the system requirements in the docs. Chrome, Edge
+ * and Safari follow Vite's "baseline widely available" default; Firefox is
+ * raised to 128 because Tailwind CSS 4 needs `@property`, which Firefox gained
+ * there. Pinned explicitly so a Vite major cannot move it silently.
+ *
+ * Vite lowers syntax but never polyfills APIs, so every runtime built-in the
+ * app uses must exist in these versions. Two data-driven checks enforce that:
+ * the TypeScript `lib` of the app and browser-shipped packages is pinned to
+ * `BASELINE_ECMASCRIPT_LIB`, so a newer built-in such as
+ * `Promise.withResolvers` is a type error, and `compat/compat` (browserslist
+ * plus MDN compatibility data) rejects Web APIs these engines lack. On macOS
+ * the desktop app renders in the system WebKit, which reaches Safari 16.4
+ * with macOS 13.3.
+ */
+export const BROWSER_BASELINE = {
+ chrome: 111,
+ edge: 111,
+ firefox: 128,
+ safari: 16.4,
+ ios: 16.4
+} as const
+
+export type BaselineBrowser = keyof typeof BROWSER_BASELINE
+
+/** Vite/esbuild target strings derived from the baseline. */
+export function viteBuildTarget(): string[] {
+ return Object.entries(BROWSER_BASELINE).map(([browser, version]) => `${browser}${version}`)
+}
+
+/**
+ * Browserslist queries derived from the baseline, which `oxlint.json` must
+ * repeat literally in `settings.browsers` for `compat/compat`; a unit test
+ * keeps the two in step.
+ */
+export function browserslistQueries(): string[] {
+ return Object.entries(BROWSER_BASELINE).map(
+ ([browser, version]) => `${browser === 'ios' ? 'ios_saf' : browser} ${version}`
+ )
+}
+
+/**
+ * The ECMAScript edition every baseline engine implements in full, and so the
+ * TypeScript `lib` the app and browser-shipped packages pin. Web APIs are
+ * checked separately by `compat/compat` because `lib.dom` is unversioned.
+ */
+export const BASELINE_ECMASCRIPT_LIB = 'ES2023'
+
+/**
+ * A capability that is absent on any engine older than the baseline. The gate
+ * runs `test()` before loading the app; `since` records each browser's first
+ * supporting version so a unit test can prove no sentinel demands more than
+ * the baseline while every browser has at least one sentinel at it.
+ */
+export interface SupportSentinel {
+ readonly name: string
+ readonly since: Readonly<Partial<Record<BaselineBrowser, number>>>
+ readonly test: () => boolean
+}
+
+function hasCSSSupport(property: string, value: string): boolean {
+ return typeof CSS !== 'undefined' && typeof CSS.supports === 'function'
+ ? CSS.supports(property, value)
+ : false
+}
+
+export const SUPPORT_SENTINELS: readonly SupportSentinel[] = [
+ {
+ name: 'WebAssembly',
+ since: { chrome: 57, edge: 16, firefox: 52, safari: 11, ios: 11 },
+ test: () => typeof WebAssembly === 'object'
+ },
+ {
+ name: 'WebGL 2',
+ since: { chrome: 56, edge: 79, firefox: 51, safari: 15, ios: 15 },
+ test: () => typeof WebGL2RenderingContext === 'function'
+ },
+ {
+ name: 'structuredClone',
+ since: { chrome: 98, edge: 98, firefox: 94, safari: 15.4, ios: 15.4 },
+ test: () => typeof structuredClone === 'function'
+ },
+ {
+ name: 'Array.prototype.toSorted',
+ since: { chrome: 110, edge: 110, firefox: 115, safari: 16, ios: 16 },
+ test: () => typeof Array.prototype.toSorted === 'function'
+ },
+ {
+ name: 'String.prototype.isWellFormed',
+ since: { chrome: 111, edge: 111, firefox: 119, safari: 16.4, ios: 16.4 },
+ // ES2024, so beyond the ES2023 lib on purpose; probe by name.
+ test: () => 'isWellFormed' in String.prototype
+ },
+ {
+ name: 'CSS color-mix()',
+ since: { chrome: 111, edge: 111, firefox: 113, safari: 16.2, ios: 16.2 },
+ test: () => hasCSSSupport('color', 'color-mix(in srgb, red, blue)')
+ },
+ {
+ name: 'CSS @property',
+ since: { chrome: 85, edge: 85, firefox: 128, safari: 16.4, ios: 16.4 },
+ test: () => typeof CSS !== 'undefined' && typeof CSS.registerProperty === 'function'
+ }
+]
+
+/** Names of the sentinels the current engine fails; empty when supported. */
+export function missingSupportSentinels(
+ sentinels: readonly SupportSentinel[] = SUPPORT_SENTINELS
+): string[] {
+ const missing: string[] = []
+ for (const sentinel of sentinels) {
+ let supported = false
+ try {
+ supported = sentinel.test()
+ } catch {
+ supported = false
+ }
+ if (!supported) missing.push(sentinel.name)
+ }
+ return missing
+}
diff --git a/src/app/shell/support/boot.ts b/src/app/shell/support/boot.ts
new file mode 100644
index 000000000..6d4b307b0
--- /dev/null
+++ b/src/app/shell/support/boot.ts
@@ -0,0 +1,66 @@
+import { ErrorCodes, type App } from 'vue'
+
+/**
+ * Vue error sources whose failure during the first render leaves the initial
+ * view missing. Hooks and event handlers that throw later degrade the app but
+ * still show it, so they stay with the regular toast error handling.
+ */
+const FATAL_BOOT_ERROR_CODES: ReadonlySet<ErrorCodes> = new Set([
+ ErrorCodes.SETUP_FUNCTION,
+ ErrorCodes.RENDER_FUNCTION,
+ ErrorCodes.ASYNC_COMPONENT_LOADER,
+ ErrorCodes.SCHEDULER,
+ ErrorCodes.COMPONENT_UPDATE
+])
+
+/** Development-build `info` strings for the codes above, in the same order. */
+const FATAL_BOOT_ERROR_INFO: ReadonlySet<string> = new Set([
+ 'setup function',
+ 'render function',
+ 'async component loader',
+ 'scheduler flush',
+ 'component update'
+])
+
+/**
+ * Production builds pass the error reference URL instead of the info string;
+ * its fragment carries the numeric code.
+ */
+const PRODUCTION_ERROR_INFO = /#runtime-(\d+)$/
+
+export function isFatalBootErrorInfo(info: string): boolean {
+ if (FATAL_BOOT_ERROR_INFO.has(info)) return true
+ const match = PRODUCTION_ERROR_INFO.exec(info)
+ return match !== null && FATAL_BOOT_ERROR_CODES.has(Number(match[1]))
+}
+
+export interface BootFailure {
+ readonly error: unknown
+}
+
+export interface BootErrorObserver {
+ /** Restore the previous handler and return the first fatal error, if any. */
+ stop(): BootFailure | undefined
+}
+
+/**
+ * Capture render-blocking errors between `createApp()` and the first settled
+ * route. Vue reports component errors through `errorHandler` rather than the
+ * window, so without this a failed initial render is only a console entry and
+ * a blank window.
+ */
+export function observeBootErrors(app: App): BootErrorObserver {
+ const previous = app.config.errorHandler
+ let failure: BootFailure | undefined
+ app.config.errorHandler = (error, instance, info) => {
+ if (!failure && isFatalBootErrorInfo(info)) failure = { error }
+ if (previous) previous(error, instance, info)
+ else console.error(error)
+ }
+ return {
+ stop() {
+ app.config.errorHandler = previous
+ return failure
+ }
+ }
+}
diff --git a/src/app/shell/support/detect.ts b/src/app/shell/support/detect.ts
new file mode 100644
index 000000000..c9a669e9c
--- /dev/null
+++ b/src/app/shell/support/detect.ts
@@ -0,0 +1,148 @@
+import type { BaselineBrowser } from './baseline'
+
+export type BrowserFamily = 'chrome' | 'edge' | 'opera' | 'firefox' | 'safari' | 'unknown'
+export type OperatingSystem = 'macos' | 'ios' | 'windows' | 'linux' | 'android' | 'unknown'
+
+export interface SupportEnvironment {
+ /** Whether the page runs inside the Tauri desktop shell or a browser tab. */
+ readonly host: 'desktop' | 'browser'
+ readonly os: OperatingSystem
+ /** Operating system version, known only on desktop through the OS plugin. */
+ readonly osVersion?: string
+ readonly browser: BrowserFamily
+ /** Major version, with the minor kept for Safari (`16.4`), when the UA names it. */
+ readonly browserVersion?: number
+ /** Native WebView engine version reported by Tauri, when available. */
+ readonly webviewVersion?: string
+ readonly userAgent: string
+}
+
+/** The user-agent facts the detector reads; injectable for tests. */
+export interface NavigatorFacts {
+ readonly userAgent: string
+ readonly maxTouchPoints: number
+}
+
+/** Facts only the desktop shell can supply. */
+export interface DesktopFacts {
+ readonly platform: string
+ readonly osVersion?: string
+ readonly webviewVersion?: string
+}
+
+interface ParsedUserAgent {
+ os: OperatingSystem
+ browser: BrowserFamily
+ browserVersion?: number
+}
+
+function versionAfter(userAgent: string, token: RegExp): number | undefined {
+ const match = token.exec(userAgent)
+ if (!match) return undefined
+ const parsed = Number.parseFloat(match[1])
+ return Number.isFinite(parsed) ? parsed : undefined
+}
+
+function detectOS(userAgent: string, maxTouchPoints: number): OperatingSystem {
+ if (/iPhone|iPad|iPod/.test(userAgent)) return 'ios'
+ // iPadOS asks for desktop sites with a Macintosh UA; only touch tells it apart.
+ if (/Macintosh/.test(userAgent)) return maxTouchPoints > 1 ? 'ios' : 'macos'
+ if (/Android/.test(userAgent)) return 'android'
+ if (/Windows/.test(userAgent)) return 'windows'
+ if (/Linux|X11|CrOS/.test(userAgent)) return 'linux'
+ return 'unknown'
+}
+
+/**
+ * Identify the browser family and version from a user-agent string.
+ *
+ * Every iOS browser is WebKit, so it reports as Safari with the engine version
+ * taken from the `Version/` token or, for third-party shells, the OS version.
+ * Chromium forks keep an accurate `Chrome/` major; Opera and Edge add their own
+ * token, which only changes the name shown to the user.
+ */
+export function parseUserAgent(userAgent: string, maxTouchPoints = 0): ParsedUserAgent {
+ const os = detectOS(userAgent, maxTouchPoints)
+
+ if (os === 'ios') {
+ const version =
+ versionAfter(userAgent, /Version\/(\d+(?:\.\d+)?)/) ??
+ versionAfter(userAgent.replace(/_/g, '.'), /OS (\d+(?:\.\d+)?)/)
+ return { os, browser: 'safari', browserVersion: version }
+ }
+
+ const firefox = versionAfter(userAgent, /Firefox\/(\d+)/)
+ if (firefox !== undefined) return { os, browser: 'firefox', browserVersion: firefox }
+
+ const chrome = versionAfter(userAgent, /Chrome\/(\d+)/)
+ if (chrome !== undefined) {
+ if (/Edg\//.test(userAgent)) return { os, browser: 'edge', browserVersion: chrome }
+ if (/OPR\//.test(userAgent)) return { os, browser: 'opera', browserVersion: chrome }
+ return { os, browser: 'chrome', browserVersion: chrome }
+ }
+
+ if (/Safari\//.test(userAgent) || /AppleWebKit\//.test(userAgent)) {
+ return {
+ os,
+ browser: 'safari',
+ browserVersion: versionAfter(userAgent, /Version\/(\d+(?:\.\d+)?)/)
+ }
+ }
+
+ return { os, browser: 'unknown' }
+}
+
+function desktopOS(platform: string, fallback: OperatingSystem): OperatingSystem {
+ switch (platform) {
+ case 'macos':
+ return 'macos'
+ case 'windows':
+ return 'windows'
+ case 'linux':
+ return 'linux'
+ case 'ios':
+ return 'ios'
+ case 'android':
+ return 'android'
+ default:
+ return fallback
+ }
+}
+
+export function describeEnvironment(
+ navigatorFacts: NavigatorFacts,
+ desktop?: DesktopFacts
+): SupportEnvironment {
+ const parsed = parseUserAgent(navigatorFacts.userAgent, navigatorFacts.maxTouchPoints)
+ if (!desktop) {
+ return { host: 'browser', ...parsed, userAgent: navigatorFacts.userAgent }
+ }
+ return {
+ host: 'desktop',
+ os: desktopOS(desktop.platform, parsed.os),
+ osVersion: desktop.osVersion,
+ // The WebView UA carries no engine version; the shell reports it natively.
+ browser: parsed.browser,
+ browserVersion: parsed.browserVersion,
+ webviewVersion: desktop.webviewVersion,
+ userAgent: navigatorFacts.userAgent
+ }
+}
+
+/** Which baseline entry governs an environment, or `undefined` when none does. */
+export function baselineBrowserFor(env: SupportEnvironment): BaselineBrowser | undefined {
+ if (env.os === 'ios') return 'ios'
+ switch (env.browser) {
+ case 'chrome':
+ case 'opera':
+ return 'chrome'
+ case 'edge':
+ return 'edge'
+ case 'firefox':
+ return 'firefox'
+ case 'safari':
+ return 'safari'
+ default:
+ return undefined
+ }
+}
diff --git a/src/app/shell/support/gate.ts b/src/app/shell/support/gate.ts
new file mode 100644
index 000000000..d5e792509
--- /dev/null
+++ b/src/app/shell/support/gate.ts
@@ -0,0 +1,48 @@
+import { IS_TAURI } from '@open-pencil/core/constants'
+
+import { missingSupportSentinels } from './baseline'
+import { describeEnvironment, type DesktopFacts, type SupportEnvironment } from './detect'
+import { bootFailureNotice, unsupportedNotice } from './guidance'
+import { renderSupportNotice } from './render'
+
+async function desktopFacts(): Promise<DesktopFacts> {
+ try {
+ const [{ platform, version }, { invoke }] = await Promise.all([
+ import('@tauri-apps/plugin-os'),
+ import('@tauri-apps/api/core')
+ ])
+ const webviewVersion = await invoke<string | null>('webview_version').catch(() => null)
+ return {
+ platform: platform(),
+ osVersion: version(),
+ webviewVersion: webviewVersion ?? undefined
+ }
+ } catch (error) {
+ // The notice still helps without native facts; fall back to the user agent.
+ console.warn('[support] desktop facts unavailable', error)
+ return { platform: 'unknown' }
+ }
+}
+
+async function detectEnvironment(): Promise<SupportEnvironment> {
+ const facts = { userAgent: navigator.userAgent, maxTouchPoints: navigator.maxTouchPoints }
+ return describeEnvironment(facts, IS_TAURI ? await desktopFacts() : undefined)
+}
+
+/**
+ * Check the engine against the support baseline before the app bundle loads.
+ * Returns `true` when the app may boot; otherwise the app root now shows
+ * platform-specific update guidance and the caller must stop.
+ */
+export async function runSupportGate(): Promise<boolean> {
+ const missing = missingSupportSentinels()
+ if (missing.length === 0) return true
+ renderSupportNotice(unsupportedNotice(await detectEnvironment(), missing))
+ return false
+}
+
+/** Replace a blank window with an explanation after the app failed to load. */
+export async function reportBootFailure(error: unknown): Promise<void> {
+ console.error('[support] boot failed', error)
+ renderSupportNotice(bootFailureNotice(await detectEnvironment(), error))
+}
diff --git a/src/app/shell/support/guidance.ts b/src/app/shell/support/guidance.ts
new file mode 100644
index 000000000..5d9c42c79
--- /dev/null
+++ b/src/app/shell/support/guidance.ts
@@ -0,0 +1,270 @@
+import { BROWSER_BASELINE } from './baseline'
+import { baselineBrowserFor, type SupportEnvironment } from './detect'
+
+/**
+ * Copy for the pre-boot notice. It renders before Vue and the i18n catalogs
+ * exist, so it is plain English by design.
+ */
+export interface SupportNotice {
+ readonly heading: string
+ readonly paragraphs: readonly string[]
+ /** Technical facts shown behind a disclosure and prefilled into a bug report. */
+ readonly details: readonly string[]
+ readonly links: readonly SupportLink[]
+}
+
+export interface SupportLink {
+ readonly label: string
+ readonly url: string
+}
+
+export const SYSTEM_REQUIREMENTS_URL = 'https://openpencil.dev/getting-started#system-requirements'
+export const WEBVIEW2_DOWNLOAD_URL = 'https://developer.microsoft.com/microsoft-edge/webview2/'
+const ISSUE_URL = 'https://github.com/open-pencil/open-pencil/issues/new'
+
+export const MINIMUM_MACOS_VERSION = 13
+export const MINIMUM_WEBKITGTK_VERSION = '2.40'
+
+const BROWSER_LABELS = {
+ chrome: 'Chrome',
+ edge: 'Edge',
+ opera: 'Opera',
+ firefox: 'Firefox',
+ safari: 'Safari',
+ unknown: 'this browser'
+} as const
+
+export function requirementsSentence(): string {
+ const { chrome, edge, firefox, safari } = BROWSER_BASELINE
+ return `OpenPencil needs Chrome ${chrome}, Edge ${edge}, Firefox ${firefox}, or Safari ${safari} or later.`
+}
+
+function majorVersion(version: string | undefined): number | undefined {
+ if (!version) return undefined
+ const major = Number.parseInt(version, 10)
+ return Number.isFinite(major) ? major : undefined
+}
+
+function versionLabel(version: number): string {
+ return Number.isInteger(version) ? String(version) : version.toFixed(1)
+}
+
+function environmentDetails(env: SupportEnvironment): string[] {
+ const details = [`Host: ${env.host === 'desktop' ? 'desktop app' : 'browser'}`]
+ details.push(`OS: ${env.os}${env.osVersion ? ` ${env.osVersion}` : ''}`)
+ if (env.browserVersion !== undefined) {
+ details.push(`Browser: ${BROWSER_LABELS[env.browser]} ${versionLabel(env.browserVersion)}`)
+ }
+ if (env.webviewVersion) details.push(`WebView: ${env.webviewVersion}`)
+ details.push(`User agent: ${env.userAgent}`)
+ return details
+}
+
+/** Option labels of the bug report form's Platform dropdown. */
+const DESKTOP_ISSUE_PLATFORMS: Partial<Record<SupportEnvironment['os'], string>> = {
+ macos: 'macOS (Tauri)',
+ windows: 'Windows (Tauri)',
+ linux: 'Linux (Tauri)'
+}
+
+function issuePlatform(env: SupportEnvironment): string {
+ if (env.host === 'browser') return 'Web (app.openpencil.dev)'
+ return DESKTOP_ISSUE_PLATFORMS[env.os] ?? 'Not sure'
+}
+
+function issueLink(
+ env: SupportEnvironment,
+ title: string,
+ details: readonly string[]
+): SupportLink {
+ const params = new URLSearchParams({
+ template: 'bug_report.yml',
+ title,
+ platform: issuePlatform(env),
+ 'affected-area': 'App UI',
+ version: typeof __OPENPENCIL_APP_VERSION__ === 'string' ? __OPENPENCIL_APP_VERSION__ : '',
+ browser: env.userAgent,
+ logs: details.join('\n')
+ })
+ return { label: 'Report a problem', url: `${ISSUE_URL}?${params.toString()}` }
+}
+
+function requirementsLink(): SupportLink {
+ return { label: 'System requirements', url: SYSTEM_REQUIREMENTS_URL }
+}
+
+interface Advice {
+ heading: string
+ paragraphs: string[]
+ extraLinks?: SupportLink[]
+}
+
+function desktopAdvice(env: SupportEnvironment): Advice {
+ switch (env.os) {
+ case 'macos': {
+ const major = majorVersion(env.osVersion)
+ const running = env.osVersion ? `This Mac is running macOS ${env.osVersion}. ` : ''
+ if (major !== undefined && major < MINIMUM_MACOS_VERSION) {
+ return {
+ heading: `OpenPencil needs macOS ${MINIMUM_MACOS_VERSION} or later`,
+ paragraphs: [
+ `${running}OpenPencil renders with the WebKit engine that ships with macOS, and this version is too old to run it. Upgrade to macOS ${MINIMUM_MACOS_VERSION} or later to use OpenPencil.`
+ ]
+ }
+ }
+ return {
+ heading: 'Update macOS to run OpenPencil',
+ paragraphs: [
+ `${running}OpenPencil renders with the WebKit engine that ships with macOS, and this Mac's copy is older than Safari ${BROWSER_BASELINE.safari}.`,
+ 'Open System Settings → General → Software Update, install the available macOS and Safari updates, then reopen OpenPencil.'
+ ]
+ }
+ }
+ case 'linux':
+ return {
+ heading: 'Update WebKitGTK to run OpenPencil',
+ paragraphs: [
+ `OpenPencil renders with WebKitGTK${env.webviewVersion ? ` ${env.webviewVersion}` : ''}, which is too old.`,
+ `Update the webkit2gtk-4.1 package to ${MINIMUM_WEBKITGTK_VERSION} or later with your distribution's package manager, then reopen OpenPencil.`
+ ]
+ }
+ case 'windows':
+ return {
+ heading: 'Update WebView2 to run OpenPencil',
+ paragraphs: [
+ `OpenPencil renders with the Microsoft Edge WebView2 Runtime${env.webviewVersion ? ` ${env.webviewVersion}` : ''}, which is too old.`,
+ 'Install the latest Evergreen runtime from Microsoft, then reopen OpenPencil.'
+ ],
+ extraLinks: [{ label: 'Download WebView2', url: WEBVIEW2_DOWNLOAD_URL }]
+ }
+ default:
+ return {
+ heading: 'OpenPencil needs a newer WebView',
+ paragraphs: [
+ 'The system WebView engine is too old to run OpenPencil. Install your operating system updates, then reopen OpenPencil.'
+ ]
+ }
+ }
+}
+
+function browserUpdateSteps(env: SupportEnvironment): string {
+ switch (env.browser) {
+ case 'chrome':
+ return 'Open the Chrome menu → Help → About Google Chrome to install the update.'
+ case 'edge':
+ return 'Open Settings and more → Help and feedback → About Microsoft Edge to install the update.'
+ case 'opera':
+ return 'Open the Opera menu → Update & Recovery to install the update.'
+ case 'firefox':
+ return 'Open the Firefox menu → Help → About Firefox to install the update.'
+ case 'safari':
+ return 'Update it through System Settings → General → Software Update, or open OpenPencil in a current Chrome, Edge, or Firefox.'
+ default:
+ return requirementsSentence()
+ }
+}
+
+function browserAdvice(env: SupportEnvironment): Advice {
+ if (env.os === 'ios') {
+ return {
+ heading: 'Update iOS to run OpenPencil',
+ paragraphs: [
+ `OpenPencil needs iOS ${BROWSER_BASELINE.ios} or later. Every browser on iPhone and iPad uses the system WebKit engine, so update in Settings → General → Software Update.`
+ ]
+ }
+ }
+ const baseline = baselineBrowserFor(env)
+ if (baseline === undefined) {
+ return {
+ heading: "OpenPencil can't run in this browser",
+ paragraphs: [requirementsSentence()]
+ }
+ }
+ const label = BROWSER_LABELS[env.browser]
+ const minimum = BROWSER_BASELINE[baseline]
+ const detected =
+ env.browserVersion === undefined
+ ? ''
+ : `${label} ${versionLabel(env.browserVersion)} detected. `
+ const needs =
+ env.browser === 'opera'
+ ? `OpenPencil needs Opera built on Chrome ${minimum} or later.`
+ : `OpenPencil needs ${label} ${minimum} or later.`
+ return {
+ heading: `Update ${label} to run OpenPencil`,
+ paragraphs: [`${detected}${needs}`, browserUpdateSteps(env)]
+ }
+}
+
+/** True when the UA claims a version at or above the baseline for its browser. */
+function claimsSupportedVersion(env: SupportEnvironment): boolean {
+ const baseline = baselineBrowserFor(env)
+ return (
+ baseline !== undefined &&
+ env.browserVersion !== undefined &&
+ env.browserVersion >= BROWSER_BASELINE[baseline]
+ )
+}
+
+/** Notice for an engine that fails the support sentinels before boot. */
+export function unsupportedNotice(
+ env: SupportEnvironment,
+ missing: readonly string[]
+): SupportNotice {
+ const details = [`Missing: ${missing.join(', ')}`, ...environmentDetails(env)]
+ const report = issueLink(env, 'bug: unsupported browser notice shown', details)
+
+ if (env.host === 'browser' && claimsSupportedVersion(env)) {
+ return {
+ heading: 'A required browser feature is unavailable',
+ paragraphs: [
+ `Your browser reports ${BROWSER_LABELS[env.browser]} ${versionLabel(env.browserVersion ?? 0)}, which should run OpenPencil, but it is missing ${missing.join(', ')}.`,
+ 'A browser policy, an extension, or a preview build may have disabled it. Try a current release of Chrome, Edge, Firefox, or Safari.'
+ ],
+ details,
+ links: [requirementsLink(), report]
+ }
+ }
+
+ const advice = env.host === 'desktop' ? desktopAdvice(env) : browserAdvice(env)
+ return {
+ heading: advice.heading,
+ paragraphs: advice.paragraphs,
+ details,
+ links: [requirementsLink(), ...(advice.extraLinks ?? []), report]
+ }
+}
+
+function errorDetails(error: unknown): string[] {
+ if (!(error instanceof Error)) return [String(error)]
+ const summary = `${error.name}: ${error.message}`
+ const frames = (error.stack ?? '')
+ .split('\n')
+ // V8 repeats the summary as the first stack line; WebKit and Gecko do not.
+ .filter((line, index) => line.trim() !== '' && !(index === 0 && line.trim() === summary))
+ .slice(0, 8)
+ return [summary, ...frames]
+}
+
+function bootFailureHint(env: SupportEnvironment): string {
+ if (env.host === 'browser') return requirementsSentence()
+ if (env.os === 'macos') {
+ return 'OpenPencil renders with the WebKit engine that ships with macOS. If this Mac has pending macOS or Safari updates, install them first.'
+ }
+ return 'OpenPencil renders with the system WebView engine. If your operating system has pending updates, install them first.'
+}
+
+/** Notice for an app that failed while loading and left the window blank. */
+export function bootFailureNotice(env: SupportEnvironment, error: unknown): SupportNotice {
+ const details = [...errorDetails(error), ...environmentDetails(env)]
+ return {
+ heading: "OpenPencil couldn't start",
+ paragraphs: [
+ 'Something failed while the app was loading, so nothing could be shown.',
+ bootFailureHint(env),
+ 'If it keeps happening, report the problem and include the details below.'
+ ],
+ details,
+ links: [requirementsLink(), issueLink(env, 'bug: app fails to start', details)]
+ }
+}
diff --git a/src/app/shell/support/render.ts b/src/app/shell/support/render.ts
new file mode 100644
index 000000000..3e5449ef7
--- /dev/null
+++ b/src/app/shell/support/render.ts
@@ -0,0 +1,77 @@
+import { IS_TAURI } from '@open-pencil/core/constants'
+
+import type { SupportNotice } from './guidance'
+
+/**
+ * Root element the notice replaces. It is the app mount point, so the notice
+ * takes over whatever the splash or a half-mounted app left behind.
+ */
+const APP_ROOT_SELECTOR = '#app'
+export const BOOT_NOTICE_ID = 'boot-notice'
+
+function openExternally(event: MouseEvent, href: string): void {
+ // The desktop WebView must not navigate away from the app; hand links to the OS.
+ if (!IS_TAURI) return
+ event.preventDefault()
+ void import('@tauri-apps/plugin-opener').then(({ openUrl }) => openUrl(href))
+}
+
+function createLink(doc: Document, label: string, href: string): HTMLAnchorElement {
+ const anchor = doc.createElement('a')
+ anchor.href = href
+ anchor.target = '_blank'
+ anchor.rel = 'noreferrer'
+ anchor.textContent = label
+ anchor.addEventListener('click', (event) => openExternally(event, href))
+ return anchor
+}
+
+/**
+ * Render a support notice with plain DOM into the app root. Runs before Vue,
+ * Tailwind, and the i18n catalogs load, so it relies only on the inline
+ * `#boot-notice` styles in `index.html`.
+ */
+export function renderSupportNotice(notice: SupportNotice, doc: Document = document): void {
+ const root = doc.querySelector(APP_ROOT_SELECTOR) ?? doc.body
+ root.replaceChildren()
+
+ const container = doc.createElement('section')
+ container.id = BOOT_NOTICE_ID
+ container.setAttribute('role', 'alert')
+
+ const icon = doc.createElement('img')
+ icon.src = '/brand/app-icon.svg'
+ icon.alt = ''
+ icon.width = 40
+ icon.height = 40
+ container.append(icon)
+
+ const heading = doc.createElement('h1')
+ heading.textContent = notice.heading
+ container.append(heading)
+
+ for (const text of notice.paragraphs) {
+ const paragraph = doc.createElement('p')
+ paragraph.textContent = text
+ container.append(paragraph)
+ }
+
+ const links = doc.createElement('nav')
+ notice.links.forEach((link, index) => {
+ if (index > 0) links.append(doc.createTextNode(' · '))
+ links.append(createLink(doc, link.label, link.url))
+ })
+ container.append(links)
+
+ if (notice.details.length > 0) {
+ const details = doc.createElement('details')
+ const summary = doc.createElement('summary')
+ summary.textContent = 'Details'
+ const pre = doc.createElement('pre')
+ pre.textContent = notice.details.join('\n')
+ details.append(summary, pre)
+ container.append(details)
+ }
+
+ root.append(container)
+}
diff --git a/src/app/tabs/index.ts b/src/app/tabs/index.ts
index 594f29dca..c11c4b7a6 100644
--- a/src/app/tabs/index.ts
+++ b/src/app/tabs/index.ts
@@ -31,6 +31,7 @@ import {
loadCachedRecentFileThumbnail,
rememberRecentStorageDocument
} from '@/app/recent-files'
+import { createDeferred } from '@/app/runtime/deferred'
import { toast } from '@/app/shell/ui'
import { getLocalCanvasStore } from '@/app/storage/local-store'
import { seedStorageCanvasFromRemote } from '@/app/storage/sync/persist'
@@ -430,7 +431,7 @@ export async function openFileInNewTab(
subject: file.name
})
- const completion = Promise.withResolvers<undefined>()
+ const completion = createDeferred<undefined>()
void completion.promise.catch(() => undefined)
const pendingOpen = { completion: completion.promise, identity, store }
fileOpenCoordinator.add(pendingOpen)
diff --git a/src/boot.ts b/src/boot.ts
new file mode 100644
index 000000000..a2f7ace20
--- /dev/null
+++ b/src/boot.ts
@@ -0,0 +1,41 @@
+import { createHead } from '@unhead/vue/client'
+import { createApp, nextTick } from 'vue'
+
+import { createRetainedScopePlugin } from '@open-pencil/vue'
+
+import './app.css'
+import { preloadFonts } from '@/app/editor/fonts'
+import { observeBootErrors } from '@/app/shell/support/boot'
+import { reportBootFailure } from '@/app/shell/support/gate'
+import { IS_TAURI } from '@/constants'
+
+import App from './App.vue'
+import router from './router'
+
+/**
+ * Application entry, loaded by `main.ts` only after the support gate passes.
+ * Keeping it behind a dynamic import means an unsupported engine never
+ * evaluates the app bundle and can still show the gate's guidance.
+ */
+export async function boot(): Promise<void> {
+ preloadFonts()
+ const head = createHead()
+ const app = createApp(App)
+ const bootErrors = observeBootErrors(app)
+ app.use(router).use(head).use(createRetainedScopePlugin()).mount('#app')
+
+ await router.isReady()
+ await nextTick()
+ const failure = bootErrors.stop()
+ if (failure) {
+ await reportBootFailure(failure.error)
+ return
+ }
+
+ if (!IS_TAURI) {
+ void import('virtual:pwa-register').then(({ registerSW }) => {
+ registerSW({ immediate: true })
+ return undefined
+ })
+ }
+}
diff --git a/src/main.ts b/src/main.ts
index 59a11fb3d..23cf02ba8 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -1,22 +1,15 @@
-import { createHead } from '@unhead/vue/client'
-import { createApp } from 'vue'
-
-import { createRetainedScopePlugin } from '@open-pencil/vue'
-
-import './app.css'
-import { preloadFonts } from '@/app/editor/fonts'
-import { IS_TAURI } from '@/constants'
-
-import App from './App.vue'
-import router from './router'
-
-preloadFonts()
-const head = createHead()
-createApp(App).use(router).use(head).use(createRetainedScopePlugin()).mount('#app')
-
-if (!IS_TAURI) {
- void import('virtual:pwa-register').then(({ registerSW }) => {
- registerSW({ immediate: true })
- return undefined
- })
+import { reportBootFailure, runSupportGate } from '@/app/shell/support/gate'
+
+// Keep this module free of the app bundle: it must evaluate on engines that
+// cannot run the app so it can explain why (see src/app/shell/support/).
+async function start(): Promise<void> {
+ if (!(await runSupportGate())) return
+ try {
+ const { boot } = await import('./boot')
+ await boot()
+ } catch (error) {
+ await reportBootFailure(error)
+ }
}
+
+void start()
diff --git a/tests/app/shell/support/baseline.test.ts b/tests/app/shell/support/baseline.test.ts
new file mode 100644
index 000000000..c6ca924fb
--- /dev/null
+++ b/tests/app/shell/support/baseline.test.ts
@@ -0,0 +1,89 @@
+import { describe, expect, test } from 'bun:test'
+import { readFile } from 'node:fs/promises'
+
+import * as v from 'valibot'
+
+import {
+ BASELINE_ECMASCRIPT_LIB,
+ BROWSER_BASELINE,
+ SUPPORT_SENTINELS,
+ browserslistQueries,
+ missingSupportSentinels,
+ viteBuildTarget,
+ type BaselineBrowser
+} from '@/app/shell/support/baseline'
+
+import { repoPath } from '#tests/helpers/paths'
+
+const BROWSERS = Object.keys(BROWSER_BASELINE) as BaselineBrowser[]
+
+const oxlintSettingsSchema = v.object({
+ settings: v.object({ browsers: v.array(v.string()) })
+})
+const tsconfigLibSchema = v.object({
+ compilerOptions: v.object({ lib: v.array(v.string()) })
+})
+
+/** tsconfigs whose output ships to browsers and must stay on the baseline lib. */
+const BROWSER_TSCONFIGS = [
+ 'tsconfig.json',
+ 'packages/core/tsconfig.json',
+ 'packages/vue/tsconfig.json',
+ 'packages/dom-css/tsconfig.json',
+ 'packages/fig/tsconfig.json',
+ 'packages/pen/tsconfig.json'
+]
+
+async function readJSON<T>(schema: v.GenericSchema<unknown, T>, path: string): Promise<T> {
+ return v.parse(schema, JSON.parse(await readFile(repoPath(path), 'utf8')))
+}
+
+describe('browser baseline', () => {
+ test('derives the Vite build target from the baseline', () => {
+ expect(viteBuildTarget()).toEqual([
+ 'chrome111',
+ 'edge111',
+ 'firefox128',
+ 'safari16.4',
+ 'ios16.4'
+ ])
+ })
+
+ test('oxlint checks Web APIs against the same browsers', async () => {
+ const { settings } = await readJSON(oxlintSettingsSchema, 'oxlint.json')
+ expect(settings.browsers).toEqual(browserslistQueries())
+ })
+
+ test.each(BROWSER_TSCONFIGS)('%s pins the baseline ECMAScript lib', async (path) => {
+ const { compilerOptions } = await readJSON(tsconfigLibSchema, path)
+ expect(compilerOptions.lib[0]).toBe(BASELINE_ECMASCRIPT_LIB)
+ })
+
+ test.each(BROWSERS)('no sentinel demands more than the %s baseline', (browser) => {
+ for (const sentinel of SUPPORT_SENTINELS) {
+ const since = sentinel.since[browser]
+ expect(since, `${sentinel.name} has no ${browser} entry`).toBeDefined()
+ expect(since ?? Number.POSITIVE_INFINITY).toBeLessThanOrEqual(BROWSER_BASELINE[browser])
+ }
+ })
+
+ test.each(BROWSERS)('at least one sentinel marks the %s baseline exactly', (browser) => {
+ const newest = Math.max(...SUPPORT_SENTINELS.map((sentinel) => sentinel.since[browser] ?? 0))
+ expect(newest).toBe(BROWSER_BASELINE[browser])
+ })
+
+ test('reports the names of failing sentinels and tolerates throwing tests', () => {
+ const missing = missingSupportSentinels([
+ { name: 'present', since: {}, test: () => true },
+ { name: 'absent', since: {}, test: () => false },
+ {
+ name: 'throws',
+ since: {},
+ test: () => {
+ throw new TypeError('not a function')
+ }
+ }
+ ])
+ expect(missing).toEqual(['absent', 'throws'])
+ })
+})
diff --git a/tests/app/shell/support/boot.test.ts b/tests/app/shell/support/boot.test.ts
new file mode 100644
index 000000000..0a9a51031
--- /dev/null
+++ b/tests/app/shell/support/boot.test.ts
@@ -0,0 +1,82 @@
+import { describe, expect, mock, test } from 'bun:test'
+
+import { ErrorCodes, defineComponent, h, nextTick, onMounted } from 'vue'
+
+import { isFatalBootErrorInfo, observeBootErrors } from '@/app/shell/support/boot'
+
+import { createTestRenderer, hostNode } from '#tests/helpers/vue/renderer'
+
+function mountApp(root: ReturnType<typeof defineComponent>) {
+ const app = createTestRenderer().createApp(root)
+ const observer = observeBootErrors(app)
+ const logged = mock(() => undefined)
+ const restoreConsole = console.error
+ console.error = logged
+ try {
+ app.mount(hostNode())
+ } finally {
+ console.error = restoreConsole
+ }
+ return { app, observer, logged }
+}
+
+describe('fatal boot error info', () => {
+ test.each([
+ ['setup function', ErrorCodes.SETUP_FUNCTION, true],
+ ['render function', ErrorCodes.RENDER_FUNCTION, true],
+ ['async component loader', ErrorCodes.ASYNC_COMPONENT_LOADER, true],
+ ['scheduler flush', ErrorCodes.SCHEDULER, true],
+ ['component update', ErrorCodes.COMPONENT_UPDATE, true],
+ ['mounted hook', 'm', false],
+ ['native event handler', ErrorCodes.NATIVE_EVENT_HANDLER, false],
+ ['watcher callback', 3, false]
+ ])('classifies %s in development and production form alike', (dev, code, fatal) => {
+ expect(isFatalBootErrorInfo(dev)).toBe(fatal)
+ // Production builds replace the string with the error reference URL.
+ expect(isFatalBootErrorInfo(`https://vuejs.org/error-reference/#runtime-${code}`)).toBe(fatal)
+ })
+})
+
+describe('boot error observer', () => {
+ test('captures a setup failure that leaves the first render blank', async () => {
+ const error = new TypeError('Promise.withResolvers is not a function')
+ const Broken = defineComponent({
+ setup() {
+ throw error
+ },
+ render: () => h('div')
+ })
+ const { app, observer, logged } = mountApp(Broken)
+ await nextTick()
+ expect(observer.stop()).toEqual({ error })
+ expect(logged).toHaveBeenCalledWith(error)
+ expect(app.config.errorHandler).toBeUndefined()
+ })
+
+ test('leaves lifecycle hook errors to the regular error handling', async () => {
+ const Flaky = defineComponent({
+ setup() {
+ onMounted(() => {
+ throw new Error('non-fatal')
+ })
+ return () => h('div', 'rendered')
+ }
+ })
+ const { observer, logged } = mountApp(Flaky)
+ await nextTick()
+ expect(observer.stop()).toBeUndefined()
+ expect(logged).toHaveBeenCalledTimes(1)
+ })
+
+ test('forwards to and restores a previously installed handler', () => {
+ const app = createTestRenderer().createApp(defineComponent({ render: () => h('div') }))
+ const previous = mock(() => undefined)
+ app.config.errorHandler = previous
+ const observer = observeBootErrors(app)
+ const error = new Error('boom')
+ app.config.errorHandler?.(error, null, 'setup function')
+ expect(previous).toHaveBeenCalledWith(error, null, 'setup function')
+ expect(observer.stop()).toEqual({ error })
+ expect(app.config.errorHandler).toBe(previous)
+ })
+})
diff --git a/tests/app/shell/support/detect.test.ts b/tests/app/shell/support/detect.test.ts
new file mode 100644
index 000000000..21d35087d
--- /dev/null
+++ b/tests/app/shell/support/detect.test.ts
@@ -0,0 +1,80 @@
+import { describe, expect, test } from 'bun:test'
+
+import { baselineBrowserFor, describeEnvironment, parseUserAgent } from '@/app/shell/support/detect'
+
+const MAC_SAFARI =
+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Safari/605.1.15'
+const MAC_WKWEBVIEW =
+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko)'
+const WINDOWS_CHROME =
+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36'
+const WINDOWS_EDGE =
+ 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36 Edg/109.0.1518.78'
+const LINUX_OPERA =
+ 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36 OPR/94.0.0.0'
+const LINUX_FIREFOX = 'Mozilla/5.0 (X11; Linux x86_64; rv:115.0) Gecko/20100101 Firefox/115.0'
+const IPHONE_CHROME =
+ 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/110.0.5481.83 Mobile/15E148 Safari/604.1'
+const IPAD_DESKTOP_SAFARI =
+ 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15'
+
+describe('user agent detection', () => {
+ test.each([
+ [MAC_SAFARI, { os: 'macos', browser: 'safari', browserVersion: 16.3 }],
+ [MAC_WKWEBVIEW, { os: 'macos', browser: 'safari', browserVersion: undefined }],
+ [WINDOWS_CHROME, { os: 'windows', browser: 'chrome', browserVersion: 105 }],
+ [WINDOWS_EDGE, { os: 'windows', browser: 'edge', browserVersion: 109 }],
+ [LINUX_OPERA, { os: 'linux', browser: 'opera', browserVersion: 108 }],
+ [LINUX_FIREFOX, { os: 'linux', browser: 'firefox', browserVersion: 115 }],
+ [IPHONE_CHROME, { os: 'ios', browser: 'safari', browserVersion: 16.3 }],
+ ['curl/8.0', { os: 'unknown', browser: 'unknown', browserVersion: undefined }]
+ ])('parses %s', (userAgent, expected) => {
+ expect(parseUserAgent(userAgent)).toEqual(expected)
+ })
+
+ test('recognises iPadOS behind a desktop-class Macintosh user agent', () => {
+ expect(parseUserAgent(IPAD_DESKTOP_SAFARI, 5)).toEqual({
+ os: 'ios',
+ browser: 'safari',
+ browserVersion: 16.1
+ })
+ })
+
+ test('prefers the desktop shell facts over the WebView user agent', () => {
+ const env = describeEnvironment(
+ { userAgent: MAC_WKWEBVIEW, maxTouchPoints: 0 },
+ { platform: 'macos', osVersion: '13.7.8', webviewVersion: '18615.1.26.11.23' }
+ )
+ expect(env).toEqual({
+ host: 'desktop',
+ os: 'macos',
+ osVersion: '13.7.8',
+ browser: 'safari',
+ browserVersion: undefined,
+ webviewVersion: '18615.1.26.11.23',
+ userAgent: MAC_WKWEBVIEW
+ })
+ })
+
+ test('keeps the user agent operating system when the shell cannot name one', () => {
+ const env = describeEnvironment(
+ { userAgent: LINUX_FIREFOX, maxTouchPoints: 0 },
+ { platform: 'unknown' }
+ )
+ expect(env.host).toBe('desktop')
+ expect(env.os).toBe('linux')
+ })
+
+ test.each([
+ [WINDOWS_CHROME, 'chrome'],
+ [LINUX_OPERA, 'chrome'],
+ [WINDOWS_EDGE, 'edge'],
+ [LINUX_FIREFOX, 'firefox'],
+ [MAC_SAFARI, 'safari'],
+ [IPHONE_CHROME, 'ios'],
+ ['curl/8.0', undefined]
+ ])('maps %s to its baseline entry', (userAgent, expected) => {
+ const env = describeEnvironment({ userAgent, maxTouchPoints: 0 })
+ expect(baselineBrowserFor(env)).toBe(expected)
+ })
+})
diff --git a/tests/app/shell/support/guidance.test.ts b/tests/app/shell/support/guidance.test.ts
new file mode 100644
index 000000000..7b716cc58
--- /dev/null
+++ b/tests/app/shell/support/guidance.test.ts
@@ -0,0 +1,173 @@
+import { describe, expect, test } from 'bun:test'
+
+import type { SupportEnvironment } from '@/app/shell/support/detect'
+import {
+ SYSTEM_REQUIREMENTS_URL,
+ WEBVIEW2_DOWNLOAD_URL,
+ bootFailureNotice,
+ unsupportedNotice
+} from '@/app/shell/support/guidance'
+
+const MISSING = ['String.prototype.isWellFormed']
+
+function environment(overrides: Partial<SupportEnvironment>): SupportEnvironment {
+ return {
+ host: 'browser',
+ os: 'unknown',
+ browser: 'unknown',
+ userAgent: 'test-agent',
+ ...overrides
+ }
+}
+
+function reportLink(notice: ReturnType<typeof unsupportedNotice>): URL {
+ const link = notice.links.find((entry) => entry.label === 'Report a problem')
+ expect(link).toBeDefined()
+ return new URL(link?.url ?? '')
+}
+
+describe('unsupported engine guidance', () => {
+ test('tells a desktop Mac on a supported macOS to install Software Update', () => {
+ const notice = unsupportedNotice(
+ environment({ host: 'desktop', os: 'macos', browser: 'safari', osVersion: '13.7.8' }),
+ MISSING
+ )
+ expect(notice.heading).toBe('Update macOS to run OpenPencil')
+ expect(notice.paragraphs[0]).toContain('macOS 13.7.8')
+ expect(notice.paragraphs[1]).toContain('Software Update')
+ expect(reportLink(notice).searchParams.get('platform')).toBe('macOS (Tauri)')
+ })
+
+ test('tells a desktop Mac below the minimum macOS to upgrade the OS', () => {
+ const notice = unsupportedNotice(
+ environment({ host: 'desktop', os: 'macos', browser: 'safari', osVersion: '12.6.4' }),
+ MISSING
+ )
+ expect(notice.heading).toBe('OpenPencil needs macOS 13 or later')
+ })
+
+ test('names the WebKitGTK package on Linux desktops', () => {
+ const notice = unsupportedNotice(
+ environment({ host: 'desktop', os: 'linux', browser: 'safari', webviewVersion: '2.38.6' }),
+ MISSING
+ )
+ expect(notice.heading).toBe('Update WebKitGTK to run OpenPencil')
+ expect(notice.paragraphs[0]).toContain('2.38.6')
+ expect(notice.paragraphs[1]).toContain('webkit2gtk-4.1')
+ })
+
+ test('links the WebView2 runtime on Windows desktops', () => {
+ const notice = unsupportedNotice(
+ environment({ host: 'desktop', os: 'windows', browser: 'edge', browserVersion: 100 }),
+ MISSING
+ )
+ expect(notice.heading).toBe('Update WebView2 to run OpenPencil')
+ expect(notice.links.map((link) => link.url)).toContain(WEBVIEW2_DOWNLOAD_URL)
+ })
+
+ test.each([
+ [
+ 'chrome',
+ 105,
+ 'Update Chrome to run OpenPencil',
+ 'Chrome 105 detected. OpenPencil needs Chrome 111 or later.'
+ ],
+ [
+ 'edge',
+ 109,
+ 'Update Edge to run OpenPencil',
+ 'Edge 109 detected. OpenPencil needs Edge 111 or later.'
+ ],
+ [
+ 'firefox',
+ 115,
+ 'Update Firefox to run OpenPencil',
+ 'Firefox 115 detected. OpenPencil needs Firefox 128 or later.'
+ ],
+ [
+ 'safari',
+ 16.2,
+ 'Update Safari to run OpenPencil',
+ 'Safari 16.2 detected. OpenPencil needs Safari 16.4 or later.'
+ ],
+ [
+ 'opera',
+ 108,
+ 'Update Opera to run OpenPencil',
+ 'Opera 108 detected. OpenPencil needs Opera built on Chrome 111 or later.'
+ ]
+ ] as const)(
+ 'names the outdated %s version and the minimum',
+ (browser, version, heading, first) => {
+ const notice = unsupportedNotice(
+ environment({ os: 'windows', browser, browserVersion: version }),
+ MISSING
+ )
+ expect(notice.heading).toBe(heading)
+ expect(notice.paragraphs[0]).toBe(first)
+ expect(notice.paragraphs[1]).not.toHaveLength(0)
+ }
+ )
+
+ test('sends every iOS browser to the system software update', () => {
+ const notice = unsupportedNotice(
+ environment({ os: 'ios', browser: 'safari', browserVersion: 16.1 }),
+ MISSING
+ )
+ expect(notice.heading).toBe('Update iOS to run OpenPencil')
+ expect(notice.paragraphs[0]).toContain('iOS 16.4')
+ })
+
+ test('does not ask a browser that already meets the baseline to update', () => {
+ const notice = unsupportedNotice(
+ environment({ os: 'windows', browser: 'chrome', browserVersion: 120 }),
+ MISSING
+ )
+ expect(notice.heading).toBe('A required browser feature is unavailable')
+ expect(notice.paragraphs[0]).toContain('Chrome 120')
+ expect(notice.paragraphs[0]).toContain('String.prototype.isWellFormed')
+ })
+
+ test('falls back to the full requirements for an unknown browser', () => {
+ const notice = unsupportedNotice(environment({}), MISSING)
+ expect(notice.heading).toBe("OpenPencil can't run in this browser")
+ expect(notice.paragraphs[0]).toBe(
+ 'OpenPencil needs Chrome 111, Edge 111, Firefox 128, or Safari 16.4 or later.'
+ )
+ })
+
+ test('prefills the bug report with the missing features and environment', () => {
+ const notice = unsupportedNotice(
+ environment({ os: 'linux', browser: 'firefox', browserVersion: 115 }),
+ MISSING
+ )
+ const url = reportLink(notice)
+ expect(url.origin + url.pathname).toBe('https://github.com/open-pencil/open-pencil/issues/new')
+ expect(url.searchParams.get('template')).toBe('bug_report.yml')
+ expect(url.searchParams.get('platform')).toBe('Web (app.openpencil.dev)')
+ expect(url.searchParams.get('browser')).toBe('test-agent')
+ expect(url.searchParams.get('logs')).toContain('Missing: String.prototype.isWellFormed')
+ expect(url.searchParams.get('logs')).toContain('Browser: Firefox 115')
+ expect(notice.links.map((link) => link.url)).toContain(SYSTEM_REQUIREMENTS_URL)
+ })
+})
+
+describe('boot failure guidance', () => {
+ test('explains a blank window and carries the error into the details', () => {
+ const error = new TypeError('Promise.withResolvers is not a function')
+ const notice = bootFailureNotice(
+ environment({ host: 'desktop', os: 'macos', browser: 'safari', osVersion: '13.7.8' }),
+ error
+ )
+ expect(notice.heading).toBe("OpenPencil couldn't start")
+ expect(notice.paragraphs[1]).toContain('Safari updates')
+ expect(notice.details[0]).toBe('TypeError: Promise.withResolvers is not a function')
+ expect(reportLink(notice).searchParams.get('logs')).toContain('OS: macos 13.7.8')
+ })
+
+ test('states the browser requirements for a web boot failure', () => {
+ const notice = bootFailureNotice(environment({ os: 'windows', browser: 'chrome' }), 'boom')
+ expect(notice.paragraphs[1]).toContain('Chrome 111')
+ expect(notice.details[0]).toBe('boom')
+ })
+})
diff --git a/tests/e2e/app/support-gate.spec.ts b/tests/e2e/app/support-gate.spec.ts
new file mode 100644
index 000000000..2adeb9177
--- /dev/null
+++ b/tests/e2e/app/support-gate.spec.ts
@@ -0,0 +1,76 @@
+import { expect, test } from '@playwright/test'
+
+test.describe('browser support gate', () => {
+ test('explains a missing baseline feature instead of booting into a blank window', async ({
+ page
+ }) => {
+ await page.addInitScript(() => {
+ // Playwright's Chromium is above the baseline, so remove one sentinel
+ // feature to simulate an engine that cannot run the app.
+ Reflect.deleteProperty(String.prototype, 'isWellFormed')
+ })
+ await page.goto('/')
+
+ const notice = page.getByRole('alert')
+ await expect(notice.getByRole('heading', { level: 1 })).toHaveText(
+ 'A required browser feature is unavailable'
+ )
+ await expect(notice).toContainText('String.prototype.isWellFormed')
+ await expect(notice.getByRole('link', { name: 'System requirements' })).toHaveAttribute(
+ 'href',
+ 'https://openpencil.dev/getting-started#system-requirements'
+ )
+
+ const report = notice.getByRole('link', { name: 'Report a problem' })
+ const href = new URL((await report.getAttribute('href')) ?? '')
+ expect(href.pathname).toBe('/open-pencil/open-pencil/issues/new')
+ expect(href.searchParams.get('template')).toBe('bug_report.yml')
+ expect(href.searchParams.get('platform')).toBe('Web (app.openpencil.dev)')
+ expect(href.searchParams.get('logs')).toContain('Missing: String.prototype.isWellFormed')
+
+ await notice.getByText('Details', { exact: true }).click()
+ await expect(notice.locator('pre')).toContainText('User agent:')
+ await expect(page.locator('canvas')).toHaveCount(0)
+ })
+
+ test('replaces a blank window with a boot failure notice when the app cannot load', async ({
+ page
+ }) => {
+ await page.addInitScript(() => {
+ // Keep every sentinel intact but break an API the app needs while
+ // booting, so the failure surfaces after the gate has passed.
+ Object.defineProperty(window, 'history', {
+ configurable: true,
+ get() {
+ throw new TypeError('history is unavailable')
+ }
+ })
+ })
+ await page.goto('/')
+
+ const notice = page.getByRole('alert')
+ await expect(notice.getByRole('heading', { level: 1 })).toHaveText("OpenPencil couldn't start")
+ await expect(notice).toContainText('Chrome 111')
+ await notice.getByText('Details', { exact: true }).click()
+ await expect(notice.locator('pre')).toContainText('history is unavailable')
+ })
+
+ test('reports a component that fails while rendering the first route', async ({ page }) => {
+ await page.addInitScript(() => {
+ // The editor store mints node ids inside component setup, so this
+ // fails through Vue's error handler rather than module evaluation.
+ Object.defineProperty(crypto, 'getRandomValues', {
+ configurable: true,
+ value() {
+ throw new TypeError('getRandomValues is unavailable')
+ }
+ })
+ })
+ await page.goto('/')
+
+ const notice = page.getByRole('alert')
+ await expect(notice.getByRole('heading', { level: 1 })).toHaveText("OpenPencil couldn't start")
+ await notice.getByText('Details', { exact: true }).click()
+ await expect(notice.locator('pre')).toContainText('getRandomValues is unavailable')
+ })
+})
diff --git a/tests/e2e/native/support.spec.ts b/tests/e2e/native/support.spec.ts
new file mode 100644
index 000000000..107642544
--- /dev/null
+++ b/tests/e2e/native/support.spec.ts
@@ -0,0 +1,25 @@
+import { strict as assert } from 'node:assert'
+
+import { invokeNative } from '#tests/helpers/tauri/invoke'
+import { nativeOSFacts } from '#tests/helpers/tauri/os'
+
+describe('native support facts', () => {
+ it('boots through the support gate into the editor', async () => {
+ await browser.waitUntil(
+ async () => browser.execute(() => Boolean(window.openPencil?.getStore?.())),
+ { timeout: 30_000, timeoutMsg: 'OpenPencil editor did not initialize' }
+ )
+ const notice = await browser.execute(() => Boolean(document.querySelector('#boot-notice')))
+ assert.equal(notice, false)
+ })
+
+ it('reports the OS and WebView engine versions the support notice names', async () => {
+ const { platform, version } = await nativeOSFacts()
+ assert.ok(['macos', 'windows', 'linux'].includes(platform), `platform: ${platform}`)
+ assert.match(version, /^\d+(\.\d+)*/)
+
+ const webviewVersion = await invokeNative<string | null>('webview_version')
+ assert.ok(webviewVersion, 'webview_version returned nothing')
+ assert.match(webviewVersion, /\d+(\.\d+)+/)
+ })
+})
diff --git a/tests/helpers/tauri/native-global.d.ts b/tests/helpers/tauri/native-global.d.ts
index c8e9bfc95..1ce4197e3 100644
--- a/tests/helpers/tauri/native-global.d.ts
+++ b/tests/helpers/tauri/native-global.d.ts
@@ -1,4 +1,5 @@
import type * as TauriAPI from '@tauri-apps/api'
+import type * as TauriOS from '@tauri-apps/plugin-os'
export {}
@@ -35,7 +36,7 @@ type NativeTestStore = {
declare global {
interface Window {
- __TAURI__?: Pick<typeof TauriAPI, 'core'>
+ __TAURI__?: Pick<typeof TauriAPI, 'core'> & { os?: typeof TauriOS }
openPencil?: {
getStore?: () => NativeTestStore
}
diff --git a/tests/helpers/tauri/os.ts b/tests/helpers/tauri/os.ts
new file mode 100644
index 000000000..07edba9e9
--- /dev/null
+++ b/tests/helpers/tauri/os.ts
@@ -0,0 +1,15 @@
+import type { Platform } from '@tauri-apps/plugin-os'
+
+export interface NativeOSFacts {
+ platform: Platform
+ version: string
+}
+
+/** Read the OS plugin facts through its global API inside the built WebView. */
+export async function nativeOSFacts(): Promise<NativeOSFacts> {
+ return browser.execute(() => {
+ const os = window.__TAURI__?.os
+ if (!os) throw new Error('Native test requires the OS plugin global API')
+ return { platform: os.platform(), version: os.version() }
+ })
+}
diff --git a/tools/architecture/src/steiger-rules/index.ts b/tools/architecture/src/steiger-rules/index.ts
index a845832c3..3da01cb3a 100644
--- a/tools/architecture/src/steiger-rules/index.ts
+++ b/tools/architecture/src/steiger-rules/index.ts
@@ -106,8 +106,14 @@ const strictTestFilePlacement = createFileRule(
if (/\/visual\/[^/]+\.ts$/.test(sourceRel)) return null
return 'Engine/unit tests must live under tests/engine/** and use *.test.ts; helpers.ts, *.bench.ts, and domain visual support scripts are allowed.'
}
+ // Canonical unit-test homes from packages/docs/development/testing.md.
+ if (sourceRel.startsWith('tests/app/') || sourceRel.startsWith('tests/integration/')) {
+ return sourceRel.endsWith('.test.ts')
+ ? null
+ : 'App and integration unit tests must use *.test.ts under tests/app/** or tests/integration/**.'
+ }
if (sourceRel.startsWith('tests/helpers/')) return null
- return 'Tests must live under tests/e2e/** (*.spec.ts), tests/engine/** (*.test.ts), or tests/helpers/**.'
+ return 'Tests must live under tests/e2e/** (*.spec.ts), tests/app/**, tests/integration/**, tests/engine/** (*.test.ts), or tests/helpers/**.'
}
)
diff --git a/tools/unit-tests/tests/shards.test.ts b/tools/unit-tests/tests/shards.test.ts
index b9cf791c9..83e43993a 100644
--- a/tools/unit-tests/tests/shards.test.ts
+++ b/tools/unit-tests/tests/shards.test.ts
@@ -15,8 +15,10 @@ async function discover(pattern: string): Promise<string[]> {
return Array.fromAsync(new Bun.Glob(pattern).scan({ cwd: REPO_ROOT }))
}
-test('every engine and package-local test belongs to exactly one shard', async () => {
+test('every app, engine and package-local test belongs to exactly one shard', async () => {
const discovered = [
+ ...(await discover('tests/app/**/*.test.ts')),
+ ...(await discover('tests/integration/**/*.test.ts')),
...(await discover('tests/engine/**/*.test.ts')),
...(await discover('packages/*/tests/**/*.test.ts'))
].filter((file) => !file.startsWith('packages/harness/'))
diff --git a/tsconfig.json b/tsconfig.json
index d22aa8811..5f3b76dba 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -3,7 +3,7 @@
"target": "ES2022",
"useDefineForClassFields": true,
"lib": [
- "ESNext",
+ "ES2023",
"DOM",
"DOM.Iterable"
],
diff --git a/vite.config.ts b/vite.config.ts
index 0f0527e63..9cdb186f1 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -10,6 +10,7 @@ import { defineConfig } from 'vite'
import { ensureBrandAssets } from '@open-pencil/brand-tools'
import packageJson from './package.json'
+import { viteBuildTarget } from './src/app/shell/support/baseline'
import { createOpenPencilAliases } from './vite/aliases'
import {
localAutomationRoute,
@@ -50,6 +51,8 @@ export default defineConfig(async ({ command }) => {
],
clearScreen: false,
build: {
+ // Syntax is lowered to the supported browser baseline; APIs are not polyfilled.
+ target: viteBuildTarget(),
chunkSizeWarningLimit: 2500
},
server: createDevServerOptions(host, __dirname)