From 1ac10950217c707041588e6b359869db5b72db93 Mon Sep 17 00:00:00 2001 From: Justin Bennett Date: Tue, 12 Aug 2025 18:22:06 -0400 Subject: [PATCH 1/2] Convert Deno client to universal Node.js/Deno/Bun compatibility - Replace deno.json with package.json configuration - Convert Deno APIs to Node.js built-ins with node: prefix - Add TypeScript configuration for extensionless imports - Create post-build script to fix imports for Node.js compatibility - Update all examples to use new import paths - Add support for cross-runtime binary downloading - Remove Deno-specific configuration files --- src/clients/deno/README.md | 41 +- src/clients/deno/deno.json | 17 - src/clients/deno/deno.lock | 83 --- src/clients/deno/examples/ipc.d.ts | 2 + src/clients/deno/examples/ipc.d.ts.map | 1 + src/clients/deno/examples/ipc.js | 76 +++ src/clients/deno/examples/ipc.js.map | 1 + src/clients/deno/examples/ipc.ts | 2 +- src/clients/deno/examples/load-html.d.ts | 2 + src/clients/deno/examples/load-html.d.ts.map | 1 + src/clients/deno/examples/load-html.js | 82 +++ src/clients/deno/examples/load-html.js.map | 1 + src/clients/deno/examples/load-html.ts | 2 +- src/clients/deno/examples/load-url.d.ts | 2 + src/clients/deno/examples/load-url.d.ts.map | 1 + src/clients/deno/examples/load-url.js | 87 +++ src/clients/deno/examples/load-url.js.map | 1 + src/clients/deno/examples/load-url.ts | 2 +- src/clients/deno/examples/simple.d.ts | 2 + src/clients/deno/examples/simple.d.ts.map | 1 + src/clients/deno/examples/simple.js | 80 +++ src/clients/deno/examples/simple.js.map | 1 + src/clients/deno/examples/simple.ts | 2 +- src/clients/deno/examples/tldraw.d.ts | 2 + src/clients/deno/examples/tldraw.d.ts.map | 1 + src/clients/deno/examples/tldraw.js | 117 ++++ src/clients/deno/examples/tldraw.js.map | 1 + src/clients/deno/examples/tldraw.ts | 16 +- src/clients/deno/examples/window-size.d.ts | 2 + .../deno/examples/window-size.d.ts.map | 1 + src/clients/deno/examples/window-size.js | 99 +++ src/clients/deno/examples/window-size.js.map | 1 + src/clients/deno/examples/window-size.ts | 2 +- src/clients/deno/fix-imports.js | 56 ++ src/clients/deno/main.d.ts | 177 ++++++ src/clients/deno/main.d.ts.map | 1 + src/clients/deno/main.js | 557 ++++++++++++++++ src/clients/deno/main.js.map | 1 + src/clients/deno/main.ts | 293 +++++---- src/clients/deno/package-lock.json | 598 ++++++++++++++++++ src/clients/deno/package.json | 46 ++ src/clients/deno/schemas.d.ts | 227 +++++++ src/clients/deno/schemas.d.ts.map | 1 + src/clients/deno/schemas.js | 121 ++++ src/clients/deno/schemas.js.map | 1 + src/clients/deno/schemas.ts | 2 +- src/clients/deno/tsconfig.json | 44 ++ 47 files changed, 2609 insertions(+), 248 deletions(-) delete mode 100644 src/clients/deno/deno.json delete mode 100644 src/clients/deno/deno.lock create mode 100644 src/clients/deno/examples/ipc.d.ts create mode 100644 src/clients/deno/examples/ipc.d.ts.map create mode 100644 src/clients/deno/examples/ipc.js create mode 100644 src/clients/deno/examples/ipc.js.map create mode 100644 src/clients/deno/examples/load-html.d.ts create mode 100644 src/clients/deno/examples/load-html.d.ts.map create mode 100644 src/clients/deno/examples/load-html.js create mode 100644 src/clients/deno/examples/load-html.js.map create mode 100644 src/clients/deno/examples/load-url.d.ts create mode 100644 src/clients/deno/examples/load-url.d.ts.map create mode 100644 src/clients/deno/examples/load-url.js create mode 100644 src/clients/deno/examples/load-url.js.map create mode 100644 src/clients/deno/examples/simple.d.ts create mode 100644 src/clients/deno/examples/simple.d.ts.map create mode 100644 src/clients/deno/examples/simple.js create mode 100644 src/clients/deno/examples/simple.js.map create mode 100644 src/clients/deno/examples/tldraw.d.ts create mode 100644 src/clients/deno/examples/tldraw.d.ts.map create mode 100644 src/clients/deno/examples/tldraw.js create mode 100644 src/clients/deno/examples/tldraw.js.map create mode 100644 src/clients/deno/examples/window-size.d.ts create mode 100644 src/clients/deno/examples/window-size.d.ts.map create mode 100644 src/clients/deno/examples/window-size.js create mode 100644 src/clients/deno/examples/window-size.js.map create mode 100644 src/clients/deno/fix-imports.js create mode 100644 src/clients/deno/main.d.ts create mode 100644 src/clients/deno/main.d.ts.map create mode 100644 src/clients/deno/main.js create mode 100644 src/clients/deno/main.js.map create mode 100644 src/clients/deno/package-lock.json create mode 100644 src/clients/deno/package.json create mode 100644 src/clients/deno/schemas.d.ts create mode 100644 src/clients/deno/schemas.d.ts.map create mode 100644 src/clients/deno/schemas.js create mode 100644 src/clients/deno/schemas.js.map create mode 100644 src/clients/deno/tsconfig.json diff --git a/src/clients/deno/README.md b/src/clients/deno/README.md index 12ef734..df418de 100644 --- a/src/clients/deno/README.md +++ b/src/clients/deno/README.md @@ -1,22 +1,38 @@ -# @justbe/webview Deno Client +# @justbe/webview -A light, cross-platform library for building web-based desktop apps with -[Deno](https://deno.com/). +A light, cross-platform library for building web-based desktop apps. This package provides a universal client that is compatible with Deno, Node.js, and Bun. + +## Compatibility + +- ✅ **Node.js** 18+ (fully supported) +- ✅ **Deno** (original implementation, fully supported) +- ⚠️ **Bun** (limited support - older versions may have issues) ## Installation +### Node.js +```bash +npm install @justbe/webview +``` + +### Deno ```typescript import { createWebView } from "jsr:@justbe/webview"; ``` +### Bun +```bash +bun install @justbe/webview +``` + ## Example ```typescript -import { createWebView } from "jsr:@justbe/webview"; +import { createWebView } from "@justbe/webview"; using webview = await createWebView({ title: "Example", - html: "

Hello, World!

", + load: { html: "

Hello, World!

