diff --git a/CHANGELOG.md b/CHANGELOG.md index d3236a9..f0b004f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,8 @@ All notable changes to this project will be documented in this file. -The format is based on [Keep a Changelog], -and this project adheres to [Semantic Versioning]. +The format is based on [Keep a Changelog], and this project adheres to +[Semantic Versioning]. ## [0.1.1] - 2021-01-29 diff --git a/Cargo.lock b/Cargo.lock index f6c1e5b..c48493c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,7 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. +version = 3 + [[package]] name = "ab_glyph_rasterizer" version = "0.1.4" @@ -21,9 +23,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.34" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf8dcb5b4bbaa28653b647d8c77bd4ed40183b48882e130c1f1ffb73de069fd7" +checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1" [[package]] name = "arrayvec" @@ -304,9 +306,9 @@ dependencies = [ [[package]] name = "deno_core" -version = "0.75.0" +version = "0.79.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "641f6d420124c623497c29261164cd1bba4b3da98a6a4dc40ac593eb0f380a2b" +checksum = "c85eb8c4c28f1d8a3edbd21277fb74a36ed590f3fd2ca642dac822ef6b0adad7" dependencies = [ "anyhow", "futures", @@ -423,9 +425,9 @@ checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" [[package]] name = "futures" -version = "0.3.8" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b3b0c040a1fe6529d30b3c5944b280c7f0dcb2930d2c3062bca967b602583d0" +checksum = "da9052a1a50244d8d5aa9bf55cbc2fb6f357c86cc52e46c62ed390a7180cf150" dependencies = [ "futures-channel", "futures-core", @@ -438,9 +440,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.8" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b7109687aa4e177ef6fe84553af6280ef2778bdb7783ba44c9dc3399110fe64" +checksum = "f2d31b7ec7efab6eefc7c57233bb10b847986139d88cc2f5a02a1ae6871a1846" dependencies = [ "futures-core", "futures-sink", @@ -448,15 +450,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.8" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "847ce131b72ffb13b6109a221da9ad97a64cbe48feb1028356b836b47b8f1748" +checksum = "79e5145dde8da7d1b3892dad07a9c98fc04bc39892b1ecc9692cf53e2b780a65" [[package]] name = "futures-executor" -version = "0.3.8" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4caa2b2b68b880003057c1dd49f1ed937e38f22fcf6c212188a121f08cf40a65" +checksum = "e9e59fdc009a4b3096bf94f740a0f2424c082521f20a9b08c5c07c48d90fd9b9" dependencies = [ "futures-core", "futures-task", @@ -465,15 +467,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.8" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611834ce18aaa1bd13c4b374f5d653e1027cf99b6b502584ff8c9a64413b30bb" +checksum = "28be053525281ad8259d47e4de5de657b25e7bac113458555bb4b70bc6870500" [[package]] name = "futures-macro" -version = "0.3.8" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77408a692f1f97bcc61dc001d752e00643408fbc922e4d634c655df50d595556" +checksum = "c287d25add322d9f9abdcdc5927ca398917996600182178774032e9f8258fedd" dependencies = [ "proc-macro-hack", "proc-macro2", @@ -483,24 +485,24 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.8" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f878195a49cee50e006b02b93cf7e0a95a38ac7b776b4c4d9cc1207cd20fcb3d" +checksum = "caf5c69029bda2e743fddd0582d1083951d65cc9539aebf8812f36c3491342d6" [[package]] name = "futures-task" -version = "0.3.8" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c554eb5bf48b2426c4771ab68c6b14468b6e76cc90996f528c3338d761a4d0d" +checksum = "13de07eb8ea81ae445aca7b69f5f7bf15d7bf4912d8ca37d6645c77ae8a58d86" dependencies = [ "once_cell", ] [[package]] name = "futures-util" -version = "0.3.8" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d304cff4a7b99cfb7986f7d43fbe93d175e72e704a8860787cc95e9ffd85cbd2" +checksum = "632a8cd0f2a4b3fdea1657f08bde063848c3bd00f9bbf6e256b8be78802e624b" dependencies = [ "futures-channel", "futures-core", @@ -509,7 +511,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project", + "pin-project-lite", "pin-utils", "proc-macro-hack", "proc-macro-nested", @@ -696,9 +698,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" +checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b" dependencies = [ "autocfg", "hashbrown", @@ -782,9 +784,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.80" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614" +checksum = "ba4aede83fc3617411dc6993bc8c70919750c1c257c6ca6a502aed6e0e2394ae" [[package]] name = "libloading" @@ -807,11 +809,11 @@ dependencies = [ [[package]] name = "log" -version = "0.4.11" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", ] [[package]] @@ -1067,7 +1069,7 @@ dependencies = [ [[package]] name = "pane" -version = "0.1.0" +version = "0.1.2" dependencies = [ "deno_core", "deno_json_op", @@ -1111,18 +1113,18 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" [[package]] name = "pin-project" -version = "1.0.2" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ccc2237c2c489783abd8c4c80e5450fc0e98644555b1364da68cc29aa151ca7" +checksum = "96fa8ebb90271c4477f144354485b8068bd8f6b78b428b01ba892ca26caf0b63" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.2" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8e8d2bf0b23038a4424865103a4df472855692821aab4e4f5c3312d461d9e5f" +checksum = "758669ae3558c6f74bd2a18b41f7ac0b5a195aea6639d6a9b5e5d1ad5ba24c0b" dependencies = [ "proc-macro2", "quote", @@ -1131,9 +1133,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.0" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b063f57ec186e6140e2b8b6921e5f1bd89c7356dda5b33acc5401203ca6131c" +checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827" [[package]] name = "pin-utils" @@ -1238,9 +1240,9 @@ dependencies = [ [[package]] name = "rusty_v8" -version = "0.15.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "901a9566b56ddfd49c504fdce35f27d8a6b29088facfd480ab79e95de3f836a1" +checksum = "e4cacd73b88c22512f09c5ec78e56eb89d95e4dc1201fe52bd6c81824b5e041b" dependencies = [ "bitflags", "cargo_gn", @@ -1279,18 +1281,18 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "serde" -version = "1.0.117" +version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b88fa983de7720629c9387e9f517353ed404164b1e482c970a90c1a4aaf7dc1a" +checksum = "bd761ff957cb2a45fbb9ab3da6512de9de55872866160b23c25f1a841e99d29f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.117" +version = "1.0.124" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e" +checksum = "1800f7693e94e186f5e25a28291ae1570da908aff7d97a095dec1e56ff99069b" dependencies = [ "proc-macro2", "quote", @@ -1299,9 +1301,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.59" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95" +checksum = "799e97dc9fdae36a5c8b8f2cae9ce2ee9fdce2058c57a93e6099d919fd982f79" dependencies = [ "indexmap", "itoa", @@ -1326,9 +1328,9 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" [[package]] name = "smallvec" -version = "1.4.2" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" +checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" [[package]] name = "smithay-client-toolkit" @@ -1388,9 +1390,9 @@ checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" [[package]] name = "syn" -version = "1.0.48" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" +checksum = "3fd9d1e9976102a03c542daa2eff1b43f9d72306342f3f8b3ed5fb8908195d6f" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 7e9a704..7fdc7b6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pane" -version = "0.1.1" +version = "0.1.2" authors = ["Elias Sjögreen"] edition = "2018" @@ -8,7 +8,7 @@ edition = "2018" crate-type = ["cdylib"] [dependencies] -deno_core = "0.77.0" +deno_core = "0.79.0" deno_json_op = "0.1.1" winit = { version = "0.24.0", features = ["serde"] } serde = { version = "1.0", features = ["derive"] } diff --git a/README.md b/README.md index 9ecfe48..c47ef96 100644 --- a/README.md +++ b/README.md @@ -1,127 +1,131 @@ -# pane - -[![Tags](https://img.shields.io/github/release/denosaurs/pane)](https://github.com/denosaurs/pane/releases) -[![Rust](https://img.shields.io/github/workflow/status/denosaurs/pane/rust)](https://github.com/denosaurs/pane/actions) -[![Deno](https://img.shields.io/github/workflow/status/denosaurs/pane/deno)](https://github.com/denosaurs/pane/actions) -[![Release](https://img.shields.io/github/workflow/status/denosaurs/pane/release)](https://github.com/denosaurs/pane/actions) -[![License](https://img.shields.io/github/license/denosaurs/pane)](https://github.com/denosaurs/pane/blob/master/LICENSE) - ---- -> ⚠️ Work in progress. Expect breaking changes. ---- - -Pane provides bindings for rust crate [winit](https://github.com/rust-windowing/winit) -in preparation for [webgpu](https://github.com/denoland/deno/pull/7977) -integration in deno. This module will provide a way of getting a [`raw_window_handle` -resource](https://github.com/denoland/deno/issues/7863#issuecomment-706897139) to -provide to deno and interaction with the window. Currently pane also provides bindings -to [pixels](https://github.com/parasyte/pixels) as a way of drawing framebuffers onto -the window. - -## Example - -### Draw random pixels to window - -```typescript -import { Pane } from "https://deno.land/x/pane/mod.ts"; - -const width = 320; -const height = 240; - -const pane = new Pane(width, height); - -pane.setInnerSize({ logical: { width: width * 2, height: height * 2 } }); -pane.setMinInnerSize({ logical: { width: width * 2, height: height * 2 } }); -pane.setMaxInnerSize({ logical: { width: width * 2, height: height * 2 } }); - -setInterval(() => { - for (const event of Pane.Step()) { - switch (event.type) { - case "windowEvent": - switch (event.value.event.type) { - case "closeRequested": - Deno.exit(); - break; - case "resized": - pane.resizeFrame( - event.value.event.value.width, - event.value.event.value.height, - ); - break; - } - break; - - case "redrawRequested": - pane.drawFrame( - new Uint8Array(width * height * 4).fill(0).map((_) => - Math.floor(Math.random() * 255) - ), - ); - pane.renderFrame(); - pane.requestRedraw(); - break; - } - } -}, 1000 / 30); -``` - -### Multiple windows - -```typescript -import { Pane } from "https://deno.land/x/pane/mod.ts"; -import { serialize } from "https://deno.land/x/pane/helpers.ts"; - -const window1 = new Pane(); -const window2 = new Pane(); - -setInterval(() => { - for (const event of Pane.Step()) { - switch (event.type) { - case "windowEvent": - console.log(serialize(event, 2)); - if (event.value.event.type === "closeRequested") { - Deno.exit(); - } - - if (event.value.event.type === "cursorEntered") { - if (event.value.windowId === window1.id) { - window1.setCursorIcon("hand"); - } else { - window2.setCursorIcon("crosshair"); - } - } - break; - } - } -}, 1000 / 30); -``` - -## Maintainers - -- Elias Sjögreen ([@eliassjogreen](https://github.com/eliassjogreen)) - -## Permission Table - -| Permission Needed | Required | Reason | -| ----------------- | -------- | ------------------------------------- | -| `--allow-env` | yes | For development variables. | -| `--allow-net` | yes | For getting the prebuild binaries. | -| `--allow-read` | yes | For reading the library. | -| `--allow-plugin` | yes | It's a plugin, what do you expect. | -| `--unstable` | yes | It's unstable because it is a plugin. | - -## Other - -### Related - -- [pixels](https://github.com/parasyte/pixels) -- [winit](https://github.com/rust-windowing/winit) -- [deno_json_op](https://github.com/denosaurs/deno_json_op) - -### Contribution - -Pull request, issues and feedback are very welcome. Code style is formatted with `deno fmt` and commit messages are done following Conventional Commits spec. - -### Licence - -Copyright 2020-present, the denosaurs team. All rights reserved. MIT license. \ No newline at end of file +# pane + +[![Tags](https://img.shields.io/github/release/denosaurs/pane)](https://github.com/denosaurs/pane/releases) +[![Rust](https://img.shields.io/github/workflow/status/denosaurs/pane/rust)](https://github.com/denosaurs/pane/actions) +[![Deno](https://img.shields.io/github/workflow/status/denosaurs/pane/deno)](https://github.com/denosaurs/pane/actions) +[![Release](https://img.shields.io/github/workflow/status/denosaurs/pane/release)](https://github.com/denosaurs/pane/actions) +[![License](https://img.shields.io/github/license/denosaurs/pane)](https://github.com/denosaurs/pane/blob/master/LICENSE) + +--- + +> ⚠️ Work in progress. Expect breaking changes. + +--- + +Pane provides bindings for rust crate +[winit](https://github.com/rust-windowing/winit) in preparation for +[webgpu](https://github.com/denoland/deno/pull/7977) integration in deno. This +module will provide a way of getting a +[`raw_window_handle` resource](https://github.com/denoland/deno/issues/7863#issuecomment-706897139) +to provide to deno and interaction with the window. Currently pane also provides +bindings to [pixels](https://github.com/parasyte/pixels) as a way of drawing +framebuffers onto the window. + +## Example + +### Draw random pixels to window + +```typescript +import { Pane } from "https://deno.land/x/pane/mod.ts"; + +const width = 320; +const height = 240; + +const pane = new Pane(width, height); + +pane.setInnerSize({ logical: { width: width * 2, height: height * 2 } }); +pane.setMinInnerSize({ logical: { width: width * 2, height: height * 2 } }); +pane.setMaxInnerSize({ logical: { width: width * 2, height: height * 2 } }); + +setInterval(() => { + for (const event of Pane.Step()) { + switch (event.type) { + case "windowEvent": + switch (event.value.event.type) { + case "closeRequested": + Deno.exit(); + break; + case "resized": + pane.resizeFrame( + event.value.event.value.width, + event.value.event.value.height, + ); + break; + } + break; + + case "redrawRequested": + pane.drawFrame( + new Uint8Array(width * height * 4).fill(0).map((_) => + Math.floor(Math.random() * 255) + ), + ); + pane.renderFrame(); + pane.requestRedraw(); + break; + } + } +}, 1000 / 30); +``` + +### Multiple windows + +```typescript +import { Pane } from "https://deno.land/x/pane/mod.ts"; +import { serialize } from "https://deno.land/x/pane/helpers.ts"; + +const window1 = new Pane(); +const window2 = new Pane(); + +setInterval(() => { + for (const event of Pane.Step()) { + switch (event.type) { + case "windowEvent": + console.log(serialize(event, 2)); + if (event.value.event.type === "closeRequested") { + Deno.exit(); + } + + if (event.value.event.type === "cursorEntered") { + if (event.value.windowId === window1.id) { + window1.setCursorIcon("hand"); + } else { + window2.setCursorIcon("crosshair"); + } + } + break; + } + } +}, 1000 / 30); +``` + +## Maintainers + +- Elias Sjögreen ([@eliassjogreen](https://github.com/eliassjogreen)) + +## Permission Table + +| Permission Needed | Required | Reason | +| ----------------- | -------- | ------------------------------------- | +| `--allow-env` | yes | For development variables. | +| `--allow-net` | yes | For getting the prebuild binaries. | +| `--allow-read` | yes | For reading the library. | +| `--allow-plugin` | yes | It's a plugin, what do you expect. | +| `--unstable` | yes | It's unstable because it is a plugin. | + +## Other + +### Related + +- [pixels](https://github.com/parasyte/pixels) +- [winit](https://github.com/rust-windowing/winit) +- [deno_json_op](https://github.com/denosaurs/deno_json_op) + +### Contribution + +Pull request, issues and feedback are very welcome. Code style is formatted with +`deno fmt` and commit messages are done following Conventional Commits spec. + +### Licence + +Copyright 2020-present, the denosaurs team. All rights reserved. MIT license. diff --git a/deps.ts b/deps.ts index f5606ae..9de010e 100644 --- a/deps.ts +++ b/deps.ts @@ -1 +1 @@ -export { Plug } from "https://deno.land/x/plug@0.2.9/mod.ts"; +export { Plug } from "https://deno.land/x/plug@0.2.10/mod.ts";