" }, devtools: true, }); @@ -28,10 +44,17 @@ webview.on("started", async () => { await webview.waitUntilClosed(); ``` -You can run this yourself with: +### Running Examples + +**Node.js:** +```bash +npm run build +node examples/simple.js +``` -```sh -deno run https://raw.githubusercontent.com/zephraph/webview/refs/heads/main/examples/simple.ts +**Deno:** +```bash +deno run --allow-all examples/simple.ts ``` Check out the [examples directory](examples/) for more examples. @@ -76,4 +99,4 @@ process. In this case, only one permission is needed: Note that this environment variable will never be _explicitly_ requested. If the script detects it's not allowed to read this env var it just skips this code -path altogether. +path altogether. \ No newline at end of file diff --git a/src/clients/deno/deno.json b/src/clients/deno/deno.json deleted file mode 100644 index fa8b8eb..0000000 --- a/src/clients/deno/deno.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "@justbe/webview", - "exports": "./main.ts", - "license": "MIT", - "version": "1.0.1-rc.2", - "publish": { - "include": ["README.md", "LICENSE", "*.ts", "schemas/*.ts"] - }, - "imports": { - "ts-pattern": "jsr:@gabriel/ts-pattern@^5.6.2", - "tracing": "jsr:@bcheidemann/tracing@^0.6.3", - "jsr:@std/fs": "jsr:@std/fs@^1.0.3", - "jsr:@std/path": "jsr:@std/path@^1.0.6", - "npm:zod": "npm:zod@^3.23.8", - "npm:type-fest": "npm:type-fest@^4.26.1" - } -} diff --git a/src/clients/deno/deno.lock b/src/clients/deno/deno.lock deleted file mode 100644 index 3fc948c..0000000 --- a/src/clients/deno/deno.lock +++ /dev/null @@ -1,83 +0,0 @@ -{ - "version": "4", - "specifiers": { - "jsr:@bcheidemann/parse-params@0.5": "0.5.0", - "jsr:@bcheidemann/tracing@~0.6.3": "0.6.3", - "jsr:@gabriel/ts-pattern@^5.6.2": "5.6.2", - "jsr:@std/assert@0.226": "0.226.0", - "jsr:@std/assert@0.226.0": "0.226.0", - "jsr:@std/fmt@~0.225.4": "0.225.6", - "jsr:@std/fs@^1.0.3": "1.0.6", - "jsr:@std/internal@1": "1.0.5", - "jsr:@std/path@^1.0.6": "1.0.8", - "jsr:@std/path@^1.0.8": "1.0.8", - "npm:acorn@8.12.0": "8.12.0", - "npm:type-fest@^4.26.1": "4.30.2", - "npm:zod@^3.23.8": "3.23.8" - }, - "jsr": { - "@bcheidemann/parse-params@0.5.0": { - "integrity": "a13a95163fad0cbd34890cb5d43df3466cc96e97e76674052592a90bbf56bbab", - "dependencies": [ - "jsr:@std/assert@0.226.0", - "npm:acorn" - ] - }, - "@bcheidemann/tracing@0.6.3": { - "integrity": "d6f38e77ef142a88b9eaeff3a2df54a8a24b2226fff747119ddc40726a05abeb", - "dependencies": [ - "jsr:@bcheidemann/parse-params", - "jsr:@std/assert@0.226", - "jsr:@std/fmt" - ] - }, - "@gabriel/ts-pattern@5.6.2": { - "integrity": "49a1069523e2ba53d024d6b17a30029f8ffc80b24fec86d724d986a9774a7197" - }, - "@std/assert@0.226.0": { - "integrity": "0dfb5f7c7723c18cec118e080fec76ce15b4c31154b15ad2bd74822603ef75b3", - "dependencies": [ - "jsr:@std/internal" - ] - }, - "@std/fmt@0.225.6": { - "integrity": "aba6aea27f66813cecfd9484e074a9e9845782ab0685c030e453a8a70b37afc8" - }, - "@std/fs@1.0.6": { - "integrity": "42b56e1e41b75583a21d5a37f6a6a27de9f510bcd36c0c85791d685ca0b85fa2", - "dependencies": [ - "jsr:@std/path@^1.0.8" - ] - }, - "@std/internal@1.0.5": { - "integrity": "54a546004f769c1ac9e025abd15a76b6671ddc9687e2313b67376125650dc7ba" - }, - "@std/path@1.0.8": { - "integrity": "548fa456bb6a04d3c1a1e7477986b6cffbce95102d0bb447c67c4ee70e0364be" - } - }, - "npm": { - "acorn@8.12.0": { - "integrity": "sha512-RTvkC4w+KNXrM39/lWCUaG0IbRkWdCv7W/IOW9oU6SawyxulvkQy5HQPVTKxEjczcUvapcrw3cFx/60VN/NRNw==" - }, - "type-fest@4.30.2": { - "integrity": "sha512-UJShLPYi1aWqCdq9HycOL/gwsuqda1OISdBO3t8RlXQC4QvtuIz4b5FCfe2dQIWEpmlRExKmcTBfP1r9bhY7ig==" - }, - "zod@3.23.8": { - "integrity": "sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==" - } - }, - "remote": { - "https://deno.land/x/esbuild@v0.24.0/wasm.js": "5cd1dd0c40214d06bd86177b4ffebfbb219a22114f78c14c23606f7ad216c174" - }, - "workspace": { - "dependencies": [ - "jsr:@bcheidemann/tracing@~0.6.3", - "jsr:@gabriel/ts-pattern@^5.6.2", - "jsr:@std/fs@^1.0.3", - "jsr:@std/path@^1.0.6", - "npm:type-fest@^4.26.1", - "npm:zod@^3.23.8" - ] - } -} diff --git a/src/clients/deno/examples/ipc.d.ts b/src/clients/deno/examples/ipc.d.ts new file mode 100644 index 0000000..565dc51 --- /dev/null +++ b/src/clients/deno/examples/ipc.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=ipc.d.ts.map \ No newline at end of file diff --git a/src/clients/deno/examples/ipc.d.ts.map b/src/clients/deno/examples/ipc.d.ts.map new file mode 100644 index 0000000..72d97b6 --- /dev/null +++ b/src/clients/deno/examples/ipc.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ipc.d.ts","sourceRoot":"","sources":["ipc.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/clients/deno/examples/ipc.js b/src/clients/deno/examples/ipc.js new file mode 100644 index 0000000..495a706 --- /dev/null +++ b/src/clients/deno/examples/ipc.js @@ -0,0 +1,76 @@ +var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose, inner; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; +}; +var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) { + return function (env) { + function fail(e) { + env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + var r, s = 0; + function next() { + while (r = env.stack.pop()) { + try { + if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); + if (r.dispose) { + var result = r.dispose.call(r.value); + if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + else s |= 1; + } + catch (e) { + fail(e); + } + } + if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); + if (env.hasError) throw env.error; + } + return next(); + }; +})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; +}); +import { createWebView } from '../main.js'; +var webview; +const env_1 = { stack: [], error: void 0, hasError: false }; +try { + webview = __addDisposableResource(env_1, await createWebView({ + title: "Simple", + load: { + html: '', + }, + ipc: true, + }), false); + webview.on("ipc", ({ message }) => { + console.log(message); + }); + await webview.waitUntilClosed(); +} +catch (e_1) { + env_1.error = e_1; + env_1.hasError = true; +} +finally { + __disposeResources(env_1); +} +//# sourceMappingURL=ipc.js.map \ No newline at end of file diff --git a/src/clients/deno/examples/ipc.js.map b/src/clients/deno/examples/ipc.js.map new file mode 100644 index 0000000..1631f7c --- /dev/null +++ b/src/clients/deno/examples/ipc.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ipc.js","sourceRoot":"","sources":["ipc.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;;;;IAElC,yCAAU,MAAM,aAAa,CAAC;QAClC,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE;YACJ,IAAI,EACF,4FAA4F;SAC/F;QACD,GAAG,EAAE,IAAI;KACV,CAAC,QAAA,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC"} \ No newline at end of file diff --git a/src/clients/deno/examples/ipc.ts b/src/clients/deno/examples/ipc.ts index 5424b8f..0bffeff 100644 --- a/src/clients/deno/examples/ipc.ts +++ b/src/clients/deno/examples/ipc.ts @@ -1,4 +1,4 @@ -import { createWebView } from "../main.ts"; +import { createWebView } from "../main"; using webview = await createWebView({ title: "Simple", diff --git a/src/clients/deno/examples/load-html.d.ts b/src/clients/deno/examples/load-html.d.ts new file mode 100644 index 0000000..374de6e --- /dev/null +++ b/src/clients/deno/examples/load-html.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=load-html.d.ts.map \ No newline at end of file diff --git a/src/clients/deno/examples/load-html.d.ts.map b/src/clients/deno/examples/load-html.d.ts.map new file mode 100644 index 0000000..30634af --- /dev/null +++ b/src/clients/deno/examples/load-html.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"load-html.d.ts","sourceRoot":"","sources":["load-html.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/clients/deno/examples/load-html.js b/src/clients/deno/examples/load-html.js new file mode 100644 index 0000000..3b955c8 --- /dev/null +++ b/src/clients/deno/examples/load-html.js @@ -0,0 +1,82 @@ +var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose, inner; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; +}; +var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) { + return function (env) { + function fail(e) { + env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + var r, s = 0; + function next() { + while (r = env.stack.pop()) { + try { + if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); + if (r.dispose) { + var result = r.dispose.call(r.value); + if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + else s |= 1; + } + catch (e) { + fail(e); + } + } + if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); + if (env.hasError) throw env.error; + } + return next(); + }; +})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; +}); +import { createWebView } from '../main.js'; +var webview; +const env_1 = { stack: [], error: void 0, hasError: false }; +try { + webview = __addDisposableResource(env_1, await createWebView({ + title: "Load Html Example", + load: { + html: "

Initial html

", + // Note: This origin is used with a custom protocol so it doesn't match + // https://example.com. This doesn't need to be set, but can be useful if + // you want to control resources that are scoped to a specific origin like + // local storage or indexeddb. + origin: "example.com", + }, + devtools: true, + }), false); + webview.on("started", async () => { + await webview.openDevTools(); + await webview.loadHtml("

Updated html!

"); + }); + await webview.waitUntilClosed(); +} +catch (e_1) { + env_1.error = e_1; + env_1.hasError = true; +} +finally { + __disposeResources(env_1); +} +//# sourceMappingURL=load-html.js.map \ No newline at end of file diff --git a/src/clients/deno/examples/load-html.js.map b/src/clients/deno/examples/load-html.js.map new file mode 100644 index 0000000..598cabd --- /dev/null +++ b/src/clients/deno/examples/load-html.js.map @@ -0,0 +1 @@ +{"version":3,"file":"load-html.js","sourceRoot":"","sources":["load-html.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;;;;IAElC,yCAAU,MAAM,aAAa,CAAC;QAClC,KAAK,EAAE,mBAAmB;QAC1B,IAAI,EAAE;YACJ,IAAI,EAAE,uBAAuB;YAC7B,uEAAuE;YACvE,yEAAyE;YACzE,0EAA0E;YAC1E,8BAA8B;YAC9B,MAAM,EAAE,aAAa;SACtB;QACD,QAAQ,EAAE,IAAI;KACf,CAAC,QAAA,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QAC/B,MAAM,OAAO,CAAC,YAAY,EAAE,CAAC;QAC7B,MAAM,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC"} \ No newline at end of file diff --git a/src/clients/deno/examples/load-html.ts b/src/clients/deno/examples/load-html.ts index fff0e5c..fa96dc0 100644 --- a/src/clients/deno/examples/load-html.ts +++ b/src/clients/deno/examples/load-html.ts @@ -1,4 +1,4 @@ -import { createWebView } from "../main.ts"; +import { createWebView } from "../main"; using webview = await createWebView({ title: "Load Html Example", diff --git a/src/clients/deno/examples/load-url.d.ts b/src/clients/deno/examples/load-url.d.ts new file mode 100644 index 0000000..c0f1fb9 --- /dev/null +++ b/src/clients/deno/examples/load-url.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=load-url.d.ts.map \ No newline at end of file diff --git a/src/clients/deno/examples/load-url.d.ts.map b/src/clients/deno/examples/load-url.d.ts.map new file mode 100644 index 0000000..8799f16 --- /dev/null +++ b/src/clients/deno/examples/load-url.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"load-url.d.ts","sourceRoot":"","sources":["load-url.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/clients/deno/examples/load-url.js b/src/clients/deno/examples/load-url.js new file mode 100644 index 0000000..eec8cd8 --- /dev/null +++ b/src/clients/deno/examples/load-url.js @@ -0,0 +1,87 @@ +var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose, inner; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; +}; +var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) { + return function (env) { + function fail(e) { + env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + var r, s = 0; + function next() { + while (r = env.stack.pop()) { + try { + if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); + if (r.dispose) { + var result = r.dispose.call(r.value); + if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + else s |= 1; + } + catch (e) { + fail(e); + } + } + if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); + if (env.hasError) throw env.error; + } + return next(); + }; +})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; +}); +import { createWebView } from '../main.js'; +function sleep(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} +var webview; +const env_1 = { stack: [], error: void 0, hasError: false }; +try { + webview = __addDisposableResource(env_1, await createWebView({ + title: "Load Url Example", + load: { + url: "https://example.com", + headers: { + "Content-Type": "text/html", + }, + }, + userAgent: "curl/7.81.0", + devtools: true, + }), false); + webview.on("started", async () => { + await webview.openDevTools(); + await sleep(2000); + await webview.loadUrl("https://val.town/", { + "Content-Type": "text/html", + }); + }); + await webview.waitUntilClosed(); +} +catch (e_1) { + env_1.error = e_1; + env_1.hasError = true; +} +finally { + __disposeResources(env_1); +} +//# sourceMappingURL=load-url.js.map \ No newline at end of file diff --git a/src/clients/deno/examples/load-url.js.map b/src/clients/deno/examples/load-url.js.map new file mode 100644 index 0000000..7d2bc38 --- /dev/null +++ b/src/clients/deno/examples/load-url.js.map @@ -0,0 +1 @@ +{"version":3,"file":"load-url.js","sourceRoot":"","sources":["load-url.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAwBxC,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;;;;IAxBK,yCAAU,MAAM,aAAa,CAAC;QAClC,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE;YACJ,GAAG,EAAE,qBAAqB;YAC1B,OAAO,EAAE;gBACP,cAAc,EAAE,WAAW;aAC5B;SACF;QACD,SAAS,EAAE,aAAa;QACxB,QAAQ,EAAE,IAAI;KACf,CAAC,QAAA,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QAC/B,MAAM,OAAO,CAAC,YAAY,EAAE,CAAC;QAC7B,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;QAClB,MAAM,OAAO,CAAC,OAAO,CAAC,mBAAmB,EAAE;YACzC,cAAc,EAAE,WAAW;SAC5B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC"} \ No newline at end of file diff --git a/src/clients/deno/examples/load-url.ts b/src/clients/deno/examples/load-url.ts index 48b5df7..b567f2f 100644 --- a/src/clients/deno/examples/load-url.ts +++ b/src/clients/deno/examples/load-url.ts @@ -1,4 +1,4 @@ -import { createWebView } from "../main.ts"; +import { createWebView } from "../main"; using webview = await createWebView({ title: "Load Url Example", diff --git a/src/clients/deno/examples/simple.d.ts b/src/clients/deno/examples/simple.d.ts new file mode 100644 index 0000000..d9d6f93 --- /dev/null +++ b/src/clients/deno/examples/simple.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=simple.d.ts.map \ No newline at end of file diff --git a/src/clients/deno/examples/simple.d.ts.map b/src/clients/deno/examples/simple.d.ts.map new file mode 100644 index 0000000..65fe8ab --- /dev/null +++ b/src/clients/deno/examples/simple.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"simple.d.ts","sourceRoot":"","sources":["simple.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/clients/deno/examples/simple.js b/src/clients/deno/examples/simple.js new file mode 100644 index 0000000..3a52bd1 --- /dev/null +++ b/src/clients/deno/examples/simple.js @@ -0,0 +1,80 @@ +var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose, inner; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; +}; +var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) { + return function (env) { + function fail(e) { + env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + var r, s = 0; + function next() { + while (r = env.stack.pop()) { + try { + if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); + if (r.dispose) { + var result = r.dispose.call(r.value); + if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + else s |= 1; + } + catch (e) { + fail(e); + } + } + if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); + if (env.hasError) throw env.error; + } + return next(); + }; +})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; +}); +import { createWebView } from '../main.js'; +var webview; +const env_1 = { stack: [], error: void 0, hasError: false }; +try { + webview = __addDisposableResource(env_1, await createWebView({ + title: "Simple", + devtools: true, + load: { + html: "

Hello, World!

", + }, + initializationScript: "console.log('This is printed from initializationScript!')", + }), false); + webview.on("started", async () => { + await webview.setTitle("Title set from Deno"); + await webview.getTitle(); + await webview.openDevTools(); + await webview.eval("console.log('This is printed from eval!')"); + }); + await webview.waitUntilClosed(); +} +catch (e_1) { + env_1.error = e_1; + env_1.hasError = true; +} +finally { + __disposeResources(env_1); +} +//# sourceMappingURL=simple.js.map \ No newline at end of file diff --git a/src/clients/deno/examples/simple.js.map b/src/clients/deno/examples/simple.js.map new file mode 100644 index 0000000..911832c --- /dev/null +++ b/src/clients/deno/examples/simple.js.map @@ -0,0 +1 @@ +{"version":3,"file":"simple.js","sourceRoot":"","sources":["simple.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;;;;IAElC,yCAAU,MAAM,aAAa,CAAC;QAClC,KAAK,EAAE,QAAQ;QACf,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE;YACJ,IAAI,EAAE,wBAAwB;SAC/B;QACD,oBAAoB,EAClB,2DAA2D;KAC9D,CAAC,QAAA,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QAC/B,MAAM,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;QAC9C,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC;QACzB,MAAM,OAAO,CAAC,YAAY,EAAE,CAAC;QAC7B,MAAM,OAAO,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC"} \ No newline at end of file diff --git a/src/clients/deno/examples/simple.ts b/src/clients/deno/examples/simple.ts index 46dbd94..352fd2d 100644 --- a/src/clients/deno/examples/simple.ts +++ b/src/clients/deno/examples/simple.ts @@ -1,4 +1,4 @@ -import { createWebView } from "../main.ts"; +import { createWebView } from "../main"; using webview = await createWebView({ title: "Simple", diff --git a/src/clients/deno/examples/tldraw.d.ts b/src/clients/deno/examples/tldraw.d.ts new file mode 100644 index 0000000..ca53970 --- /dev/null +++ b/src/clients/deno/examples/tldraw.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=tldraw.d.ts.map \ No newline at end of file diff --git a/src/clients/deno/examples/tldraw.d.ts.map b/src/clients/deno/examples/tldraw.d.ts.map new file mode 100644 index 0000000..5ebd2d8 --- /dev/null +++ b/src/clients/deno/examples/tldraw.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"tldraw.d.ts","sourceRoot":"","sources":["tldraw.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/clients/deno/examples/tldraw.js b/src/clients/deno/examples/tldraw.js new file mode 100644 index 0000000..b01a224 --- /dev/null +++ b/src/clients/deno/examples/tldraw.js @@ -0,0 +1,117 @@ +var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose, inner; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; +}; +var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) { + return function (env) { + function fail(e) { + env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + var r, s = 0; + function next() { + while (r = env.stack.pop()) { + try { + if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); + if (r.dispose) { + var result = r.dispose.call(r.value); + if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + else s |= 1; + } + catch (e) { + fail(e); + } + } + if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); + if (env.hasError) throw env.error; + } + return next(); + }; +})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; +}); +import { createWebView } from '../main.js'; +// Note: This example has been simplified for Node.js compatibility +// For full functionality, you'll need to use a bundler like esbuild, webpack, or vite +const tldrawApp = ` +import { Tldraw } from "tldraw"; +import { createRoot } from "react-dom/client"; + +function App() { + return ( + <> +
+ { editor.updateInstanceState({ isFocusMode: true })}} /> +
+ + ); +} + +createRoot(document.querySelector("main")).render(); +`; +// Pre-compiled version for demo purposes +const app = { code: tldrawApp.replace(//g, 'React.createElement(App)') }; +var webview; +const env_1 = { stack: [], error: void 0, hasError: false }; +try { + webview = __addDisposableResource(env_1, await createWebView({ + title: "TLDraw", + load: { + html: ` + + + + + + + + + +
+ + + + + `, + }, + }), false); + await webview.waitUntilClosed(); +} +catch (e_1) { + env_1.error = e_1; + env_1.hasError = true; +} +finally { + __disposeResources(env_1); +} +//# sourceMappingURL=tldraw.js.map \ No newline at end of file diff --git a/src/clients/deno/examples/tldraw.js.map b/src/clients/deno/examples/tldraw.js.map new file mode 100644 index 0000000..11559c8 --- /dev/null +++ b/src/clients/deno/examples/tldraw.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tldraw.js","sourceRoot":"","sources":["tldraw.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,mEAAmE;AACnE,sFAAsF;AAEtF,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;CAejB,CAAC;AAEF,yCAAyC;AACzC,MAAM,GAAG,GAAG,EAAE,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,0BAA0B,CAAC,EAAE,CAAC;;;;IAE3E,yCAAU,MAAM,aAAa,CAAC;QAClC,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE;YACJ,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;YAqBE,GAAG,CAAC,IAAI;;;;GAIjB;SACA;KACF,CAAC,QAAA,CAAC;IAEH,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC"} \ No newline at end of file diff --git a/src/clients/deno/examples/tldraw.ts b/src/clients/deno/examples/tldraw.ts index e2317be..a4a5654 100644 --- a/src/clients/deno/examples/tldraw.ts +++ b/src/clients/deno/examples/tldraw.ts @@ -1,5 +1,7 @@ -import { createWebView } from "../main.ts"; -import * as esbuild from "https://deno.land/x/esbuild@v0.24.0/wasm.js"; +import { createWebView } from "../main"; + +// Note: This example has been simplified for Node.js compatibility +// For full functionality, you'll need to use a bundler like esbuild, webpack, or vite const tldrawApp = ` import { Tldraw } from "tldraw"; @@ -18,14 +20,8 @@ function App() { createRoot(document.querySelector("main")).render(); `; -const app = await esbuild.transform(tldrawApp, { - loader: "jsx", - jsx: "automatic", - target: "esnext", - format: "esm", - minify: false, - sourcemap: false, -}); +// Pre-compiled version for demo purposes +const app = { code: tldrawApp.replace(//g, 'React.createElement(App)') }; using webview = await createWebView({ title: "TLDraw", diff --git a/src/clients/deno/examples/window-size.d.ts b/src/clients/deno/examples/window-size.d.ts new file mode 100644 index 0000000..fcb049e --- /dev/null +++ b/src/clients/deno/examples/window-size.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=window-size.d.ts.map \ No newline at end of file diff --git a/src/clients/deno/examples/window-size.d.ts.map b/src/clients/deno/examples/window-size.d.ts.map new file mode 100644 index 0000000..da42223 --- /dev/null +++ b/src/clients/deno/examples/window-size.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"window-size.d.ts","sourceRoot":"","sources":["window-size.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/clients/deno/examples/window-size.js b/src/clients/deno/examples/window-size.js new file mode 100644 index 0000000..fa9e9c8 --- /dev/null +++ b/src/clients/deno/examples/window-size.js @@ -0,0 +1,99 @@ +var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose, inner; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; +}; +var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) { + return function (env) { + function fail(e) { + env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + var r, s = 0; + function next() { + while (r = env.stack.pop()) { + try { + if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); + if (r.dispose) { + var result = r.dispose.call(r.value); + if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + else s |= 1; + } + catch (e) { + fail(e); + } + } + if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); + if (env.hasError) throw env.error; + } + return next(); + }; +})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; +}); +import { createWebView } from '../main.js'; +var webview; +const env_1 = { stack: [], error: void 0, hasError: false }; +try { + webview = __addDisposableResource(env_1, await createWebView({ + title: "Window Size", + load: { + html: ` +

Window Sizes

+
+ + + +
+ `, + }, + size: { + height: 200, + width: 800, + }, + ipc: true, + }), false); + webview.on("ipc", ({ message }) => { + switch (message) { + case "maximize": + webview.maximize(); + break; + case "minimize": + webview.minimize(); + break; + case "fullscreen": + webview.fullscreen(); + break; + default: + console.error("Unknown message", message); + } + }); + await webview.waitUntilClosed(); +} +catch (e_1) { + env_1.error = e_1; + env_1.hasError = true; +} +finally { + __disposeResources(env_1); +} +//# sourceMappingURL=window-size.js.map \ No newline at end of file diff --git a/src/clients/deno/examples/window-size.js.map b/src/clients/deno/examples/window-size.js.map new file mode 100644 index 0000000..4849cc3 --- /dev/null +++ b/src/clients/deno/examples/window-size.js.map @@ -0,0 +1 @@ +{"version":3,"file":"window-size.js","sourceRoot":"","sources":["window-size.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;;;;IAElC,yCAAU,MAAM,aAAa,CAAC;QAClC,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE;YACJ,IAAI,EAAE;;;;;;;GAOP;SACA;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,GAAG;YACX,KAAK,EAAE,GAAG;SACX;QACD,GAAG,EAAE,IAAI;KACV,CAAC,QAAA,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,UAAU;gBACb,OAAO,CAAC,QAAQ,EAAE,CAAC;gBACnB,MAAM;YACR,KAAK,UAAU;gBACb,OAAO,CAAC,QAAQ,EAAE,CAAC;gBACnB,MAAM;YACR,KAAK,YAAY;gBACf,OAAO,CAAC,UAAU,EAAE,CAAC;gBACrB,MAAM;YACR;gBACE,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC"} \ No newline at end of file diff --git a/src/clients/deno/examples/window-size.ts b/src/clients/deno/examples/window-size.ts index 7fd1638..151024e 100644 --- a/src/clients/deno/examples/window-size.ts +++ b/src/clients/deno/examples/window-size.ts @@ -1,4 +1,4 @@ -import { createWebView } from "../main.ts"; +import { createWebView } from "../main"; using webview = await createWebView({ title: "Window Size", diff --git a/src/clients/deno/fix-imports.js b/src/clients/deno/fix-imports.js new file mode 100644 index 0000000..e4b5991 --- /dev/null +++ b/src/clients/deno/fix-imports.js @@ -0,0 +1,56 @@ +#!/usr/bin/env node + +import { readFileSync, writeFileSync } from 'node:fs'; +import { glob } from 'glob'; + +/** + * Post-build script to add .js extensions to local imports in compiled JavaScript files + * This allows extensionless imports in TypeScript source while generating Node.js-compatible output + */ + +async function fixImports() { + // Find all JavaScript files + const jsFiles = await glob('**/*.js', { + ignore: ['node_modules/**', 'fix-imports.js'] + }); + + for (const file of jsFiles) { + let content = readFileSync(file, 'utf8'); + let modified = false; + + // Fix relative imports without extensions (add .js) + // Matches: import ... from "./something" or "../something" + // Doesn't match: import ... from "package-name" or "./something.js" + content = content.replace( + /import\s+([^'"]*)\s+from\s+['"](\.[^'"]*?)['"];?/g, + (match, imports, path) => { + // Only add .js if the path doesn't already have an extension + if (!path.match(/\.[a-zA-Z0-9]+$/)) { + modified = true; + return `import ${imports} from '${path}.js';`; + } + return match; + } + ); + + // Fix export ... from statements + content = content.replace( + /export\s+([^'"]*)\s+from\s+['"](\.[^'"]*?)['"];?/g, + (match, exports, path) => { + // Only add .js if the path doesn't already have an extension + if (!path.match(/\.[a-zA-Z0-9]+$/)) { + modified = true; + return `export ${exports} from '${path}.js';`; + } + return match; + } + ); + + if (modified) { + writeFileSync(file, content, 'utf8'); + console.log(`Fixed imports in: ${file}`); + } + } +} + +fixImports().catch(console.error); \ No newline at end of file diff --git a/src/clients/deno/main.d.ts b/src/clients/deno/main.d.ts new file mode 100644 index 0000000..a20ea90 --- /dev/null +++ b/src/clients/deno/main.d.ts @@ -0,0 +1,177 @@ +/** + * A library for creating and interacting with native webview windows. + * + * @module + * + * @example + * ```ts + * import { createWebView } from "@justbe/webview"; + * + * using webview = await createWebView({ + * title: "Example", + * load: { html: "

Hello, World!

" }, + * devtools: true + * }); + * + * webview.on("started", async () => { + * await webview.openDevTools(); + * await webview.eval("console.log('This is printed from eval!')"); + * }); + * + * await webview.waitUntilClosed(); + * ``` + */ +import { Message, type Options } from "./schemas"; +import type { Simplify } from "type-fest"; +export * from "./schemas"; +/** The version of the webview binary that's expected */ +export declare const BIN_VERSION = "0.3.1"; +type WebViewNotification = Extract["data"]; +/** + * Creates a new webview window. + * + * Will automatically fetch the webview binary if it's not already downloaded + */ +export declare function createWebView(options: Options): Promise; +/** + * A webview window. It's recommended to use the `createWebView` function + * because it provides a means of automatically fetching the webview binary + * that's compatible with your OS and architecture. + * + * Each instance of `WebView` spawns a new process that governs a single webview window. + */ +export declare class WebView implements Disposable { + #private; + /** + * Creates a new webview window. + * + * @param options - The options for the webview. + * @param webviewBinaryPath - The path to the webview binary. + */ + constructor(options: Options, webviewBinaryPath: string); + /** + * Returns a promise that resolves when the webview window is closed. + */ + waitUntilClosed(): Promise; + /** + * Listens for events emitted by the webview. + */ + on(event: E, callback: (event: Simplify, "$type">>) => void): void; + /** + * Listens for a single event emitted by the webview. + */ + once(event: E, callback: (event: Simplify, "$type">>) => void): void; + /** + * Gets the version of the webview binary. + */ + getVersion(): Promise; + /** + * Sets the size of the webview window. + * + * Note: this is the logical size of the window, not the physical size. + * @see https://docs.rs/dpi/0.1.1/x86_64-unknown-linux-gnu/dpi/index.html#position-and-size-types + */ + setSize(size: { + width: number; + height: number; + }): Promise; + /** + * Gets the size of the webview window. + * + * Note: this is the logical size of the window, not the physical size. + * @see https://docs.rs/dpi/0.1.1/x86_64-unknown-linux-gnu/dpi/index.html#position-and-size-types + */ + getSize(includeDecorations?: boolean): Promise<{ + width: number; + height: number; + scaleFactor: number; + }>; + /** + * Enters or exits fullscreen mode for the webview. + * + * @param fullscreen - If true, the webview will enter fullscreen mode. If false, the webview will exit fullscreen mode. If not specified, the webview will toggle fullscreen mode. + */ + fullscreen(fullscreen?: boolean): Promise; + /** + * Maximizes or unmaximizes the webview window. + * + * @param maximized - If true, the webview will be maximized. If false, the webview will be unmaximized. If not specified, the webview will toggle maximized state. + */ + maximize(maximized?: boolean): Promise; + /** + * Minimizes or unminimizes the webview window. + * + * @param minimized - If true, the webview will be minimized. If false, the webview will be unminimized. If not specified, the webview will toggle minimized state. + */ + minimize(minimized?: boolean): Promise; + /** + * Sets the title of the webview window. + */ + setTitle(title: string): Promise; + /** + * Gets the title of the webview window. + */ + getTitle(): Promise; + /** + * Sets the visibility of the webview window. + */ + setVisibility(visible: boolean): Promise; + /** + * Returns true if the webview window is visible. + */ + isVisible(): Promise; + /** + * Evaluates JavaScript code in the webview. + */ + eval(code: string): Promise; + /** + * Opens the developer tools for the webview. + */ + openDevTools(): Promise; + /** + * Reloads the webview with the provided html. + */ + loadHtml(html: string): Promise; + /** + * Loads a URL in the webview. + */ + loadUrl(url: string, headers?: Record): Promise; + /** + * Destroys the webview and cleans up resources. + * + * Alternatively you can use the disposible interface. + * + * @example + * ```ts + * // The `using` keyword will automatically call `destroy` on the webview when + * // the webview goes out of scope. + * using webview = await createWebView({ title: "My Webview" }); + * ``` + */ + destroy(): void; + /** + * Part of the explicit resource management feature added in TS 5.2 + * + * When a reference to the webview is stored with `using` this method + * will be called automatically when the webview goes out of scope. + * + * @example + * + * ```ts + * { + * using webview = await createWebView({ title: "My Webview" }); + * } // Webview will be cleaned up here + * + * ``` + * + * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management + */ + [Symbol.dispose](): void; +} +//# sourceMappingURL=main.d.ts.map \ No newline at end of file diff --git a/src/clients/deno/main.d.ts.map b/src/clients/deno/main.d.ts.map new file mode 100644 index 0000000..fa3cdf6 --- /dev/null +++ b/src/clients/deno/main.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAQH,OAAO,EACL,OAAO,EACP,KAAK,OAAO,EAGb,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAU,QAAQ,EAAE,MAAM,WAAW,CAAC;AAgClD,cAAc,WAAW,CAAC;AAK1B,wDAAwD;AACxD,eAAO,MAAM,WAAW,UAAU,CAAC;AAEnC,KAAK,mBAAmB,GAAG,OAAO,CAChC,OAAO,EACP;IAAE,KAAK,EAAE,cAAc,CAAA;CAAE,CAC1B,CAAC,MAAM,CAAC,CAAC;AAuIV;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAGtE;AAED;;;;;;GAMG;AACH,qBAAa,OAAQ,YAAW,UAAU;;IASxC;;;;;OAKG;gBACS,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM;IA8EvD;;OAEG;IACG,eAAe;IAIrB;;OAEG;IACH,EAAE,CAAC,CAAC,SAAS,mBAAmB,CAAC,OAAO,CAAC,EACvC,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,CACR,KAAK,EAAE,QAAQ,CACb,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE;QAAE,KAAK,EAAE,CAAC,CAAA;KAAE,CAAC,EAA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G,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKvC;;OAEG;IAEG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAKnC;;OAEG;IAEG,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK3C;;OAEG;IAEG,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAS3E;;;;;;;;;;;OAWG;IAEH,OAAO;IAIP;;;;;;;;;;;;;;;;OAgBG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;CASzB"} \ No newline at end of file diff --git a/src/clients/deno/main.js b/src/clients/deno/main.js new file mode 100644 index 0000000..d9e841c --- /dev/null +++ b/src/clients/deno/main.js @@ -0,0 +1,557 @@ +/** + * A library for creating and interacting with native webview windows. + * + * @module + * + * @example + * ```ts + * import { createWebView } from "@justbe/webview"; + * + * using webview = await createWebView({ + * title: "Example", + * load: { html: "

Hello, World!

" }, + * devtools: true + * }); + * + * webview.on("started", async () => { + * await webview.openDevTools(); + * await webview.eval("console.log('This is printed from eval!')"); + * }); + * + * await webview.waitUntilClosed(); + * ``` + */ +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __metadata = (this && this.__metadata) || function (k, v) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); +}; +import { EventEmitter } from "node:events"; +import { spawn } from "node:child_process"; +import { writeFile, access, mkdir } from "node:fs/promises"; +import { join } from "node:path"; +import { platform, arch, homedir } from "node:os"; +import { constants } from "node:fs"; +import { Message, Response as WebViewResponse, } from './schemas.js'; +const logger = { + trace: (message, data) => { + if (process.env.LOG_LEVEL === 'trace' || process.env.LOG_LEVEL === 'debug') { + console.log(`[TRACE] ${message}`, data ? JSON.stringify(data) : ''); + } + }, + warn: (message) => { + console.warn(`[WARN] ${message}`); + }, + error: (message, data) => { + console.error(`[ERROR] ${message}`, data ? JSON.stringify(data) : ''); + } +}; +// Decorator replacement +function instrument() { + return function (_target, _propertyKey, descriptor) { + return descriptor; + }; +} +import { match } from "ts-pattern"; +export * from './schemas.js'; +// Logging is now handled by the logger object above +// Should match the cargo package version +/** The version of the webview binary that's expected */ +export const BIN_VERSION = "0.3.1"; +/** + * A helper function for extracting the result from a webview response. + * Throws if the response includes unexpected results. + * + * @param result - The result of the webview request. + * @param expectedType - The format of the expected result. + */ +function returnResult(result, expectedType) { + if (result.$type === "result") { + if (result.result.$type === expectedType) { + // @ts-expect-error TS doesn't correctly narrow this type, but it's correct + return result.result.value; + } + throw new Error(`unexpected result type: ${result.result.$type}`); + } + throw new Error(`unexpected response: ${result.$type}`); +} +/** + * A helper function for acknowledging a webview response. + * Throws if the response includes unexpected results. + */ +const returnAck = (result) => { + return match(result) + .with({ $type: "ack" }, () => undefined) + .with({ $type: "err" }, (err) => { + throw new Error(err.message); + }) + .otherwise(() => { + throw new Error(`unexpected response: ${result.$type}`); + }); +}; +async function getWebViewBin(options) { + // Check for WEBVIEW_BIN environment variable + const binPath = process.env.WEBVIEW_BIN; + if (binPath) + return binPath; + const currentPlatform = platform(); + const flags = options.devtools + ? "-devtools" + : options.transparent && currentPlatform === "darwin" + ? "-transparent" + : ""; + const cacheDir = getCacheDir(); + const fileName = `webview-${BIN_VERSION}${flags}${currentPlatform === "win32" ? ".exe" : ""}`; + const filePath = join(cacheDir, fileName); + // Check if the file already exists in cache + if (await fileExists(filePath)) { + return filePath; + } + // If not in cache, download it + let url = `https://github.com/zephraph/webview/releases/download/webview-v${BIN_VERSION}/webview`; + url += match(currentPlatform) + .with("darwin", () => "-mac" + (arch() === "arm64" ? "-arm64" : "") + flags) + .with("linux", () => "-linux" + flags) + .with("win32", () => "-windows" + flags + ".exe") + .otherwise(() => { + // Default to linux for unknown platforms + logger.warn(`Unknown platform: ${currentPlatform}, defaulting to linux binary`); + return "-linux" + flags; + }); + const res = await fetch(url); + // Ensure the cache directory exists + await ensureDir(cacheDir); + // Write the binary to disk + const arrayBuffer = await res.arrayBuffer(); + await writeFile(filePath, new Uint8Array(arrayBuffer), { mode: 0o755 }); + return filePath; +} +// Helper function to get the OS-specific cache directory +function getCacheDir() { + const currentPlatform = platform(); + return match(currentPlatform) + .with("darwin", () => join(homedir(), "Library", "Caches", "webview")) + .with("linux", () => join(homedir(), ".cache", "webview")) + .with("win32", () => join(process.env.LOCALAPPDATA || join(homedir(), "AppData", "Local"), "webview", "Cache")) + .otherwise(() => { + // Default to a .cache directory in home for unknown platforms + logger.warn(`Unknown platform: ${currentPlatform}, using default cache directory`); + return join(homedir(), ".cache", "webview"); + }); +} +// Helper function to check if file exists +async function fileExists(filePath) { + try { + await access(filePath, constants.F_OK); + return true; + } + catch { + return false; + } +} +// Helper function to ensure directory exists +async function ensureDir(dirPath) { + try { + await mkdir(dirPath, { recursive: true }); + } + catch (err) { + if (err.code !== "EEXIST") { + throw err; + } + } +} +/** + * Creates a new webview window. + * + * Will automatically fetch the webview binary if it's not already downloaded + */ +export async function createWebView(options) { + const binPath = await getWebViewBin(options); + return new WebView(options, binPath); +} +/** + * A webview window. It's recommended to use the `createWebView` function + * because it provides a means of automatically fetching the webview binary + * that's compatible with your OS and architecture. + * + * Each instance of `WebView` spawns a new process that governs a single webview window. + */ +export class WebView { + #process; + #buffer = ""; + #internalEvent = new EventEmitter(); + #externalEvent = new EventEmitter(); + #messageLoop; + #options; + #messageId = 0; + /** + * Creates a new webview window. + * + * @param options - The options for the webview. + * @param webviewBinaryPath - The path to the webview binary. + */ + constructor(options, webviewBinaryPath) { + this.#options = options; + this.#process = spawn(webviewBinaryPath, [JSON.stringify(options)], { + stdio: ["pipe", "pipe", "inherit"], + }); + this.#messageLoop = this.#processMessageLoop(); + } + #send(request) { + const id = this.#messageId++; + return new Promise((resolve) => { + // Setup listener before sending the message to avoid race conditions + this.#internalEvent.once(id.toString(), (event) => { + const result = WebViewResponse.safeParse(event); + if (result.success) { + resolve(result.data); + } + else { + resolve({ $type: "err", id, message: result.error.message }); + } + }); + this.#process.stdin?.write(JSON.stringify({ ...request, id })); + }); + } + async #processMessageLoop() { + return new Promise((resolve) => { + this.#process.stdout?.on('data', (chunk) => { + this.#buffer += chunk.toString(); + let newlineIndex; + while ((newlineIndex = this.#buffer.indexOf('\n')) !== -1) { + const messageStr = this.#buffer.slice(0, newlineIndex); + this.#buffer = this.#buffer.slice(newlineIndex + 1); + try { + logger.trace("buffer", { buffer: messageStr }); + const result = Message.safeParse(JSON.parse(messageStr)); + if (result.success) { + this.#handleMessage(result.data); + } + else { + logger.error("Error parsing message", { error: result.error }); + } + } + catch (parseError) { + logger.error("Error parsing JSON", { error: parseError }); + } + } + }); + this.#process.stdout?.on('end', () => { + resolve(); + }); + this.#process.on('exit', () => { + resolve(); + }); + }); + } + #handleMessage(result) { + match(result) + .with({ $type: "notification" }, ({ data }) => { + const { $type, ...body } = data; + this.#externalEvent.emit($type, body); + if (data.$type === "started" && data.version !== BIN_VERSION) { + logger.warn(`Expected webview to be version ${BIN_VERSION} but got ${data.version}. Some features may not work as expected.`); + } + }) + .with({ $type: "response" }, ({ data }) => { + this.#internalEvent.emit(data.id.toString(), data); + }) + .exhaustive(); + } + /** + * Returns a promise that resolves when the webview window is closed. + */ + async waitUntilClosed() { + await this.#messageLoop; + } + /** + * Listens for events emitted by the webview. + */ + on(event, callback) { + if (event === "ipc" && !this.#options.ipc) { + throw new Error("IPC is not enabled for this webview"); + } + this.#externalEvent.on(event, callback); + } + /** + * Listens for a single event emitted by the webview. + */ + once(event, callback) { + if (event === "ipc" && !this.#options.ipc) { + throw new Error("IPC is not enabled for this webview"); + } + this.#externalEvent.once(event, callback); + } + /** + * Gets the version of the webview binary. + */ + async getVersion() { + const result = await this.#send({ $type: "getVersion" }); + return returnResult(result, "string"); + } + /** + * Sets the size of the webview window. + * + * Note: this is the logical size of the window, not the physical size. + * @see https://docs.rs/dpi/0.1.1/x86_64-unknown-linux-gnu/dpi/index.html#position-and-size-types + */ + async setSize(size) { + const result = await this.#send({ $type: "setSize", size }); + return returnAck(result); + } + /** + * Gets the size of the webview window. + * + * Note: this is the logical size of the window, not the physical size. + * @see https://docs.rs/dpi/0.1.1/x86_64-unknown-linux-gnu/dpi/index.html#position-and-size-types + */ + async getSize(includeDecorations) { + const request = { + $type: "getSize", + }; + if (includeDecorations !== undefined) { + request.include_decorations = includeDecorations; + } + const result = await this.#send(request); + return returnResult(result, "size"); + } + /** + * Enters or exits fullscreen mode for the webview. + * + * @param fullscreen - If true, the webview will enter fullscreen mode. If false, the webview will exit fullscreen mode. If not specified, the webview will toggle fullscreen mode. + */ + async fullscreen(fullscreen) { + const request = { $type: "fullscreen" }; + if (fullscreen !== undefined) { + request.fullscreen = fullscreen; + } + const result = await this.#send(request); + return returnAck(result); + } + /** + * Maximizes or unmaximizes the webview window. + * + * @param maximized - If true, the webview will be maximized. If false, the webview will be unmaximized. If not specified, the webview will toggle maximized state. + */ + async maximize(maximized) { + const request = { $type: "maximize" }; + if (maximized !== undefined) { + request.maximized = maximized; + } + const result = await this.#send(request); + return returnAck(result); + } + /** + * Minimizes or unminimizes the webview window. + * + * @param minimized - If true, the webview will be minimized. If false, the webview will be unminimized. If not specified, the webview will toggle minimized state. + */ + async minimize(minimized) { + const request = { $type: "minimize" }; + if (minimized !== undefined) { + request.minimized = minimized; + } + const result = await this.#send(request); + return returnAck(result); + } + /** + * Sets the title of the webview window. + */ + async setTitle(title) { + const result = await this.#send({ + $type: "setTitle", + title, + }); + return returnAck(result); + } + /** + * Gets the title of the webview window. + */ + async getTitle() { + const result = await this.#send({ $type: "getTitle" }); + return returnResult(result, "string"); + } + /** + * Sets the visibility of the webview window. + */ + async setVisibility(visible) { + const result = await this.#send({ $type: "setVisibility", visible }); + return returnAck(result); + } + /** + * Returns true if the webview window is visible. + */ + async isVisible() { + const result = await this.#send({ $type: "isVisible" }); + return returnResult(result, "boolean"); + } + /** + * Evaluates JavaScript code in the webview. + */ + async eval(code) { + const result = await this.#send({ $type: "eval", js: code }); + return returnAck(result); + } + /** + * Opens the developer tools for the webview. + */ + async openDevTools() { + const result = await this.#send({ $type: "openDevTools" }); + return returnAck(result); + } + /** + * Reloads the webview with the provided html. + */ + async loadHtml(html) { + const result = await this.#send({ $type: "loadHtml", html }); + return returnAck(result); + } + /** + * Loads a URL in the webview. + */ + async loadUrl(url, headers) { + const request = { $type: "loadUrl", url }; + if (headers !== undefined) { + request.headers = headers; + } + const result = await this.#send(request); + return returnAck(result); + } + /** + * Destroys the webview and cleans up resources. + * + * Alternatively you can use the disposible interface. + * + * @example + * ```ts + * // The `using` keyword will automatically call `destroy` on the webview when + * // the webview goes out of scope. + * using webview = await createWebView({ title: "My Webview" }); + * ``` + */ + destroy() { + this[Symbol.dispose](); + } + /** + * Part of the explicit resource management feature added in TS 5.2 + * + * When a reference to the webview is stored with `using` this method + * will be called automatically when the webview goes out of scope. + * + * @example + * + * ```ts + * { + * using webview = await createWebView({ title: "My Webview" }); + * } // Webview will be cleaned up here + * + * ``` + * + * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management + */ + [Symbol.dispose]() { + this.#internalEvent.removeAllListeners(); + this.#externalEvent.removeAllListeners(); + try { + this.#process.kill(); + } + catch (_) { + // Ignore errors when killing process + } + } +} +__decorate([ + instrument(), + __metadata("design:type", Function), + __metadata("design:paramtypes", []), + __metadata("design:returntype", Promise) +], WebView.prototype, "getVersion", null); +__decorate([ + instrument(), + __metadata("design:type", Function), + __metadata("design:paramtypes", [Object]), + __metadata("design:returntype", Promise) +], WebView.prototype, "setSize", null); +__decorate([ + instrument(), + __metadata("design:type", Function), + __metadata("design:paramtypes", [Boolean]), + __metadata("design:returntype", Promise) +], WebView.prototype, "getSize", null); +__decorate([ + instrument(), + __metadata("design:type", Function), + __metadata("design:paramtypes", [Boolean]), + __metadata("design:returntype", Promise) +], WebView.prototype, "fullscreen", null); +__decorate([ + instrument(), + __metadata("design:type", Function), + __metadata("design:paramtypes", [Boolean]), + __metadata("design:returntype", Promise) +], WebView.prototype, "maximize", null); +__decorate([ + instrument(), + __metadata("design:type", Function), + __metadata("design:paramtypes", [Boolean]), + __metadata("design:returntype", Promise) +], WebView.prototype, "minimize", null); +__decorate([ + instrument(), + __metadata("design:type", Function), + __metadata("design:paramtypes", [String]), + __metadata("design:returntype", Promise) +], WebView.prototype, "setTitle", null); +__decorate([ + instrument(), + __metadata("design:type", Function), + __metadata("design:paramtypes", []), + __metadata("design:returntype", Promise) +], WebView.prototype, "getTitle", null); +__decorate([ + instrument(), + __metadata("design:type", Function), + __metadata("design:paramtypes", [Boolean]), + __metadata("design:returntype", Promise) +], WebView.prototype, "setVisibility", null); +__decorate([ + instrument(), + __metadata("design:type", Function), + __metadata("design:paramtypes", []), + __metadata("design:returntype", Promise) +], WebView.prototype, "isVisible", null); +__decorate([ + instrument(), + __metadata("design:type", Function), + __metadata("design:paramtypes", [String]), + __metadata("design:returntype", Promise) +], WebView.prototype, "eval", null); +__decorate([ + instrument(), + __metadata("design:type", Function), + __metadata("design:paramtypes", []), + __metadata("design:returntype", Promise) +], WebView.prototype, "openDevTools", null); +__decorate([ + instrument(), + __metadata("design:type", Function), + __metadata("design:paramtypes", [String]), + __metadata("design:returntype", Promise) +], WebView.prototype, "loadHtml", null); +__decorate([ + instrument(), + __metadata("design:type", Function), + __metadata("design:paramtypes", [String, Object]), + __metadata("design:returntype", Promise) +], WebView.prototype, "loadUrl", null); +__decorate([ + instrument(), + __metadata("design:type", Function), + __metadata("design:paramtypes", []), + __metadata("design:returntype", void 0) +], WebView.prototype, "destroy", null); +//# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/src/clients/deno/main.js.map b/src/clients/deno/main.js.map new file mode 100644 index 0000000..8b04031 --- /dev/null +++ b/src/clients/deno/main.js.map @@ -0,0 +1 @@ +{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;;;;;;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EACL,OAAO,EAGP,QAAQ,IAAI,eAAe,GAC5B,MAAM,WAAW,CAAC;AAUnB,MAAM,MAAM,GAAW;IACrB,KAAK,EAAE,CAAC,OAAe,EAAE,IAAU,EAAE,EAAE;QACrC,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,OAAO,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,OAAO,EAAE,CAAC;YAC3E,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;IACD,IAAI,EAAE,CAAC,OAAe,EAAE,EAAE;QACxB,OAAO,CAAC,IAAI,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC;IACpC,CAAC;IACD,KAAK,EAAE,C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;YAC1B,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC;QAC5B,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACzC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAED;;;;;;;;;;;OAWG;IAEH,OAAO;QACL,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IACzB,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC;QACd,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC;QACzC,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC;QACzC,IAAI,CAAC;YACH,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACvB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,qCAAqC;QACvC,CAAC;IACH,CAAC;CACF;AA/MO;IADL,UAAU,EAAE;;;;yCAIZ;AASK;IADL,UAAU,EAAE;;;;sCAIZ;AASK;IADL,UAAU,EAAE;;;;sCAeZ;AAQK;IADL,UAAU,EAAE;;;;yCAQZ;AAQK;IADL,UAAU,EAAE;;;;uCAQZ;AAQK;IADL,UAAU,EAAE;;;;uCAQZ;AAMK;IADL,UAAU,EAAE;;;;uCAOZ;AAMK;IADL,UAAU,EAAE;;;;uCAIZ;AAMK;IADL,UAAU,EAAE;;;;4CAIZ;AAMK;IADL,UAAU,EAAE;;;;wCAIZ;AAMK;IADL,UAAU,EAAE;;;;mCAIZ;AAMK;IADL,UAAU,EAAE;;;;2CAIZ;AAMK;IADL,UAAU,EAAE;;;;uCAIZ;AAMK;IADL,UAAU,EAAE;;;;sCAQZ;AAeD;IADC,UAAU,EAAE;;;;sCAGZ"} \ No newline at end of file diff --git a/src/clients/deno/main.ts b/src/clients/deno/main.ts index a3622b2..77c3483 100644 --- a/src/clients/deno/main.ts +++ b/src/clients/deno/main.ts @@ -5,11 +5,11 @@ * * @example * ```ts - * import { createWebView } from "jsr:@justbe/webview"; + * import { createWebView } from "@justbe/webview"; * * using webview = await createWebView({ * title: "Example", - * html: "

Hello, World!

", + * load: { html: "

Hello, World!

" }, * devtools: true * }); * @@ -23,36 +23,53 @@ */ import { EventEmitter } from "node:events"; +import { spawn } from "node:child_process"; +import { writeFile, access, mkdir } from "node:fs/promises"; +import { join } from "node:path"; +import { platform, arch, homedir } from "node:os"; +import { constants } from "node:fs"; import { Message, type Options, type Request as WebViewRequest, Response as WebViewResponse, -} from "./schemas.ts"; -import type { Except, Simplify } from "npm:type-fest"; -import { join } from "jsr:@std/path"; -import { ensureDir, exists } from "jsr:@std/fs"; -import { error, FmtSubscriber, instrument, Level, trace, warn } from "tracing"; -import { match, P } from "ts-pattern"; - -export * from "./schemas.ts"; - -if ( - Deno.permissions.querySync({ name: "env", variable: "LOG_LEVEL" }).state === - "granted" -) { - const level = match(Deno.env.get("LOG_LEVEL")) - .with("trace", () => Level.TRACE) - .with("debug", () => Level.DEBUG) - .with("info", () => Level.INFO) - .with("warn", () => Level.WARN) - .with("error", () => Level.ERROR) - .with("fatal", () => Level.CRITICAL) - .otherwise(() => Level.INFO); - - FmtSubscriber.setGlobalDefault({ level, color: true }); +} from "./schemas"; +import type { Except, Simplify } from "type-fest"; + +// Simple logging interface to replace tracing +interface Logger { + trace: (message: string, data?: any) => void; + warn: (message: string) => void; + error: (message: string, data?: any) => void; } +const logger: Logger = { + trace: (message: string, data?: any) => { + if (process.env.LOG_LEVEL === 'trace' || process.env.LOG_LEVEL === 'debug') { + console.log(`[TRACE] ${message}`, data ? JSON.stringify(data) : ''); + } + }, + warn: (message: string) => { + console.warn(`[WARN] ${message}`); + }, + error: (message: string, data?: any) => { + console.error(`[ERROR] ${message}`, data ? JSON.stringify(data) : ''); + } +}; + +// Decorator replacement +function instrument() { + return function(_target: any, _propertyKey: string, descriptor: PropertyDescriptor) { + return descriptor; + }; +} + +import { match } from "ts-pattern"; + +export * from "./schemas"; + +// Logging is now handled by the logger object above + // Should match the cargo package version /** The version of the webview binary that's expected */ export const BIN_VERSION = "0.3.1"; @@ -104,43 +121,42 @@ const returnAck = (result: WebViewResponse) => { }; async function getWebViewBin(options: Options) { - if ( - Deno.permissions.querySync({ name: "env", variable: "WEBVIEW_BIN" }) - .state === "granted" - ) { - const binPath = Deno.env.get("WEBVIEW_BIN"); - if (binPath) return binPath; - } + // Check for WEBVIEW_BIN environment variable + const binPath = process.env.WEBVIEW_BIN; + if (binPath) return binPath; + const currentPlatform = platform(); const flags = options.devtools ? "-devtools" - : options.transparent && Deno.build.os === "darwin" + : options.transparent && currentPlatform === "darwin" ? "-transparent" : ""; const cacheDir = getCacheDir(); const fileName = `webview-${BIN_VERSION}${flags}${ - Deno.build.os === "windows" ? ".exe" : "" + currentPlatform === "win32" ? ".exe" : "" }`; const filePath = join(cacheDir, fileName); // Check if the file already exists in cache - if (await exists(filePath)) { + if (await fileExists(filePath)) { return filePath; } // If not in cache, download it let url = `https://github.com/zephraph/webview/releases/download/webview-v${BIN_VERSION}/webview`; - url += match(Deno.build.os) + url += match(currentPlatform) .with( "darwin", - () => "-mac" + (Deno.build.arch === "aarch64" ? "-arm64" : "") + flags, + () => "-mac" + (arch() === "arm64" ? "-arm64" : "") + flags, ) .with("linux", () => "-linux" + flags) - .with("windows", () => "-windows" + flags + ".exe") + .with("win32", () => "-windows" + flags + ".exe") .otherwise(() => { - throw new Error("unsupported OS"); + // Default to linux for unknown platforms + logger.warn(`Unknown platform: ${currentPlatform}, defaulting to linux binary`); + return "-linux" + flags; }); const res = await fetch(url); @@ -149,30 +165,53 @@ async function getWebViewBin(options: Options) { await ensureDir(cacheDir); // Write the binary to disk - await Deno.writeFile(filePath, new Uint8Array(await res.arrayBuffer()), { - mode: 0o755, - }); + const arrayBuffer = await res.arrayBuffer(); + await writeFile(filePath, new Uint8Array(arrayBuffer), { mode: 0o755 }); return filePath; } // Helper function to get the OS-specific cache directory function getCacheDir(): string { - return match(Deno.build.os) + const currentPlatform = platform(); + return match(currentPlatform) .with( "darwin", - () => join(Deno.env.get("HOME")!, "Library", "Caches", "webview"), + () => join(homedir(), "Library", "Caches", "webview"), ) - .with("linux", () => join(Deno.env.get("HOME")!, ".cache", "webview")) + .with("linux", () => join(homedir(), ".cache", "webview")) .with( - "windows", - () => join(Deno.env.get("LOCALAPPDATA")!, "webview", "Cache"), + "win32", + () => join(process.env.LOCALAPPDATA || join(homedir(), "AppData", "Local"), "webview", "Cache"), ) .otherwise(() => { - throw new Error("Unsupported OS"); + // Default to a .cache directory in home for unknown platforms + logger.warn(`Unknown platform: ${currentPlatform}, using default cache directory`); + return join(homedir(), ".cache", "webview"); }); } +// Helper function to check if file exists +async function fileExists(filePath: string): Promise { + try { + await access(filePath, constants.F_OK); + return true; + } catch { + return false; + } +} + +// Helper function to ensure directory exists +async function ensureDir(dirPath: string): Promise { + try { + await mkdir(dirPath, { recursive: true }); + } catch (err: any) { + if (err.code !== "EEXIST") { + throw err; + } + } +} + /** * Creates a new webview window. * @@ -191,9 +230,7 @@ export async function createWebView(options: Options): Promise { * Each instance of `WebView` spawns a new process that governs a single webview window. */ export class WebView implements Disposable { - #process: Deno.ChildProcess; - #stdin: WritableStreamDefaultWriter; - #stdout: ReadableStreamDefaultReader; + #process: ReturnType; #buffer = ""; #internalEvent = new EventEmitter(); #externalEvent = new EventEmitter(); @@ -209,14 +246,9 @@ export class WebView implements Disposable { */ constructor(options: Options, webviewBinaryPath: string) { this.#options = options; - this.#process = new Deno.Command(webviewBinaryPath, { - args: [JSON.stringify(options)], - stdin: "piped", - stdout: "piped", - stderr: "inherit", - }).spawn(); - this.#stdin = this.#process.stdin.getWriter(); - this.#stdout = this.#process.stdout.getReader(); + this.#process = spawn(webviewBinaryPath, [JSON.stringify(options)], { + stdio: ["pipe", "pipe", "inherit"], + }); this.#messageLoop = this.#processMessageLoop(); } @@ -232,66 +264,62 @@ export class WebView implements Disposable { resolve({ $type: "err", id, message: result.error.message }); } }); - this.#stdin.write( - new TextEncoder().encode( - JSON.stringify({ ...request, id }), - ), + this.#process.stdin?.write( + JSON.stringify({ ...request, id }), ); }); } - @instrument() - async #recv() { - while (true) { - const { value, done } = await this.#stdout.read(); - if (done) { - break; - } - this.#buffer += new TextDecoder().decode(value); - - const newlineIndex = this.#buffer.indexOf("\n"); - if (newlineIndex === -1) { - continue; - } - trace("buffer", { buffer: this.#buffer }); - const result = Message.safeParse( - JSON.parse(this.#buffer.slice(0, newlineIndex)), - ); - this.#buffer = this.#buffer.slice(newlineIndex + 1); - if (result.success) { - return result.data; - } else { - error("Error parsing message", { error: result.error }); - return result; - } - } - } - async #processMessageLoop() { - while (true) { - const result = await this.#recv(); - if (!result) return; - match(result) - .with({ error: { issues: [{ code: "invalid_type" }] } }, (result) => { - error("Invalid type", { error: result.error }); - }) - .with({ error: P.nonNullable }, (result) => { - error("Unknown error", { error: result.error }); - }) - .with({ $type: "notification" }, ({ data }) => { - const { $type, ...body } = data; - this.#externalEvent.emit($type, body); - if (data.$type === "started" && data.version !== BIN_VERSION) { - warn( - `Expected webview to be version ${BIN_VERSION} but got ${data.version}. Some features may not work as expected.`, - ); + return new Promise((resolve) => { + this.#process.stdout?.on('data', (chunk: Buffer) => { + this.#buffer += chunk.toString(); + + let newlineIndex; + while ((newlineIndex = this.#buffer.indexOf('\n')) !== -1) { + const messageStr = this.#buffer.slice(0, newlineIndex); + this.#buffer = this.#buffer.slice(newlineIndex + 1); + + try { + logger.trace("buffer", { buffer: messageStr }); + const result = Message.safeParse(JSON.parse(messageStr)); + + if (result.success) { + this.#handleMessage(result.data); + } else { + logger.error("Error parsing message", { error: result.error }); + } + } catch (parseError) { + logger.error("Error parsing JSON", { error: parseError }); } - }) - .with({ $type: "response" }, ({ data }) => { - this.#internalEvent.emit(data.id.toString(), data); - }) - .exhaustive(); - } + } + }); + + this.#process.stdout?.on('end', () => { + resolve(); + }); + + this.#process.on('exit', () => { + resolve(); + }); + }); + } + + #handleMessage(result: Message) { + match(result) + .with({ $type: "notification" }, ({ data }) => { + const { $type, ...body } = data; + this.#externalEvent.emit($type, body); + if (data.$type === "started" && data.version !== BIN_VERSION) { + logger.warn( + `Expected webview to be version ${BIN_VERSION} but got ${data.version}. Some features may not work as expected.`, + ); + } + }) + .with({ $type: "response" }, ({ data }) => { + this.#internalEvent.emit(data.id.toString(), data); + }) + .exhaustive(); } /** @@ -366,10 +394,13 @@ export class WebView implements Disposable { async getSize( includeDecorations?: boolean, ): Promise<{ width: number; height: number; scaleFactor: number }> { - const result = await this.#send({ + const request: any = { $type: "getSize", - include_decorations: includeDecorations, - }); + }; + if (includeDecorations !== undefined) { + request.include_decorations = includeDecorations; + } + const result = await this.#send(request); return returnResult( result, "size", @@ -383,7 +414,11 @@ export class WebView implements Disposable { */ @instrument() async fullscreen(fullscreen?: boolean): Promise { - const result = await this.#send({ $type: "fullscreen", fullscreen }); + const request: any = { $type: "fullscreen" }; + if (fullscreen !== undefined) { + request.fullscreen = fullscreen; + } + const result = await this.#send(request); return returnAck(result); } @@ -394,7 +429,11 @@ export class WebView implements Disposable { */ @instrument() async maximize(maximized?: boolean): Promise { - const result = await this.#send({ $type: "maximize", maximized }); + const request: any = { $type: "maximize" }; + if (maximized !== undefined) { + request.maximized = maximized; + } + const result = await this.#send(request); return returnAck(result); } @@ -405,7 +444,11 @@ export class WebView implements Disposable { */ @instrument() async minimize(minimized?: boolean): Promise { - const result = await this.#send({ $type: "minimize", minimized }); + const request: any = { $type: "minimize" }; + if (minimized !== undefined) { + request.minimized = minimized; + } + const result = await this.#send(request); return returnAck(result); } @@ -480,7 +523,11 @@ export class WebView implements Disposable { */ @instrument() async loadUrl(url: string, headers?: Record): Promise { - const result = await this.#send({ $type: "loadUrl", url, headers }); + const request: any = { $type: "loadUrl", url }; + if (headers !== undefined) { + request.headers = headers; + } + const result = await this.#send(request); return returnAck(result); } @@ -520,11 +567,11 @@ export class WebView implements Disposable { */ [Symbol.dispose](): void { this.#internalEvent.removeAllListeners(); - this.#stdin.releaseLock(); + this.#externalEvent.removeAllListeners(); try { this.#process.kill(); } catch (_) { - _; + // Ignore errors when killing process } } -} +} \ No newline at end of file diff --git a/src/clients/deno/package-lock.json b/src/clients/deno/package-lock.json new file mode 100644 index 0000000..811437b --- /dev/null +++ b/src/clients/deno/package-lock.json @@ -0,0 +1,598 @@ +{ + "name": "@justbe/webview", + "version": "1.0.1-rc.2", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@justbe/webview", + "version": "1.0.1-rc.2", + "license": "MIT", + "dependencies": { + "ts-pattern": "^5.8.0", + "type-fest": "^4.26.1", + "zod": "^3.23.8" + }, + "devDependencies": { + "@types/node": "^20.0.0", + "glob": "^11.0.3", + "typescript": "^5.0.0" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@isaacs/balanced-match": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", + "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@isaacs/brace-expansion": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz", + "integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@isaacs/balanced-match": "^4.0.1" + }, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@types/node": { + "version": "20.19.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.10.tgz", + "integrity": "sha512-iAFpG6DokED3roLSP0K+ybeDdIX6Bc0Vd3mLW5uDqThPWtNos3E+EqOM11mPQHKzfWHqEBuLjIlsBQQ8CsISmQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "node_modules/ansi-regex": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true, + "license": "MIT" + }, + "node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/foreground-child": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "dev": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.6", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.3.tgz", + "integrity": "sha512-2Nim7dha1KVkaiF4q6Dj+ngPPMdfvLJEOpZk/jKiUAkqKebpGAWQXAq9z1xu9HKu5lWfqw/FASuccEjyznjPaA==", + "dev": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.3.1", + "jackspeak": "^4.1.1", + "minimatch": "^10.0.3", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^2.0.0" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/jackspeak": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.1.1.tgz", + "integrity": "sha512-zptv57P3GpL+O0I7VdMJNBZCu+BPHVQUk55Ft8/QCJjTVxrnJHuVuX/0Bl2A6/+2oyR/ZMEuFKwmzqqZ/U5nPQ==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/lru-cache": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.1.0.tgz", + "integrity": "sha512-QIXZUBJUx+2zHUdQujWejBkcD9+cs94tLn0+YL8UrCh+D5sCXZ4c7LaEH48pNwRY3MLDgqUFyhlCyjJPf1WP0A==", + "dev": true, + "license": "ISC", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/minimatch": { + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.3.tgz", + "integrity": "sha512-IPZ167aShDZZUMdRk66cyQAW3qr0WzbHkPdMYa8bzZhlHhO3jALbKdxcaak7W9FfT2rZNpQuUu4Od7ILEpXSaw==", + "dev": true, + "license": "ISC", + "dependencies": { + "@isaacs/brace-expansion": "^5.0.0" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minipass": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/package-json-from-dist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", + "dev": true, + "license": "BlueOak-1.0.0" + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-scurry": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", + "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^11.0.0", + "minipass": "^7.1.2" + }, + "engines": { + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/string-width-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ts-pattern": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/ts-pattern/-/ts-pattern-5.8.0.tgz", + "integrity": "sha512-kIjN2qmWiHnhgr5DAkAafF9fwb0T5OhMVSWrm8XEdTFnX6+wfXwYOFjeF86UZ54vduqiR7BfqScFmXSzSaH8oA==", + "license": "MIT" + }, + "node_modules/type-fest": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", + "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typescript": { + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz", + "integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true, + "license": "MIT" + }, + "node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/zod": { + "version": "3.25.76", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz", + "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + } + } +} diff --git a/src/clients/deno/package.json b/src/clients/deno/package.json new file mode 100644 index 0000000..d295303 --- /dev/null +++ b/src/clients/deno/package.json @@ -0,0 +1,46 @@ +{ + "name": "@justbe/webview", + "version": "1.0.1-rc.2", + "license": "MIT", + "type": "module", + "main": "./main.js", + "types": "./main.d.ts", + "exports": { + ".": { + "import": "./main.js", + "types": "./main.d.ts" + } + }, + "files": [ + "README.md", + "LICENSE", + "*.js", + "*.d.ts", + "schemas/*.js", + "schemas/*.d.ts" + ], + "scripts": { + "build:tsc": "tsc --outDir . --declaration", + "build:fix": "node fix-imports.js", + "build": "npm run build:tsc && npm run build:fix", + "clean": "find . -name '*.js' -not -name 'fix-imports.js' -delete && find . -name '*.d.ts' -delete && find . -name '*.js.map' -delete", + "prepare": "npm run build", + "test": "node --test examples/*.js" + }, + "dependencies": { + "ts-pattern": "^5.8.0", + "zod": "^3.23.8", + "type-fest": "^4.26.1" + }, + "devDependencies": { + "typescript": "^5.0.0", + "@types/node": "^20.0.0", + "glob": "^11.0.3" + }, + "engines": { + "node": ">=18.0.0" + }, + "publishConfig": { + "access": "public" + } +} \ No newline at end of file diff --git a/src/clients/deno/schemas.d.ts b/src/clients/deno/schemas.d.ts new file mode 100644 index 0000000..6a61bea --- /dev/null +++ b/src/clients/deno/schemas.d.ts @@ -0,0 +1,227 @@ +import { z } from "zod"; +/** + * Messages that are sent unbidden from the webview to the client. + */ +export type Notification = { + $type: "started"; + /** The version of the webview binary */ + version: string; +} | { + $type: "ipc"; + /** The message sent from the webview UI to the client. */ + message: string; +} | { + $type: "closed"; +}; +export type SizeWithScale = { + /** The height of the window in logical pixels. */ + height: number; + /** The ratio between physical and logical sizes. */ + scaleFactor: number; + /** The width of the window in logical pixels. */ + width: number; +}; +/** + * Types that can be returned from webview results. + */ +export type ResultType = { + $type: "string"; + value: string; +} | { + $type: "boolean"; + value: boolean; +} | { + $type: "float"; + value: number; +} | { + $type: "size"; + value: SizeWithScale; +}; +/** + * Responses from the webview to the client. + */ +export type Response = { + $type: "ack"; + id: number; +} | { + $type: "result"; + id: number; + result: ResultType; +} | { + $type: "err"; + id: number; + message: string; +}; +/** + * Complete definition of all outbound messages from the webview to the client. + */ +export type Message = { + $type: "notification"; + data: Notification; +} | { + $type: "response"; + data: Response; +}; +export declare const Notification: z.ZodType; +export declare const SizeWithScale: z.ZodType; +export declare const ResultType: z.ZodType; +export declare const Response: z.ZodType; +export declare const Message: z.ZodType; +/** + * The content to load into the webview. + */ +export type Content = { + /** Optional headers to send with the request. */ + headers?: Record; + /** Url to load in the webview. Note: Don't use data URLs here, as they are not supported. Use the `html` field instead. */ + url: string; +} | { + /** Html to load in the webview. */ + html: string; + /** What to set as the origin of the webview when loading html. */ + origin?: string; +}; +export type Size = { + /** The height of the window in logical pixels. */ + height: number; + /** The width of the window in logical pixels. */ + width: number; +}; +export type WindowSizeStates = "maximized" | "fullscreen"; +export type WindowSize = WindowSizeStates | Size; +/** + * Options for creating a webview. + */ +export type Options = { + /** Sets whether clicking an inactive window also clicks through to the webview. Default is false. */ + acceptFirstMouse?: boolean; + /** When true, all media can be played without user interaction. Default is false. */ + autoplay?: boolean; + /** + * Enables clipboard access for the page rendered on Linux and Windows. + * + * macOS doesn’t provide such method and is always enabled by default. But your app will still need to add menu item accelerators to use the clipboard shortcuts. + */ + clipboard?: boolean; + /** When true, the window will have a border, a title bar, etc. Default is true. */ + decorations?: boolean; + /** + * Enable or disable webview devtools. + * + * Note this only enables devtools to the webview. To open it, you can call `webview.open_devtools()`, or right click the page and open it from the context menu. + */ + devtools?: boolean; + /** Sets whether the webview should be focused when created. Default is false. */ + focused?: boolean; + /** + * Run the WebView with incognito mode. Note that WebContext will be ingored if incognito is enabled. + * + * Platform-specific: - Windows: Requires WebView2 Runtime version 101.0.1210.39 or higher, does nothing on older versions, see https://learn.microsoft.com/en-us/microsoft-edge/webview2/release-notes/archive?tabs=dotnetcsharp#10121039 + */ + incognito?: boolean; + /** Run JavaScript code when loading new pages. When the webview loads a new page, this code will be executed. It is guaranteed that the code is executed before window.onload. */ + initializationScript?: string; + /** Sets whether host should be able to receive messages from the webview via `window.ipc.postMessage`. */ + ipc?: boolean; + /** The content to load into the webview. */ + load?: Content; + /** The size of the window. */ + size?: WindowSize; + /** Sets the title of the window. */ + title: string; + /** Sets whether the window should be transparent. */ + transparent?: boolean; + /** Sets the user agent to use when loading pages. */ + userAgent?: string; +}; +export declare const Content: z.ZodType; +export declare const Size: z.ZodType; +export declare const WindowSizeStates: z.ZodType; +export declare const WindowSize: z.ZodType; +export declare const Options: z.ZodType; +/** + * Explicit requests from the client to the webview. + */ +export type Request = { + $type: "getVersion"; + /** The id of the request. */ + id: number; +} | { + $type: "eval"; + /** The id of the request. */ + id: number; + /** The javascript to evaluate. */ + js: string; +} | { + $type: "setTitle"; + /** The id of the request. */ + id: number; + /** The title to set. */ + title: string; +} | { + $type: "getTitle"; + /** The id of the request. */ + id: number; +} | { + $type: "setVisibility"; + /** The id of the request. */ + id: number; + /** Whether the window should be visible or hidden. */ + visible: boolean; +} | { + $type: "isVisible"; + /** The id of the request. */ + id: number; +} | { + $type: "openDevTools"; + /** The id of the request. */ + id: number; +} | { + $type: "getSize"; + /** The id of the request. */ + id: number; + /** Whether to include the title bar and borders in the size measurement. */ + include_decorations?: boolean; +} | { + $type: "setSize"; + /** The id of the request. */ + id: number; + /** The size to set. */ + size: Size; +} | { + $type: "fullscreen"; + /** Whether to enter fullscreen mode. If left unspecified, the window will enter fullscreen mode if it is not already in fullscreen mode or exit fullscreen mode if it is currently in fullscreen mode. */ + fullscreen?: boolean; + /** The id of the request. */ + id: number; +} | { + $type: "maximize"; + /** The id of the request. */ + id: number; + /** Whether to maximize the window. If left unspecified, the window will be maximized if it is not already maximized or restored if it was previously maximized. */ + maximized?: boolean; +} | { + $type: "minimize"; + /** The id of the request. */ + id: number; + /** Whether to minimize the window. If left unspecified, the window will be minimized if it is not already minimized or restored if it was previously minimized. */ + minimized?: boolean; +} | { + $type: "loadHtml"; + /** HTML to set as the content of the webview. */ + html: string; + /** The id of the request. */ + id: number; + /** What to set as the origin of the webview when loading html. If not specified, the origin will be set to the value of the `origin` field when the webview was created. */ + origin?: string; +} | { + $type: "loadUrl"; + /** Optional headers to send with the request. */ + headers?: Record; + /** The id of the request. */ + id: number; + /** URL to load in the webview. */ + url: string; +}; +export declare const Request: z.ZodType; +//# sourceMappingURL=schemas.d.ts.map \ No newline at end of file diff --git a/src/clients/deno/schemas.d.ts.map b/src/clients/deno/schemas.d.ts.map new file mode 100644 index 0000000..d7fe611 --- /dev/null +++ b/src/clients/deno/schemas.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["schemas.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB;IACA,KAAK,EAAE,SAAS,CAAC;IACjB,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;CACjB,GACC;IACA,KAAK,EAAE,KAAK,CAAC;IACb,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;CACjB,GACC;IACA,KAAK,EAAE,QAAQ,CAAC;CACjB,CAAC;AAEJ,MAAM,MAAM,aAAa,GAAG;IAC1B,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,WAAW,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB;IACA,KAAK,EAAE,QAAQ,CAAC;IAEhB,KAAK,EAAE,MAAM,CAAC;CACf,GACC;IACA,KAAK,EAAE,SAAS,CAAC;IAEjB,KAAK,EAAE,OAAO,CAAC;CAChB,GACC;IACA,KAAK,EAAE,OAAO,CAAC;IAEf,KAAK,EAAE,MAAM,C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;IAC1M,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;CACZ,GACC;IACA,KAAK,EAAE,UAAU,CAAC;IAClB,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,mKAAmK;IACnK,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GACC;IACA,KAAK,EAAE,UAAU,CAAC;IAClB,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,mKAAmK;IACnK,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GACC;IACA,KAAK,EAAE,UAAU,CAAC;IAClB,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,4KAA4K;IAC5K,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACC;IACA,KAAK,EAAE,SAAS,CAAC;IACjB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,kCAAkC;IAClC,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEJ,eAAO,MAAM,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAiDrC,CAAC"} \ No newline at end of file diff --git a/src/clients/deno/schemas.js b/src/clients/deno/schemas.js new file mode 100644 index 0000000..0b38737 --- /dev/null +++ b/src/clients/deno/schemas.js @@ -0,0 +1,121 @@ +// DO NOT EDIT: This file is auto-generated by generate-schema/index.ts +import { z } from "zod"; +export const Notification = z.discriminatedUnion("$type", [ + z.object({ $type: z.literal("started"), version: z.string() }), + z.object({ $type: z.literal("ipc"), message: z.string() }), + z.object({ $type: z.literal("closed") }), +]); +export const SizeWithScale = z.object({ + height: z.number(), + scaleFactor: z.number(), + width: z.number(), +}); +export const ResultType = z.discriminatedUnion("$type", [ + z.object({ $type: z.literal("string"), value: z.string() }), + z.object({ $type: z.literal("boolean"), value: z.boolean() }), + z.object({ $type: z.literal("float"), value: z.number() }), + z.object({ $type: z.literal("size"), value: SizeWithScale }), +]); +export const Response = z.discriminatedUnion("$type", [ + z.object({ $type: z.literal("ack"), id: z.number().int() }), + z.object({ + $type: z.literal("result"), + id: z.number().int(), + result: ResultType, + }), + z.object({ + $type: z.literal("err"), + id: z.number().int(), + message: z.string(), + }), +]); +export const Message = z.discriminatedUnion("$type", [ + z.object({ $type: z.literal("notification"), data: Notification }), + z.object({ $type: z.literal("response"), data: Response }), +]); +export const Content = z.union([ + z.object({ + headers: z.record(z.string(), z.string()).optional(), + url: z.string(), + }), + z.object({ html: z.string(), origin: z.string() }), +]); +export const Size = z.object({ + height: z.number(), + width: z.number(), +}); +export const WindowSizeStates = z.enum([ + "maximized", + "fullscreen", +]); +export const WindowSize = z.union([ + WindowSizeStates, + Size, +]); +export const Options = z.object({ + acceptFirstMouse: z.boolean().optional(), + autoplay: z.boolean().optional(), + clipboard: z.boolean().optional(), + decorations: z.boolean().optional(), + devtools: z.boolean().optional(), + focused: z.boolean().optional(), + incognito: z.boolean().optional(), + initializationScript: z.string(), + ipc: z.boolean().optional(), + load: Content.optional(), + size: WindowSize.optional(), + title: z.string(), + transparent: z.boolean().optional(), + userAgent: z.string(), +}); +export const Request = z.discriminatedUnion("$type", [ + z.object({ $type: z.literal("getVersion"), id: z.number().int() }), + z.object({ $type: z.literal("eval"), id: z.number().int(), js: z.string() }), + z.object({ + $type: z.literal("setTitle"), + id: z.number().int(), + title: z.string(), + }), + z.object({ $type: z.literal("getTitle"), id: z.number().int() }), + z.object({ + $type: z.literal("setVisibility"), + id: z.number().int(), + visible: z.boolean(), + }), + z.object({ $type: z.literal("isVisible"), id: z.number().int() }), + z.object({ $type: z.literal("openDevTools"), id: z.number().int() }), + z.object({ + $type: z.literal("getSize"), + id: z.number().int(), + include_decorations: z.boolean().optional(), + }), + z.object({ $type: z.literal("setSize"), id: z.number().int(), size: Size }), + z.object({ + $type: z.literal("fullscreen"), + fullscreen: z.boolean().optional(), + id: z.number().int(), + }), + z.object({ + $type: z.literal("maximize"), + id: z.number().int(), + maximized: z.boolean().optional(), + }), + z.object({ + $type: z.literal("minimize"), + id: z.number().int(), + minimized: z.boolean().optional(), + }), + z.object({ + $type: z.literal("loadHtml"), + html: z.string(), + id: z.number().int(), + origin: z.string().optional(), + }), + z.object({ + $type: z.literal("loadUrl"), + headers: z.record(z.string(), z.string()).optional(), + id: z.number().int(), + url: z.string(), + }), +]); +//# sourceMappingURL=schemas.js.map \ No newline at end of file diff --git a/src/clients/deno/schemas.js.map b/src/clients/deno/schemas.js.map new file mode 100644 index 0000000..b35fd0f --- /dev/null +++ b/src/clients/deno/schemas.js.map @@ -0,0 +1 @@ +{"version":3,"file":"schemas.js","sourceRoot":"","sources":["schemas.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA6FxB,MAAM,CAAC,MAAM,YAAY,GAA4B,CAAC,CAAC,kBAAkB,CACvE,OAAO,EACP;IACE,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;IAC9D,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;IAC1D,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;CACzC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAA6B,CAAC,CAAC,MAAM,CAAC;IAC9D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,KAAK,EA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ACpB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;KAChB,CAAC;CACH,CAAC,CAAC"} \ No newline at end of file diff --git a/src/clients/deno/schemas.ts b/src/clients/deno/schemas.ts index f835be0..115a741 100644 --- a/src/clients/deno/schemas.ts +++ b/src/clients/deno/schemas.ts @@ -1,5 +1,5 @@ // DO NOT EDIT: This file is auto-generated by generate-schema/index.ts -import { z } from "npm:zod"; +import { z } from "zod"; /** * Messages that are sent unbidden from the webview to the client. diff --git a/src/clients/deno/tsconfig.json b/src/clients/deno/tsconfig.json new file mode 100644 index 0000000..64b7eb4 --- /dev/null +++ b/src/clients/deno/tsconfig.json @@ -0,0 +1,44 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ESNext", + "moduleResolution": "node", + "outDir": ".", + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "exactOptionalPropertyTypes": false, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedIndexedAccess": true, + "noImplicitOverride": true, + "allowUnusedLabels": false, + "allowUnreachableCode": false, + "skipLibCheck": true, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "lib": ["ES2022"], + "baseUrl": ".", + "paths": { + "./schemas": ["./schemas.ts"], + "../main": ["../main.ts"] + } + }, + "include": [ + "*.ts", + "examples/*.ts" + ], + "exclude": [ + "node_modules", + "*.js", + "*.d.ts", + "examples/*.js", + "examples/*.d.ts" + ] +} \ No newline at end of file From b0294f6278c36cca6be49331da87ed477b535142 Mon Sep 17 00:00:00 2001 From: Justin Bennett Date: Tue, 12 Aug 2025 18:27:18 -0400 Subject: [PATCH 2/2] Remove build artifacts and add .gitignore - Delete all compiled .js, .js.map, .d.ts, and .d.ts.map files - Keep fix-imports.js as it's a source script - Add .gitignore to prevent future build artifacts from being committed --- src/clients/deno/.gitignore | 11 + src/clients/deno/examples/ipc.d.ts | 2 - src/clients/deno/examples/ipc.d.ts.map | 1 - src/clients/deno/examples/ipc.js | 76 --- src/clients/deno/examples/ipc.js.map | 1 - src/clients/deno/examples/load-html.d.ts | 2 - src/clients/deno/examples/load-html.d.ts.map | 1 - src/clients/deno/examples/load-html.js | 82 --- src/clients/deno/examples/load-html.js.map | 1 - src/clients/deno/examples/load-url.d.ts | 2 - src/clients/deno/examples/load-url.d.ts.map | 1 - src/clients/deno/examples/load-url.js | 87 --- src/clients/deno/examples/load-url.js.map | 1 - src/clients/deno/examples/simple.d.ts | 2 - src/clients/deno/examples/simple.d.ts.map | 1 - src/clients/deno/examples/simple.js | 80 --- src/clients/deno/examples/simple.js.map | 1 - src/clients/deno/examples/tldraw.d.ts | 2 - src/clients/deno/examples/tldraw.d.ts.map | 1 - src/clients/deno/examples/tldraw.js | 117 ---- src/clients/deno/examples/tldraw.js.map | 1 - src/clients/deno/examples/window-size.d.ts | 2 - .../deno/examples/window-size.d.ts.map | 1 - src/clients/deno/examples/window-size.js | 99 ---- src/clients/deno/examples/window-size.js.map | 1 - src/clients/deno/main.d.ts | 177 ------ src/clients/deno/main.d.ts.map | 1 - src/clients/deno/main.js | 557 ------------------ src/clients/deno/main.js.map | 1 - src/clients/deno/schemas.d.ts | 227 ------- src/clients/deno/schemas.d.ts.map | 1 - src/clients/deno/schemas.js | 121 ---- src/clients/deno/schemas.js.map | 1 - 33 files changed, 11 insertions(+), 1651 deletions(-) create mode 100644 src/clients/deno/.gitignore delete mode 100644 src/clients/deno/examples/ipc.d.ts delete mode 100644 src/clients/deno/examples/ipc.d.ts.map delete mode 100644 src/clients/deno/examples/ipc.js delete mode 100644 src/clients/deno/examples/ipc.js.map delete mode 100644 src/clients/deno/examples/load-html.d.ts delete mode 100644 src/clients/deno/examples/load-html.d.ts.map delete mode 100644 src/clients/deno/examples/load-html.js delete mode 100644 src/clients/deno/examples/load-html.js.map delete mode 100644 src/clients/deno/examples/load-url.d.ts delete mode 100644 src/clients/deno/examples/load-url.d.ts.map delete mode 100644 src/clients/deno/examples/load-url.js delete mode 100644 src/clients/deno/examples/load-url.js.map delete mode 100644 src/clients/deno/examples/simple.d.ts delete mode 100644 src/clients/deno/examples/simple.d.ts.map delete mode 100644 src/clients/deno/examples/simple.js delete mode 100644 src/clients/deno/examples/simple.js.map delete mode 100644 src/clients/deno/examples/tldraw.d.ts delete mode 100644 src/clients/deno/examples/tldraw.d.ts.map delete mode 100644 src/clients/deno/examples/tldraw.js delete mode 100644 src/clients/deno/examples/tldraw.js.map delete mode 100644 src/clients/deno/examples/window-size.d.ts delete mode 100644 src/clients/deno/examples/window-size.d.ts.map delete mode 100644 src/clients/deno/examples/window-size.js delete mode 100644 src/clients/deno/examples/window-size.js.map delete mode 100644 src/clients/deno/main.d.ts delete mode 100644 src/clients/deno/main.d.ts.map delete mode 100644 src/clients/deno/main.js delete mode 100644 src/clients/deno/main.js.map delete mode 100644 src/clients/deno/schemas.d.ts delete mode 100644 src/clients/deno/schemas.d.ts.map delete mode 100644 src/clients/deno/schemas.js delete mode 100644 src/clients/deno/schemas.js.map diff --git a/src/clients/deno/.gitignore b/src/clients/deno/.gitignore new file mode 100644 index 0000000..d1a68c2 --- /dev/null +++ b/src/clients/deno/.gitignore @@ -0,0 +1,11 @@ +# Build artifacts +*.js +*.js.map +*.d.ts +*.d.ts.map + +# Keep specific files +!fix-imports.js + +# Dependencies +node_modules/ \ No newline at end of file diff --git a/src/clients/deno/examples/ipc.d.ts b/src/clients/deno/examples/ipc.d.ts deleted file mode 100644 index 565dc51..0000000 --- a/src/clients/deno/examples/ipc.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=ipc.d.ts.map \ No newline at end of file diff --git a/src/clients/deno/examples/ipc.d.ts.map b/src/clients/deno/examples/ipc.d.ts.map deleted file mode 100644 index 72d97b6..0000000 --- a/src/clients/deno/examples/ipc.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ipc.d.ts","sourceRoot":"","sources":["ipc.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/clients/deno/examples/ipc.js b/src/clients/deno/examples/ipc.js deleted file mode 100644 index 495a706..0000000 --- a/src/clients/deno/examples/ipc.js +++ /dev/null @@ -1,76 +0,0 @@ -var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose, inner; - if (async) { - if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; - } - if (dispose === void 0) { - if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - if (async) inner = dispose; - } - if (typeof dispose !== "function") throw new TypeError("Object not disposable."); - if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; - env.stack.push({ value: value, dispose: dispose, async: async }); - } - else if (async) { - env.stack.push({ async: true }); - } - return value; -}; -var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) { - return function (env) { - function fail(e) { - env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; - env.hasError = true; - } - var r, s = 0; - function next() { - while (r = env.stack.pop()) { - try { - if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); - if (r.dispose) { - var result = r.dispose.call(r.value); - if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); - } - else s |= 1; - } - catch (e) { - fail(e); - } - } - if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); - if (env.hasError) throw env.error; - } - return next(); - }; -})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; -}); -import { createWebView } from '../main.js'; -var webview; -const env_1 = { stack: [], error: void 0, hasError: false }; -try { - webview = __addDisposableResource(env_1, await createWebView({ - title: "Simple", - load: { - html: '', - }, - ipc: true, - }), false); - webview.on("ipc", ({ message }) => { - console.log(message); - }); - await webview.waitUntilClosed(); -} -catch (e_1) { - env_1.error = e_1; - env_1.hasError = true; -} -finally { - __disposeResources(env_1); -} -//# sourceMappingURL=ipc.js.map \ No newline at end of file diff --git a/src/clients/deno/examples/ipc.js.map b/src/clients/deno/examples/ipc.js.map deleted file mode 100644 index 1631f7c..0000000 --- a/src/clients/deno/examples/ipc.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ipc.js","sourceRoot":"","sources":["ipc.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;;;;IAElC,yCAAU,MAAM,aAAa,CAAC;QAClC,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE;YACJ,IAAI,EACF,4FAA4F;SAC/F;QACD,GAAG,EAAE,IAAI;KACV,CAAC,QAAA,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC"} \ No newline at end of file diff --git a/src/clients/deno/examples/load-html.d.ts b/src/clients/deno/examples/load-html.d.ts deleted file mode 100644 index 374de6e..0000000 --- a/src/clients/deno/examples/load-html.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=load-html.d.ts.map \ No newline at end of file diff --git a/src/clients/deno/examples/load-html.d.ts.map b/src/clients/deno/examples/load-html.d.ts.map deleted file mode 100644 index 30634af..0000000 --- a/src/clients/deno/examples/load-html.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"load-html.d.ts","sourceRoot":"","sources":["load-html.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/clients/deno/examples/load-html.js b/src/clients/deno/examples/load-html.js deleted file mode 100644 index 3b955c8..0000000 --- a/src/clients/deno/examples/load-html.js +++ /dev/null @@ -1,82 +0,0 @@ -var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose, inner; - if (async) { - if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; - } - if (dispose === void 0) { - if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - if (async) inner = dispose; - } - if (typeof dispose !== "function") throw new TypeError("Object not disposable."); - if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; - env.stack.push({ value: value, dispose: dispose, async: async }); - } - else if (async) { - env.stack.push({ async: true }); - } - return value; -}; -var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) { - return function (env) { - function fail(e) { - env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; - env.hasError = true; - } - var r, s = 0; - function next() { - while (r = env.stack.pop()) { - try { - if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); - if (r.dispose) { - var result = r.dispose.call(r.value); - if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); - } - else s |= 1; - } - catch (e) { - fail(e); - } - } - if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); - if (env.hasError) throw env.error; - } - return next(); - }; -})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; -}); -import { createWebView } from '../main.js'; -var webview; -const env_1 = { stack: [], error: void 0, hasError: false }; -try { - webview = __addDisposableResource(env_1, await createWebView({ - title: "Load Html Example", - load: { - html: "

Initial html

", - // Note: This origin is used with a custom protocol so it doesn't match - // https://example.com. This doesn't need to be set, but can be useful if - // you want to control resources that are scoped to a specific origin like - // local storage or indexeddb. - origin: "example.com", - }, - devtools: true, - }), false); - webview.on("started", async () => { - await webview.openDevTools(); - await webview.loadHtml("

Updated html!

"); - }); - await webview.waitUntilClosed(); -} -catch (e_1) { - env_1.error = e_1; - env_1.hasError = true; -} -finally { - __disposeResources(env_1); -} -//# sourceMappingURL=load-html.js.map \ No newline at end of file diff --git a/src/clients/deno/examples/load-html.js.map b/src/clients/deno/examples/load-html.js.map deleted file mode 100644 index 598cabd..0000000 --- a/src/clients/deno/examples/load-html.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"load-html.js","sourceRoot":"","sources":["load-html.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;;;;IAElC,yCAAU,MAAM,aAAa,CAAC;QAClC,KAAK,EAAE,mBAAmB;QAC1B,IAAI,EAAE;YACJ,IAAI,EAAE,uBAAuB;YAC7B,uEAAuE;YACvE,yEAAyE;YACzE,0EAA0E;YAC1E,8BAA8B;YAC9B,MAAM,EAAE,aAAa;SACtB;QACD,QAAQ,EAAE,IAAI;KACf,CAAC,QAAA,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QAC/B,MAAM,OAAO,CAAC,YAAY,EAAE,CAAC;QAC7B,MAAM,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC"} \ No newline at end of file diff --git a/src/clients/deno/examples/load-url.d.ts b/src/clients/deno/examples/load-url.d.ts deleted file mode 100644 index c0f1fb9..0000000 --- a/src/clients/deno/examples/load-url.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=load-url.d.ts.map \ No newline at end of file diff --git a/src/clients/deno/examples/load-url.d.ts.map b/src/clients/deno/examples/load-url.d.ts.map deleted file mode 100644 index 8799f16..0000000 --- a/src/clients/deno/examples/load-url.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"load-url.d.ts","sourceRoot":"","sources":["load-url.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/clients/deno/examples/load-url.js b/src/clients/deno/examples/load-url.js deleted file mode 100644 index eec8cd8..0000000 --- a/src/clients/deno/examples/load-url.js +++ /dev/null @@ -1,87 +0,0 @@ -var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose, inner; - if (async) { - if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; - } - if (dispose === void 0) { - if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - if (async) inner = dispose; - } - if (typeof dispose !== "function") throw new TypeError("Object not disposable."); - if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; - env.stack.push({ value: value, dispose: dispose, async: async }); - } - else if (async) { - env.stack.push({ async: true }); - } - return value; -}; -var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) { - return function (env) { - function fail(e) { - env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; - env.hasError = true; - } - var r, s = 0; - function next() { - while (r = env.stack.pop()) { - try { - if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); - if (r.dispose) { - var result = r.dispose.call(r.value); - if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); - } - else s |= 1; - } - catch (e) { - fail(e); - } - } - if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); - if (env.hasError) throw env.error; - } - return next(); - }; -})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; -}); -import { createWebView } from '../main.js'; -function sleep(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); -} -var webview; -const env_1 = { stack: [], error: void 0, hasError: false }; -try { - webview = __addDisposableResource(env_1, await createWebView({ - title: "Load Url Example", - load: { - url: "https://example.com", - headers: { - "Content-Type": "text/html", - }, - }, - userAgent: "curl/7.81.0", - devtools: true, - }), false); - webview.on("started", async () => { - await webview.openDevTools(); - await sleep(2000); - await webview.loadUrl("https://val.town/", { - "Content-Type": "text/html", - }); - }); - await webview.waitUntilClosed(); -} -catch (e_1) { - env_1.error = e_1; - env_1.hasError = true; -} -finally { - __disposeResources(env_1); -} -//# sourceMappingURL=load-url.js.map \ No newline at end of file diff --git a/src/clients/deno/examples/load-url.js.map b/src/clients/deno/examples/load-url.js.map deleted file mode 100644 index 7d2bc38..0000000 --- a/src/clients/deno/examples/load-url.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"load-url.js","sourceRoot":"","sources":["load-url.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAwBxC,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;;;;IAxBK,yCAAU,MAAM,aAAa,CAAC;QAClC,KAAK,EAAE,kBAAkB;QACzB,IAAI,EAAE;YACJ,GAAG,EAAE,qBAAqB;YAC1B,OAAO,EAAE;gBACP,cAAc,EAAE,WAAW;aAC5B;SACF;QACD,SAAS,EAAE,aAAa;QACxB,QAAQ,EAAE,IAAI;KACf,CAAC,QAAA,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QAC/B,MAAM,OAAO,CAAC,YAAY,EAAE,CAAC;QAC7B,MAAM,KAAK,CAAC,IAAI,CAAC,CAAC;QAClB,MAAM,OAAO,CAAC,OAAO,CAAC,mBAAmB,EAAE;YACzC,cAAc,EAAE,WAAW;SAC5B,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC"} \ No newline at end of file diff --git a/src/clients/deno/examples/simple.d.ts b/src/clients/deno/examples/simple.d.ts deleted file mode 100644 index d9d6f93..0000000 --- a/src/clients/deno/examples/simple.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=simple.d.ts.map \ No newline at end of file diff --git a/src/clients/deno/examples/simple.d.ts.map b/src/clients/deno/examples/simple.d.ts.map deleted file mode 100644 index 65fe8ab..0000000 --- a/src/clients/deno/examples/simple.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"simple.d.ts","sourceRoot":"","sources":["simple.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/clients/deno/examples/simple.js b/src/clients/deno/examples/simple.js deleted file mode 100644 index 3a52bd1..0000000 --- a/src/clients/deno/examples/simple.js +++ /dev/null @@ -1,80 +0,0 @@ -var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose, inner; - if (async) { - if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; - } - if (dispose === void 0) { - if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - if (async) inner = dispose; - } - if (typeof dispose !== "function") throw new TypeError("Object not disposable."); - if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; - env.stack.push({ value: value, dispose: dispose, async: async }); - } - else if (async) { - env.stack.push({ async: true }); - } - return value; -}; -var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) { - return function (env) { - function fail(e) { - env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; - env.hasError = true; - } - var r, s = 0; - function next() { - while (r = env.stack.pop()) { - try { - if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); - if (r.dispose) { - var result = r.dispose.call(r.value); - if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); - } - else s |= 1; - } - catch (e) { - fail(e); - } - } - if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); - if (env.hasError) throw env.error; - } - return next(); - }; -})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; -}); -import { createWebView } from '../main.js'; -var webview; -const env_1 = { stack: [], error: void 0, hasError: false }; -try { - webview = __addDisposableResource(env_1, await createWebView({ - title: "Simple", - devtools: true, - load: { - html: "

Hello, World!

", - }, - initializationScript: "console.log('This is printed from initializationScript!')", - }), false); - webview.on("started", async () => { - await webview.setTitle("Title set from Deno"); - await webview.getTitle(); - await webview.openDevTools(); - await webview.eval("console.log('This is printed from eval!')"); - }); - await webview.waitUntilClosed(); -} -catch (e_1) { - env_1.error = e_1; - env_1.hasError = true; -} -finally { - __disposeResources(env_1); -} -//# sourceMappingURL=simple.js.map \ No newline at end of file diff --git a/src/clients/deno/examples/simple.js.map b/src/clients/deno/examples/simple.js.map deleted file mode 100644 index 911832c..0000000 --- a/src/clients/deno/examples/simple.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"simple.js","sourceRoot":"","sources":["simple.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;;;;IAElC,yCAAU,MAAM,aAAa,CAAC;QAClC,KAAK,EAAE,QAAQ;QACf,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE;YACJ,IAAI,EAAE,wBAAwB;SAC/B;QACD,oBAAoB,EAClB,2DAA2D;KAC9D,CAAC,QAAA,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QAC/B,MAAM,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;QAC9C,MAAM,OAAO,CAAC,QAAQ,EAAE,CAAC;QACzB,MAAM,OAAO,CAAC,YAAY,EAAE,CAAC;QAC7B,MAAM,OAAO,CAAC,IAAI,CAAC,2CAA2C,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC"} \ No newline at end of file diff --git a/src/clients/deno/examples/tldraw.d.ts b/src/clients/deno/examples/tldraw.d.ts deleted file mode 100644 index ca53970..0000000 --- a/src/clients/deno/examples/tldraw.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=tldraw.d.ts.map \ No newline at end of file diff --git a/src/clients/deno/examples/tldraw.d.ts.map b/src/clients/deno/examples/tldraw.d.ts.map deleted file mode 100644 index 5ebd2d8..0000000 --- a/src/clients/deno/examples/tldraw.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tldraw.d.ts","sourceRoot":"","sources":["tldraw.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/clients/deno/examples/tldraw.js b/src/clients/deno/examples/tldraw.js deleted file mode 100644 index b01a224..0000000 --- a/src/clients/deno/examples/tldraw.js +++ /dev/null @@ -1,117 +0,0 @@ -var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose, inner; - if (async) { - if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; - } - if (dispose === void 0) { - if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - if (async) inner = dispose; - } - if (typeof dispose !== "function") throw new TypeError("Object not disposable."); - if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; - env.stack.push({ value: value, dispose: dispose, async: async }); - } - else if (async) { - env.stack.push({ async: true }); - } - return value; -}; -var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) { - return function (env) { - function fail(e) { - env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; - env.hasError = true; - } - var r, s = 0; - function next() { - while (r = env.stack.pop()) { - try { - if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); - if (r.dispose) { - var result = r.dispose.call(r.value); - if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); - } - else s |= 1; - } - catch (e) { - fail(e); - } - } - if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); - if (env.hasError) throw env.error; - } - return next(); - }; -})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; -}); -import { createWebView } from '../main.js'; -// Note: This example has been simplified for Node.js compatibility -// For full functionality, you'll need to use a bundler like esbuild, webpack, or vite -const tldrawApp = ` -import { Tldraw } from "tldraw"; -import { createRoot } from "react-dom/client"; - -function App() { - return ( - <> -
- { editor.updateInstanceState({ isFocusMode: true })}} /> -
- - ); -} - -createRoot(document.querySelector("main")).render(); -`; -// Pre-compiled version for demo purposes -const app = { code: tldrawApp.replace(//g, 'React.createElement(App)') }; -var webview; -const env_1 = { stack: [], error: void 0, hasError: false }; -try { - webview = __addDisposableResource(env_1, await createWebView({ - title: "TLDraw", - load: { - html: ` - - - - - - - - - -
- - - - - `, - }, - }), false); - await webview.waitUntilClosed(); -} -catch (e_1) { - env_1.error = e_1; - env_1.hasError = true; -} -finally { - __disposeResources(env_1); -} -//# sourceMappingURL=tldraw.js.map \ No newline at end of file diff --git a/src/clients/deno/examples/tldraw.js.map b/src/clients/deno/examples/tldraw.js.map deleted file mode 100644 index 11559c8..0000000 --- a/src/clients/deno/examples/tldraw.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"tldraw.js","sourceRoot":"","sources":["tldraw.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,mEAAmE;AACnE,sFAAsF;AAEtF,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;CAejB,CAAC;AAEF,yCAAyC;AACzC,MAAM,GAAG,GAAG,EAAE,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,0BAA0B,CAAC,EAAE,CAAC;;;;IAE3E,yCAAU,MAAM,aAAa,CAAC;QAClC,KAAK,EAAE,QAAQ;QACf,IAAI,EAAE;YACJ,IAAI,EAAE;;;;;;;;;;;;;;;;;;;;;YAqBE,GAAG,CAAC,IAAI;;;;GAIjB;SACA;KACF,CAAC,QAAA,CAAC;IAEH,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC"} \ No newline at end of file diff --git a/src/clients/deno/examples/window-size.d.ts b/src/clients/deno/examples/window-size.d.ts deleted file mode 100644 index fcb049e..0000000 --- a/src/clients/deno/examples/window-size.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=window-size.d.ts.map \ No newline at end of file diff --git a/src/clients/deno/examples/window-size.d.ts.map b/src/clients/deno/examples/window-size.d.ts.map deleted file mode 100644 index da42223..0000000 --- a/src/clients/deno/examples/window-size.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"window-size.d.ts","sourceRoot":"","sources":["window-size.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/src/clients/deno/examples/window-size.js b/src/clients/deno/examples/window-size.js deleted file mode 100644 index fa9e9c8..0000000 --- a/src/clients/deno/examples/window-size.js +++ /dev/null @@ -1,99 +0,0 @@ -var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) { - if (value !== null && value !== void 0) { - if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); - var dispose, inner; - if (async) { - if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); - dispose = value[Symbol.asyncDispose]; - } - if (dispose === void 0) { - if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); - dispose = value[Symbol.dispose]; - if (async) inner = dispose; - } - if (typeof dispose !== "function") throw new TypeError("Object not disposable."); - if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; - env.stack.push({ value: value, dispose: dispose, async: async }); - } - else if (async) { - env.stack.push({ async: true }); - } - return value; -}; -var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) { - return function (env) { - function fail(e) { - env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; - env.hasError = true; - } - var r, s = 0; - function next() { - while (r = env.stack.pop()) { - try { - if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); - if (r.dispose) { - var result = r.dispose.call(r.value); - if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); - } - else s |= 1; - } - catch (e) { - fail(e); - } - } - if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); - if (env.hasError) throw env.error; - } - return next(); - }; -})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; -}); -import { createWebView } from '../main.js'; -var webview; -const env_1 = { stack: [], error: void 0, hasError: false }; -try { - webview = __addDisposableResource(env_1, await createWebView({ - title: "Window Size", - load: { - html: ` -

Window Sizes

-
- - - -
- `, - }, - size: { - height: 200, - width: 800, - }, - ipc: true, - }), false); - webview.on("ipc", ({ message }) => { - switch (message) { - case "maximize": - webview.maximize(); - break; - case "minimize": - webview.minimize(); - break; - case "fullscreen": - webview.fullscreen(); - break; - default: - console.error("Unknown message", message); - } - }); - await webview.waitUntilClosed(); -} -catch (e_1) { - env_1.error = e_1; - env_1.hasError = true; -} -finally { - __disposeResources(env_1); -} -//# sourceMappingURL=window-size.js.map \ No newline at end of file diff --git a/src/clients/deno/examples/window-size.js.map b/src/clients/deno/examples/window-size.js.map deleted file mode 100644 index 4849cc3..0000000 --- a/src/clients/deno/examples/window-size.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"window-size.js","sourceRoot":"","sources":["window-size.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;;;;IAElC,yCAAU,MAAM,aAAa,CAAC;QAClC,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE;YACJ,IAAI,EAAE;;;;;;;GAOP;SACA;QACD,IAAI,EAAE;YACJ,MAAM,EAAE,GAAG;YACX,KAAK,EAAE,GAAG;SACX;QACD,GAAG,EAAE,IAAI;KACV,CAAC,QAAA,CAAC;IAEH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,UAAU;gBACb,OAAO,CAAC,QAAQ,EAAE,CAAC;gBACnB,MAAM;YACR,KAAK,UAAU;gBACb,OAAO,CAAC,QAAQ,EAAE,CAAC;gBACnB,MAAM;YACR,KAAK,YAAY;gBACf,OAAO,CAAC,UAAU,EAAE,CAAC;gBACrB,MAAM;YACR;gBACE,OAAO,CAAC,KAAK,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC"} \ No newline at end of file diff --git a/src/clients/deno/main.d.ts b/src/clients/deno/main.d.ts deleted file mode 100644 index a20ea90..0000000 --- a/src/clients/deno/main.d.ts +++ /dev/null @@ -1,177 +0,0 @@ -/** - * A library for creating and interacting with native webview windows. - * - * @module - * - * @example - * ```ts - * import { createWebView } from "@justbe/webview"; - * - * using webview = await createWebView({ - * title: "Example", - * load: { html: "

Hello, World!

" }, - * devtools: true - * }); - * - * webview.on("started", async () => { - * await webview.openDevTools(); - * await webview.eval("console.log('This is printed from eval!')"); - * }); - * - * await webview.waitUntilClosed(); - * ``` - */ -import { Message, type Options } from "./schemas"; -import type { Simplify } from "type-fest"; -export * from "./schemas"; -/** The version of the webview binary that's expected */ -export declare const BIN_VERSION = "0.3.1"; -type WebViewNotification = Extract["data"]; -/** - * Creates a new webview window. - * - * Will automatically fetch the webview binary if it's not already downloaded - */ -export declare function createWebView(options: Options): Promise; -/** - * A webview window. It's recommended to use the `createWebView` function - * because it provides a means of automatically fetching the webview binary - * that's compatible with your OS and architecture. - * - * Each instance of `WebView` spawns a new process that governs a single webview window. - */ -export declare class WebView implements Disposable { - #private; - /** - * Creates a new webview window. - * - * @param options - The options for the webview. - * @param webviewBinaryPath - The path to the webview binary. - */ - constructor(options: Options, webviewBinaryPath: string); - /** - * Returns a promise that resolves when the webview window is closed. - */ - waitUntilClosed(): Promise; - /** - * Listens for events emitted by the webview. - */ - on(event: E, callback: (event: Simplify, "$type">>) => void): void; - /** - * Listens for a single event emitted by the webview. - */ - once(event: E, callback: (event: Simplify, "$type">>) => void): void; - /** - * Gets the version of the webview binary. - */ - getVersion(): Promise; - /** - * Sets the size of the webview window. - * - * Note: this is the logical size of the window, not the physical size. - * @see https://docs.rs/dpi/0.1.1/x86_64-unknown-linux-gnu/dpi/index.html#position-and-size-types - */ - setSize(size: { - width: number; - height: number; - }): Promise; - /** - * Gets the size of the webview window. - * - * Note: this is the logical size of the window, not the physical size. - * @see https://docs.rs/dpi/0.1.1/x86_64-unknown-linux-gnu/dpi/index.html#position-and-size-types - */ - getSize(includeDecorations?: boolean): Promise<{ - width: number; - height: number; - scaleFactor: number; - }>; - /** - * Enters or exits fullscreen mode for the webview. - * - * @param fullscreen - If true, the webview will enter fullscreen mode. If false, the webview will exit fullscreen mode. If not specified, the webview will toggle fullscreen mode. - */ - fullscreen(fullscreen?: boolean): Promise; - /** - * Maximizes or unmaximizes the webview window. - * - * @param maximized - If true, the webview will be maximized. If false, the webview will be unmaximized. If not specified, the webview will toggle maximized state. - */ - maximize(maximized?: boolean): Promise; - /** - * Minimizes or unminimizes the webview window. - * - * @param minimized - If true, the webview will be minimized. If false, the webview will be unminimized. If not specified, the webview will toggle minimized state. - */ - minimize(minimized?: boolean): Promise; - /** - * Sets the title of the webview window. - */ - setTitle(title: string): Promise; - /** - * Gets the title of the webview window. - */ - getTitle(): Promise; - /** - * Sets the visibility of the webview window. - */ - setVisibility(visible: boolean): Promise; - /** - * Returns true if the webview window is visible. - */ - isVisible(): Promise; - /** - * Evaluates JavaScript code in the webview. - */ - eval(code: string): Promise; - /** - * Opens the developer tools for the webview. - */ - openDevTools(): Promise; - /** - * Reloads the webview with the provided html. - */ - loadHtml(html: string): Promise; - /** - * Loads a URL in the webview. - */ - loadUrl(url: string, headers?: Record): Promise; - /** - * Destroys the webview and cleans up resources. - * - * Alternatively you can use the disposible interface. - * - * @example - * ```ts - * // The `using` keyword will automatically call `destroy` on the webview when - * // the webview goes out of scope. - * using webview = await createWebView({ title: "My Webview" }); - * ``` - */ - destroy(): void; - /** - * Part of the explicit resource management feature added in TS 5.2 - * - * When a reference to the webview is stored with `using` this method - * will be called automatically when the webview goes out of scope. - * - * @example - * - * ```ts - * { - * using webview = await createWebView({ title: "My Webview" }); - * } // Webview will be cleaned up here - * - * ``` - * - * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management - */ - [Symbol.dispose](): void; -} -//# sourceMappingURL=main.d.ts.map \ No newline at end of file diff --git a/src/clients/deno/main.d.ts.map b/src/clients/deno/main.d.ts.map deleted file mode 100644 index fa3cdf6..0000000 --- a/src/clients/deno/main.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAQH,OAAO,EACL,OAAO,EACP,KAAK,OAAO,EAGb,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAU,QAAQ,EAAE,MAAM,WAAW,CAAC;AAgClD,cAAc,WAAW,CAAC;AAK1B,wDAAwD;AACxD,eAAO,MAAM,WAAW,UAAU,CAAC;AAEnC,KAAK,mBAAmB,GAAG,OAAO,CAChC,OAAO,EACP;IAAE,KAAK,EAAE,cAAc,CAAA;CAAE,CAC1B,CAAC,MAAM,CAAC,CAAC;AAuIV;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAGtE;AAED;;;;;;GAMG;AACH,qBAAa,OAAQ,YAAW,UAAU;;IASxC;;;;;OAKG;gBACS,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,MAAM;IA8EvD;;OAEG;IACG,eAAe;IAIrB;;OAEG;IACH,EAAE,CAAC,CAAC,SAAS,mBAAmB,CAAC,OAAO,CAAC,EACvC,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,CACR,KAAK,EAAE,QAAQ,CACb,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE;QAAE,KAAK,EAAE,CAAC,CAAA;KAAE,CAAC,EAAE,OAAO,CAAC,CAC1D,KACE,IAAI;IAQX;;OAEG;IACH,IAAI,CAAC,CAAC,SAAS,mBAAmB,CAAC,OAAO,CAAC,EACzC,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,CACR,KAAK,EAAE,QAAQ,CACb,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE;QAAE,KAAK,EAAE,CAAC,CAAA;KAAE,CAAC,EAAE,OAAO,CAAC,CAC1D,KACE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CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAS3E;;;;;;;;;;;OAWG;IAEH,OAAO;IAIP;;;;;;;;;;;;;;;;OAgBG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;CASzB"} \ No newline at end of file diff --git a/src/clients/deno/main.js b/src/clients/deno/main.js deleted file mode 100644 index d9e841c..0000000 --- a/src/clients/deno/main.js +++ /dev/null @@ -1,557 +0,0 @@ -/** - * A library for creating and interacting with native webview windows. - * - * @module - * - * @example - * ```ts - * import { createWebView } from "@justbe/webview"; - * - * using webview = await createWebView({ - * title: "Example", - * load: { html: "

Hello, World!

" }, - * devtools: true - * }); - * - * webview.on("started", async () => { - * await webview.openDevTools(); - * await webview.eval("console.log('This is printed from eval!')"); - * }); - * - * await webview.waitUntilClosed(); - * ``` - */ -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -var __metadata = (this && this.__metadata) || function (k, v) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); -}; -import { EventEmitter } from "node:events"; -import { spawn } from "node:child_process"; -import { writeFile, access, mkdir } from "node:fs/promises"; -import { join } from "node:path"; -import { platform, arch, homedir } from "node:os"; -import { constants } from "node:fs"; -import { Message, Response as WebViewResponse, } from './schemas.js'; -const logger = { - trace: (message, data) => { - if (process.env.LOG_LEVEL === 'trace' || process.env.LOG_LEVEL === 'debug') { - console.log(`[TRACE] ${message}`, data ? JSON.stringify(data) : ''); - } - }, - warn: (message) => { - console.warn(`[WARN] ${message}`); - }, - error: (message, data) => { - console.error(`[ERROR] ${message}`, data ? JSON.stringify(data) : ''); - } -}; -// Decorator replacement -function instrument() { - return function (_target, _propertyKey, descriptor) { - return descriptor; - }; -} -import { match } from "ts-pattern"; -export * from './schemas.js'; -// Logging is now handled by the logger object above -// Should match the cargo package version -/** The version of the webview binary that's expected */ -export const BIN_VERSION = "0.3.1"; -/** - * A helper function for extracting the result from a webview response. - * Throws if the response includes unexpected results. - * - * @param result - The result of the webview request. - * @param expectedType - The format of the expected result. - */ -function returnResult(result, expectedType) { - if (result.$type === "result") { - if (result.result.$type === expectedType) { - // @ts-expect-error TS doesn't correctly narrow this type, but it's correct - return result.result.value; - } - throw new Error(`unexpected result type: ${result.result.$type}`); - } - throw new Error(`unexpected response: ${result.$type}`); -} -/** - * A helper function for acknowledging a webview response. - * Throws if the response includes unexpected results. - */ -const returnAck = (result) => { - return match(result) - .with({ $type: "ack" }, () => undefined) - .with({ $type: "err" }, (err) => { - throw new Error(err.message); - }) - .otherwise(() => { - throw new Error(`unexpected response: ${result.$type}`); - }); -}; -async function getWebViewBin(options) { - // Check for WEBVIEW_BIN environment variable - const binPath = process.env.WEBVIEW_BIN; - if (binPath) - return binPath; - const currentPlatform = platform(); - const flags = options.devtools - ? "-devtools" - : options.transparent && currentPlatform === "darwin" - ? "-transparent" - : ""; - const cacheDir = getCacheDir(); - const fileName = `webview-${BIN_VERSION}${flags}${currentPlatform === "win32" ? ".exe" : ""}`; - const filePath = join(cacheDir, fileName); - // Check if the file already exists in cache - if (await fileExists(filePath)) { - return filePath; - } - // If not in cache, download it - let url = `https://github.com/zephraph/webview/releases/download/webview-v${BIN_VERSION}/webview`; - url += match(currentPlatform) - .with("darwin", () => "-mac" + (arch() === "arm64" ? "-arm64" : "") + flags) - .with("linux", () => "-linux" + flags) - .with("win32", () => "-windows" + flags + ".exe") - .otherwise(() => { - // Default to linux for unknown platforms - logger.warn(`Unknown platform: ${currentPlatform}, defaulting to linux binary`); - return "-linux" + flags; - }); - const res = await fetch(url); - // Ensure the cache directory exists - await ensureDir(cacheDir); - // Write the binary to disk - const arrayBuffer = await res.arrayBuffer(); - await writeFile(filePath, new Uint8Array(arrayBuffer), { mode: 0o755 }); - return filePath; -} -// Helper function to get the OS-specific cache directory -function getCacheDir() { - const currentPlatform = platform(); - return match(currentPlatform) - .with("darwin", () => join(homedir(), "Library", "Caches", "webview")) - .with("linux", () => join(homedir(), ".cache", "webview")) - .with("win32", () => join(process.env.LOCALAPPDATA || join(homedir(), "AppData", "Local"), "webview", "Cache")) - .otherwise(() => { - // Default to a .cache directory in home for unknown platforms - logger.warn(`Unknown platform: ${currentPlatform}, using default cache directory`); - return join(homedir(), ".cache", "webview"); - }); -} -// Helper function to check if file exists -async function fileExists(filePath) { - try { - await access(filePath, constants.F_OK); - return true; - } - catch { - return false; - } -} -// Helper function to ensure directory exists -async function ensureDir(dirPath) { - try { - await mkdir(dirPath, { recursive: true }); - } - catch (err) { - if (err.code !== "EEXIST") { - throw err; - } - } -} -/** - * Creates a new webview window. - * - * Will automatically fetch the webview binary if it's not already downloaded - */ -export async function createWebView(options) { - const binPath = await getWebViewBin(options); - return new WebView(options, binPath); -} -/** - * A webview window. It's recommended to use the `createWebView` function - * because it provides a means of automatically fetching the webview binary - * that's compatible with your OS and architecture. - * - * Each instance of `WebView` spawns a new process that governs a single webview window. - */ -export class WebView { - #process; - #buffer = ""; - #internalEvent = new EventEmitter(); - #externalEvent = new EventEmitter(); - #messageLoop; - #options; - #messageId = 0; - /** - * Creates a new webview window. - * - * @param options - The options for the webview. - * @param webviewBinaryPath - The path to the webview binary. - */ - constructor(options, webviewBinaryPath) { - this.#options = options; - this.#process = spawn(webviewBinaryPath, [JSON.stringify(options)], { - stdio: ["pipe", "pipe", "inherit"], - }); - this.#messageLoop = this.#processMessageLoop(); - } - #send(request) { - const id = this.#messageId++; - return new Promise((resolve) => { - // Setup listener before sending the message to avoid race conditions - this.#internalEvent.once(id.toString(), (event) => { - const result = WebViewResponse.safeParse(event); - if (result.success) { - resolve(result.data); - } - else { - resolve({ $type: "err", id, message: result.error.message }); - } - }); - this.#process.stdin?.write(JSON.stringify({ ...request, id })); - }); - } - async #processMessageLoop() { - return new Promise((resolve) => { - this.#process.stdout?.on('data', (chunk) => { - this.#buffer += chunk.toString(); - let newlineIndex; - while ((newlineIndex = this.#buffer.indexOf('\n')) !== -1) { - const messageStr = this.#buffer.slice(0, newlineIndex); - this.#buffer = this.#buffer.slice(newlineIndex + 1); - try { - logger.trace("buffer", { buffer: messageStr }); - const result = Message.safeParse(JSON.parse(messageStr)); - if (result.success) { - this.#handleMessage(result.data); - } - else { - logger.error("Error parsing message", { error: result.error }); - } - } - catch (parseError) { - logger.error("Error parsing JSON", { error: parseError }); - } - } - }); - this.#process.stdout?.on('end', () => { - resolve(); - }); - this.#process.on('exit', () => { - resolve(); - }); - }); - } - #handleMessage(result) { - match(result) - .with({ $type: "notification" }, ({ data }) => { - const { $type, ...body } = data; - this.#externalEvent.emit($type, body); - if (data.$type === "started" && data.version !== BIN_VERSION) { - logger.warn(`Expected webview to be version ${BIN_VERSION} but got ${data.version}. Some features may not work as expected.`); - } - }) - .with({ $type: "response" }, ({ data }) => { - this.#internalEvent.emit(data.id.toString(), data); - }) - .exhaustive(); - } - /** - * Returns a promise that resolves when the webview window is closed. - */ - async waitUntilClosed() { - await this.#messageLoop; - } - /** - * Listens for events emitted by the webview. - */ - on(event, callback) { - if (event === "ipc" && !this.#options.ipc) { - throw new Error("IPC is not enabled for this webview"); - } - this.#externalEvent.on(event, callback); - } - /** - * Listens for a single event emitted by the webview. - */ - once(event, callback) { - if (event === "ipc" && !this.#options.ipc) { - throw new Error("IPC is not enabled for this webview"); - } - this.#externalEvent.once(event, callback); - } - /** - * Gets the version of the webview binary. - */ - async getVersion() { - const result = await this.#send({ $type: "getVersion" }); - return returnResult(result, "string"); - } - /** - * Sets the size of the webview window. - * - * Note: this is the logical size of the window, not the physical size. - * @see https://docs.rs/dpi/0.1.1/x86_64-unknown-linux-gnu/dpi/index.html#position-and-size-types - */ - async setSize(size) { - const result = await this.#send({ $type: "setSize", size }); - return returnAck(result); - } - /** - * Gets the size of the webview window. - * - * Note: this is the logical size of the window, not the physical size. - * @see https://docs.rs/dpi/0.1.1/x86_64-unknown-linux-gnu/dpi/index.html#position-and-size-types - */ - async getSize(includeDecorations) { - const request = { - $type: "getSize", - }; - if (includeDecorations !== undefined) { - request.include_decorations = includeDecorations; - } - const result = await this.#send(request); - return returnResult(result, "size"); - } - /** - * Enters or exits fullscreen mode for the webview. - * - * @param fullscreen - If true, the webview will enter fullscreen mode. If false, the webview will exit fullscreen mode. If not specified, the webview will toggle fullscreen mode. - */ - async fullscreen(fullscreen) { - const request = { $type: "fullscreen" }; - if (fullscreen !== undefined) { - request.fullscreen = fullscreen; - } - const result = await this.#send(request); - return returnAck(result); - } - /** - * Maximizes or unmaximizes the webview window. - * - * @param maximized - If true, the webview will be maximized. If false, the webview will be unmaximized. If not specified, the webview will toggle maximized state. - */ - async maximize(maximized) { - const request = { $type: "maximize" }; - if (maximized !== undefined) { - request.maximized = maximized; - } - const result = await this.#send(request); - return returnAck(result); - } - /** - * Minimizes or unminimizes the webview window. - * - * @param minimized - If true, the webview will be minimized. If false, the webview will be unminimized. If not specified, the webview will toggle minimized state. - */ - async minimize(minimized) { - const request = { $type: "minimize" }; - if (minimized !== undefined) { - request.minimized = minimized; - } - const result = await this.#send(request); - return returnAck(result); - } - /** - * Sets the title of the webview window. - */ - async setTitle(title) { - const result = await this.#send({ - $type: "setTitle", - title, - }); - return returnAck(result); - } - /** - * Gets the title of the webview window. - */ - async getTitle() { - const result = await this.#send({ $type: "getTitle" }); - return returnResult(result, "string"); - } - /** - * Sets the visibility of the webview window. - */ - async setVisibility(visible) { - const result = await this.#send({ $type: "setVisibility", visible }); - return returnAck(result); - } - /** - * Returns true if the webview window is visible. - */ - async isVisible() { - const result = await this.#send({ $type: "isVisible" }); - return returnResult(result, "boolean"); - } - /** - * Evaluates JavaScript code in the webview. - */ - async eval(code) { - const result = await this.#send({ $type: "eval", js: code }); - return returnAck(result); - } - /** - * Opens the developer tools for the webview. - */ - async openDevTools() { - const result = await this.#send({ $type: "openDevTools" }); - return returnAck(result); - } - /** - * Reloads the webview with the provided html. - */ - async loadHtml(html) { - const result = await this.#send({ $type: "loadHtml", html }); - return returnAck(result); - } - /** - * Loads a URL in the webview. - */ - async loadUrl(url, headers) { - const request = { $type: "loadUrl", url }; - if (headers !== undefined) { - request.headers = headers; - } - const result = await this.#send(request); - return returnAck(result); - } - /** - * Destroys the webview and cleans up resources. - * - * Alternatively you can use the disposible interface. - * - * @example - * ```ts - * // The `using` keyword will automatically call `destroy` on the webview when - * // the webview goes out of scope. - * using webview = await createWebView({ title: "My Webview" }); - * ``` - */ - destroy() { - this[Symbol.dispose](); - } - /** - * Part of the explicit resource management feature added in TS 5.2 - * - * When a reference to the webview is stored with `using` this method - * will be called automatically when the webview goes out of scope. - * - * @example - * - * ```ts - * { - * using webview = await createWebView({ title: "My Webview" }); - * } // Webview will be cleaned up here - * - * ``` - * - * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management - */ - [Symbol.dispose]() { - this.#internalEvent.removeAllListeners(); - this.#externalEvent.removeAllListeners(); - try { - this.#process.kill(); - } - catch (_) { - // Ignore errors when killing process - } - } -} -__decorate([ - instrument(), - __metadata("design:type", Function), - __metadata("design:paramtypes", []), - __metadata("design:returntype", Promise) -], WebView.prototype, "getVersion", null); -__decorate([ - instrument(), - __metadata("design:type", Function), - __metadata("design:paramtypes", [Object]), - __metadata("design:returntype", Promise) -], WebView.prototype, "setSize", null); -__decorate([ - instrument(), - __metadata("design:type", Function), - __metadata("design:paramtypes", [Boolean]), - __metadata("design:returntype", Promise) -], WebView.prototype, "getSize", null); -__decorate([ - instrument(), - __metadata("design:type", Function), - __metadata("design:paramtypes", [Boolean]), - __metadata("design:returntype", Promise) -], WebView.prototype, "fullscreen", null); -__decorate([ - instrument(), - __metadata("design:type", Function), - __metadata("design:paramtypes", [Boolean]), - __metadata("design:returntype", Promise) -], WebView.prototype, "maximize", null); -__decorate([ - instrument(), - __metadata("design:type", Function), - __metadata("design:paramtypes", [Boolean]), - __metadata("design:returntype", Promise) -], WebView.prototype, "minimize", null); -__decorate([ - instrument(), - __metadata("design:type", Function), - __metadata("design:paramtypes", [String]), - __metadata("design:returntype", Promise) -], WebView.prototype, "setTitle", null); -__decorate([ - instrument(), - __metadata("design:type", Function), - __metadata("design:paramtypes", []), - __metadata("design:returntype", Promise) -], WebView.prototype, "getTitle", null); -__decorate([ - instrument(), - __metadata("design:type", Function), - __metadata("design:paramtypes", [Boolean]), - __metadata("design:returntype", Promise) -], WebView.prototype, "setVisibility", null); -__decorate([ - instrument(), - __metadata("design:type", Function), - __metadata("design:paramtypes", []), - __metadata("design:returntype", Promise) -], WebView.prototype, "isVisible", null); -__decorate([ - instrument(), - __metadata("design:type", Function), - __metadata("design:paramtypes", [String]), - __metadata("design:returntype", Promise) -], WebView.prototype, "eval", null); -__decorate([ - instrument(), - __metadata("design:type", Function), - __metadata("design:paramtypes", []), - __metadata("design:returntype", Promise) -], WebView.prototype, "openDevTools", null); -__decorate([ - instrument(), - __metadata("design:type", Function), - __metadata("design:paramtypes", [String]), - __metadata("design:returntype", Promise) -], WebView.prototype, "loadHtml", null); -__decorate([ - instrument(), - __metadata("design:type", Function), - __metadata("design:paramtypes", [String, Object]), - __metadata("design:returntype", Promise) -], WebView.prototype, "loadUrl", null); -__decorate([ - instrument(), - __metadata("design:type", Function), - __metadata("design:paramtypes", []), - __metadata("design:returntype", void 0) -], WebView.prototype, "destroy", null); -//# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/src/clients/deno/main.js.map b/src/clients/deno/main.js.map deleted file mode 100644 index 8b04031..0000000 --- a/src/clients/deno/main.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"names":[],"mappings":"AAAA;;;;;;;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,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC;QACd,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC;QACzC,IAAI,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC;QACzC,IAAI,CAAC;YACH,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACvB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,qCAAqC;QACvC,CAAC;IACH,CAAC;CACF;AA/MO;IADL,UAAU,EAAE;;;;yCAIZ;AASK;IADL,UAAU,EAAE;;;;sCAIZ;AASK;IADL,UAAU,EAAE;;;;sCAeZ;AAQK;IADL,UAAU,EAAE;;;;yCAQZ;AAQK;IADL,UAAU,EAAE;;;;uCAQZ;AAQK;IADL,UAAU,EAAE;;;;uCAQZ;AAMK;IADL,UAAU,EAAE;;;;uCAOZ;AAMK;IADL,UAAU,EAAE;;;;uCAIZ;AAMK;IADL,UAAU,EAAE;;;;4CAIZ;AAMK;IADL,UAAU,EAAE;;;;wCAIZ;AAMK;IADL,UAAU,EAAE;;;;mCAIZ;AAMK;IADL,UAAU,EAAE;;;;2CAIZ;AAMK;IADL,UAAU,EAAE;;;;uCAIZ;AAMK;IADL,UAAU,EAAE;;;;sCAQZ;AAeD;IADC,UAAU,EAAE;;;;sCAGZ"} \ No newline at end of file diff --git a/src/clients/deno/schemas.d.ts b/src/clients/deno/schemas.d.ts deleted file mode 100644 index 6a61bea..0000000 --- a/src/clients/deno/schemas.d.ts +++ /dev/null @@ -1,227 +0,0 @@ -import { z } from "zod"; -/** - * Messages that are sent unbidden from the webview to the client. - */ -export type Notification = { - $type: "started"; - /** The version of the webview binary */ - version: string; -} | { - $type: "ipc"; - /** The message sent from the webview UI to the client. */ - message: string; -} | { - $type: "closed"; -}; -export type SizeWithScale = { - /** The height of the window in logical pixels. */ - height: number; - /** The ratio between physical and logical sizes. */ - scaleFactor: number; - /** The width of the window in logical pixels. */ - width: number; -}; -/** - * Types that can be returned from webview results. - */ -export type ResultType = { - $type: "string"; - value: string; -} | { - $type: "boolean"; - value: boolean; -} | { - $type: "float"; - value: number; -} | { - $type: "size"; - value: SizeWithScale; -}; -/** - * Responses from the webview to the client. - */ -export type Response = { - $type: "ack"; - id: number; -} | { - $type: "result"; - id: number; - result: ResultType; -} | { - $type: "err"; - id: number; - message: string; -}; -/** - * Complete definition of all outbound messages from the webview to the client. - */ -export type Message = { - $type: "notification"; - data: Notification; -} | { - $type: "response"; - data: Response; -}; -export declare const Notification: z.ZodType; -export declare const SizeWithScale: z.ZodType; -export declare const ResultType: z.ZodType; -export declare const Response: z.ZodType; -export declare const Message: z.ZodType; -/** - * The content to load into the webview. - */ -export type Content = { - /** Optional headers to send with the request. */ - headers?: Record; - /** Url to load in the webview. Note: Don't use data URLs here, as they are not supported. Use the `html` field instead. */ - url: string; -} | { - /** Html to load in the webview. */ - html: string; - /** What to set as the origin of the webview when loading html. */ - origin?: string; -}; -export type Size = { - /** The height of the window in logical pixels. */ - height: number; - /** The width of the window in logical pixels. */ - width: number; -}; -export type WindowSizeStates = "maximized" | "fullscreen"; -export type WindowSize = WindowSizeStates | Size; -/** - * Options for creating a webview. - */ -export type Options = { - /** Sets whether clicking an inactive window also clicks through to the webview. Default is false. */ - acceptFirstMouse?: boolean; - /** When true, all media can be played without user interaction. Default is false. */ - autoplay?: boolean; - /** - * Enables clipboard access for the page rendered on Linux and Windows. - * - * macOS doesn’t provide such method and is always enabled by default. But your app will still need to add menu item accelerators to use the clipboard shortcuts. - */ - clipboard?: boolean; - /** When true, the window will have a border, a title bar, etc. Default is true. */ - decorations?: boolean; - /** - * Enable or disable webview devtools. - * - * Note this only enables devtools to the webview. To open it, you can call `webview.open_devtools()`, or right click the page and open it from the context menu. - */ - devtools?: boolean; - /** Sets whether the webview should be focused when created. Default is false. */ - focused?: boolean; - /** - * Run the WebView with incognito mode. Note that WebContext will be ingored if incognito is enabled. - * - * Platform-specific: - Windows: Requires WebView2 Runtime version 101.0.1210.39 or higher, does nothing on older versions, see https://learn.microsoft.com/en-us/microsoft-edge/webview2/release-notes/archive?tabs=dotnetcsharp#10121039 - */ - incognito?: boolean; - /** Run JavaScript code when loading new pages. When the webview loads a new page, this code will be executed. It is guaranteed that the code is executed before window.onload. */ - initializationScript?: string; - /** Sets whether host should be able to receive messages from the webview via `window.ipc.postMessage`. */ - ipc?: boolean; - /** The content to load into the webview. */ - load?: Content; - /** The size of the window. */ - size?: WindowSize; - /** Sets the title of the window. */ - title: string; - /** Sets whether the window should be transparent. */ - transparent?: boolean; - /** Sets the user agent to use when loading pages. */ - userAgent?: string; -}; -export declare const Content: z.ZodType; -export declare const Size: z.ZodType; -export declare const WindowSizeStates: z.ZodType; -export declare const WindowSize: z.ZodType; -export declare const Options: z.ZodType; -/** - * Explicit requests from the client to the webview. - */ -export type Request = { - $type: "getVersion"; - /** The id of the request. */ - id: number; -} | { - $type: "eval"; - /** The id of the request. */ - id: number; - /** The javascript to evaluate. */ - js: string; -} | { - $type: "setTitle"; - /** The id of the request. */ - id: number; - /** The title to set. */ - title: string; -} | { - $type: "getTitle"; - /** The id of the request. */ - id: number; -} | { - $type: "setVisibility"; - /** The id of the request. */ - id: number; - /** Whether the window should be visible or hidden. */ - visible: boolean; -} | { - $type: "isVisible"; - /** The id of the request. */ - id: number; -} | { - $type: "openDevTools"; - /** The id of the request. */ - id: number; -} | { - $type: "getSize"; - /** The id of the request. */ - id: number; - /** Whether to include the title bar and borders in the size measurement. */ - include_decorations?: boolean; -} | { - $type: "setSize"; - /** The id of the request. */ - id: number; - /** The size to set. */ - size: Size; -} | { - $type: "fullscreen"; - /** Whether to enter fullscreen mode. If left unspecified, the window will enter fullscreen mode if it is not already in fullscreen mode or exit fullscreen mode if it is currently in fullscreen mode. */ - fullscreen?: boolean; - /** The id of the request. */ - id: number; -} | { - $type: "maximize"; - /** The id of the request. */ - id: number; - /** Whether to maximize the window. If left unspecified, the window will be maximized if it is not already maximized or restored if it was previously maximized. */ - maximized?: boolean; -} | { - $type: "minimize"; - /** The id of the request. */ - id: number; - /** Whether to minimize the window. If left unspecified, the window will be minimized if it is not already minimized or restored if it was previously minimized. */ - minimized?: boolean; -} | { - $type: "loadHtml"; - /** HTML to set as the content of the webview. */ - html: string; - /** The id of the request. */ - id: number; - /** What to set as the origin of the webview when loading html. If not specified, the origin will be set to the value of the `origin` field when the webview was created. */ - origin?: string; -} | { - $type: "loadUrl"; - /** Optional headers to send with the request. */ - headers?: Record; - /** The id of the request. */ - id: number; - /** URL to load in the webview. */ - url: string; -}; -export declare const Request: z.ZodType; -//# sourceMappingURL=schemas.d.ts.map \ No newline at end of file diff --git a/src/clients/deno/schemas.d.ts.map b/src/clients/deno/schemas.d.ts.map deleted file mode 100644 index d7fe611..0000000 --- a/src/clients/deno/schemas.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["schemas.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB;IACA,KAAK,EAAE,SAAS,CAAC;IACjB,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;CACjB,GACC;IACA,KAAK,EAAE,KAAK,CAAC;IACb,0DAA0D;IAC1D,OAAO,EAAE,MAAM,CAAC;CACjB,GACC;IACA,KAAK,EAAE,QAAQ,CAAC;CACjB,CAAC;AAEJ,MAAM,MAAM,aAAa,GAAG;IAC1B,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,WAAW,EAAE,MAAM,CAAC;IACpB,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB;IACA,KAAK,EAAE,QAAQ,CAAC;IAEhB,KAAK,EAAE,MAAM,CAAC;CACf,GACC;IACA,KAAK,EAAE,SAAS,CAAC;IAEjB,KA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uB;IACvB,IAAI,EAAE,IAAI,CAAC;CACZ,GACC;IACA,KAAK,EAAE,YAAY,CAAC;IACpB,0MAA0M;IAC1M,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;CACZ,GACC;IACA,KAAK,EAAE,UAAU,CAAC;IAClB,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,mKAAmK;IACnK,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GACC;IACA,KAAK,EAAE,UAAU,CAAC;IAClB,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,mKAAmK;IACnK,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GACC;IACA,KAAK,EAAE,UAAU,CAAC;IAClB,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,4KAA4K;IAC5K,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACC;IACA,KAAK,EAAE,SAAS,CAAC;IACjB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,kCAAkC;IAClC,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEJ,eAAO,MAAM,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAiDrC,CAAC"} \ No newline at end of file diff --git a/src/clients/deno/schemas.js b/src/clients/deno/schemas.js deleted file mode 100644 index 0b38737..0000000 --- a/src/clients/deno/schemas.js +++ /dev/null @@ -1,121 +0,0 @@ -// DO NOT EDIT: This file is auto-generated by generate-schema/index.ts -import { z } from "zod"; -export const Notification = z.discriminatedUnion("$type", [ - z.object({ $type: z.literal("started"), version: z.string() }), - z.object({ $type: z.literal("ipc"), message: z.string() }), - z.object({ $type: z.literal("closed") }), -]); -export const SizeWithScale = z.object({ - height: z.number(), - scaleFactor: z.number(), - width: z.number(), -}); -export const ResultType = z.discriminatedUnion("$type", [ - z.object({ $type: z.literal("string"), value: z.string() }), - z.object({ $type: z.literal("boolean"), value: z.boolean() }), - z.object({ $type: z.literal("float"), value: z.number() }), - z.object({ $type: z.literal("size"), value: SizeWithScale }), -]); -export const Response = z.discriminatedUnion("$type", [ - z.object({ $type: z.literal("ack"), id: z.number().int() }), - z.object({ - $type: z.literal("result"), - id: z.number().int(), - result: ResultType, - }), - z.object({ - $type: z.literal("err"), - id: z.number().int(), - message: z.string(), - }), -]); -export const Message = z.discriminatedUnion("$type", [ - z.object({ $type: z.literal("notification"), data: Notification }), - z.object({ $type: z.literal("response"), data: Response }), -]); -export const Content = z.union([ - z.object({ - headers: z.record(z.string(), z.string()).optional(), - url: z.string(), - }), - z.object({ html: z.string(), origin: z.string() }), -]); -export const Size = z.object({ - height: z.number(), - width: z.number(), -}); -export const WindowSizeStates = z.enum([ - "maximized", - "fullscreen", -]); -export const WindowSize = z.union([ - WindowSizeStates, - Size, -]); -export const Options = z.object({ - acceptFirstMouse: z.boolean().optional(), - autoplay: z.boolean().optional(), - clipboard: z.boolean().optional(), - decorations: z.boolean().optional(), - devtools: z.boolean().optional(), - focused: z.boolean().optional(), - incognito: z.boolean().optional(), - initializationScript: z.string(), - ipc: z.boolean().optional(), - load: Content.optional(), - size: WindowSize.optional(), - title: z.string(), - transparent: z.boolean().optional(), - userAgent: z.string(), -}); -export const Request = z.discriminatedUnion("$type", [ - z.object({ $type: z.literal("getVersion"), id: z.number().int() }), - z.object({ $type: z.literal("eval"), id: z.number().int(), js: z.string() }), - z.object({ - $type: z.literal("setTitle"), - id: z.number().int(), - title: z.string(), - }), - z.object({ $type: z.literal("getTitle"), id: z.number().int() }), - z.object({ - $type: z.literal("setVisibility"), - id: z.number().int(), - visible: z.boolean(), - }), - z.object({ $type: z.literal("isVisible"), id: z.number().int() }), - z.object({ $type: z.literal("openDevTools"), id: z.number().int() }), - z.object({ - $type: z.literal("getSize"), - id: z.number().int(), - include_decorations: z.boolean().optional(), - }), - z.object({ $type: z.literal("setSize"), id: z.number().int(), size: Size }), - z.object({ - $type: z.literal("fullscreen"), - fullscreen: z.boolean().optional(), - id: z.number().int(), - }), - z.object({ - $type: z.literal("maximize"), - id: z.number().int(), - maximized: z.boolean().optional(), - }), - z.object({ - $type: z.literal("minimize"), - id: z.number().int(), - minimized: z.boolean().optional(), - }), - z.object({ - $type: z.literal("loadHtml"), - html: z.string(), - id: z.number().int(), - origin: z.string().optional(), - }), - z.object({ - $type: z.literal("loadUrl"), - headers: z.record(z.string(), z.string()).optional(), - id: z.number().int(), - url: z.string(), - }), -]); -//# sourceMappingURL=schemas.js.map \ No newline at end of file diff --git a/src/clients/deno/schemas.js.map b/src/clients/deno/schemas.js.map deleted file mode 100644 index b35fd0f..0000000 --- a/src/clients/deno/schemas.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"schemas.js","sourceRoot":"","sources":["schemas.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA6FxB,MAAM,CAAC,MAAM,YAAY,GAA4B,CAAC,CAAC,kBAAkB,CACvE,OAAO,EACP;IACE,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;IAC9D,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;IAC1D,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;CACzC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAA6B,CAAC,CAAC,MAAM,CAAC;IAC9D,M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