diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..dda0e4a --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,43 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 30 + # Node (jco host + tests) and a recent glibc (the moon toolchain is dynamically linked). + container: node:20-bookworm + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install MoonBit + run: | + curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash + echo "$HOME/.moon/bin" >> "$GITHUB_PATH" + + - name: Install wasm-tools, wit-bindgen, wasmtime + run: scripts/setup-toolchain.sh + + - name: Install host dependencies (jco) + run: cd host && npm ci + + - name: Versions + run: | + export PATH="$HOME/.moon/bin:$PWD/.tools/bin:$PATH" + moon version; wasm-tools --version; wit-bindgen --version; wasmtime --version + node --version; host/node_modules/.bin/jco --version + + - name: Verify (bindings fresh, moon check/test, build, conformance, host tests) + run: | + export PATH="$HOME/.moon/bin:$PWD/.tools/bin:$PATH" + scripts/test.sh + + - name: Headless render of the composed desktop + run: | + node host/src/cli.mjs --time 2026-11-24T14:07:00 --click-launcher | tail -n 45 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ce72216 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +_build/ +build/ +.tools/ +node_modules/ +.context/ +.mooncakes/ +*.log diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 47f03f6..43d2a78 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,90 @@ # moon-plasma -A modular KDE Plasma-like desktop shell in MoonBit where every part is a WebAssembly component \ No newline at end of file +A modular, KDE-Plasma-inspired desktop environment where **every part is a +WebAssembly component** (Component Model, WIT interfaces) written in +[MoonBit](https://www.moonbitlang.com), on top of a deliberately tiny trusted host. + +![launcher open](docs/screenshots/m0-2-launcher-open.png) + +*Headless-Chromium capture of the M0 browser host: the shell, the launcher and the clock +are three separate MoonBit components.* + +## Vision + +Plasma's strength is its decomposition (shell, widgets, window manager, runner, +settings modules, notifications, tray). moon-plasma keeps that decomposition and +makes each seam a **typed WIT interface** with **deny-by-default capabilities**: + +* the **host** only owns engine/lifecycle, devices, the capability broker and the + render-list rasteriser; +* **everything else is a component**: swap the clock for another implementation, + swap the whole shell, change the theme, without rebuilding the rest; +* components draw by returning a **render-list** (`list`), never pixels; +* components can't touch anything their imports + the desktop config don't grant. + +Read [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) (Plasma→component mapping, host +decision, rendering, input, permissions, versioning, roadmap M0–M8) and +[docs/TOOLCHAIN.md](docs/TOOLCHAIN.md) (what works today, exact versions). + +## Status: M0 (proof of concept) + +Works today: + +* WIT package `moonplasma:desktop@0.1.0` (`wit/`): worlds `widget`, `clock-widget`, + `launcher-widget`, `panel`, `shell`. +* Four MoonBit components, each an independently built `.wasm` component of 24–33 KB: + `clock-digital`, `clock-binary` (drop-in replacement), `launcher` (kickoff-like with + keyboard search), `shell` (desktop background + bottom panel layout + theme tokens). +* Host (`host/`): Node + browser, jco-transpiled components, capability grants, + popup/focus input routing, hot-swap, fault isolation, Canvas2D + ASCII renderers. +* Tests: 16 MoonBit unit tests (pure logic), 13 host integration tests that + instantiate the real components, WIT conformance (`wasm-tools component targets`), + generated-bindings freshness check, `wasmtime compile` of every component. + +Stubbed / not done (see ARCHITECTURE §10): no window manager/compositor, search runner, +notifications, settings, tray, session, shortcuts, clipboard, files; `launch` only logs; +host does input hit-testing; fixed-advance text metrics, no real fonts/icons; native +wasmtime host is M3; no CPU/fuel limits under jco. + +## Quickstart + +Requirements: Linux x86_64, Node ≥ 20, [MoonBit](https://www.moonbitlang.com/download). + +```bash +export PATH="$HOME/.moon/bin:$PATH" +scripts/setup-toolchain.sh # wasm-tools, wit-bindgen, wasmtime -> ./.tools (no root) +(cd host && npm ci) # jco +scripts/build.sh # MoonBit -> components -> build/components, build/jco +scripts/test.sh # everything CI runs + +node host/src/cli.mjs --time 2026-11-24T14:07:00 --click-launcher # terminal render +node host/serve.mjs 8080 # browser host: http://127.0.0.1:8080/ +node host/serve.mjs & # then try ?config=desktop.binary-clock.json or ?theme=moon-day +``` + +Swap the clock **without rebuilding anything else**: + +```bash +node host/src/cli.mjs --config config/desktop.binary-clock.json +scripts/build.sh clock-binary # builds just that component +# in the browser console: await moonPlasma.swap('clock', 'clock-binary') +``` + +Screenshots: see the end of [docs/TOOLCHAIN.md](docs/TOOLCHAIN.md). + +## Layout + +``` +wit/ the WIT package (host-agnostic API) +interface/ world/ generated shared MoonBit bindings (wit-bindgen; committed) +components//gen/ generated export bindings + hand-written thin stub.mbt +lib/ pure, unit-tested logic (ui helpers, panel layout, launcher state machine, ...) +host/ JS host: src/desktop.mjs (core), loaders, renderers, tests, web/ (browser) +config/ desktop configs (grants!), themes, static app list +scripts/ setup-toolchain, gen-bindings, build, test, screenshot +docs/ ARCHITECTURE, TOOLCHAIN, screenshots +``` + +## License + +Apache-2.0 (see LICENSE). diff --git a/components/clock-binary/gen/ffi.mbt b/components/clock-binary/gen/ffi.mbt new file mode 100644 index 0000000..110f40c --- /dev/null +++ b/components/clock-binary/gen/ffi.mbt @@ -0,0 +1,82 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + +///| +pub fn mbt_ffi_cabi_realloc( +src_offset : Int, +src_size : Int, +_dst_alignment : Int, +dst_size : Int, +) -> Int { + // malloc + if src_offset == 0 && src_size == 0 { + return mbt_ffi_malloc(dst_size) + } + // free + if dst_size == 0 { + mbt_ffi_free(src_offset) + return 0 + } + // realloc + let dst = mbt_ffi_malloc(dst_size) + mbt_ffi_copy(dst, src_offset, if src_size < dst_size { src_size } else { dst_size }) + mbt_ffi_free(src_offset) + dst +} + +///| +extern "wasm" fn mbt_ffi_copy(dest : Int, src : Int, len : Int) = +#|(func (param i32) (param i32) (param i32) local.get 0 local.get 1 local.get 2 memory.copy) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = +#|(func (param i32) (result i32) (local i32) +#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc +#| local.tee 1 i32.const 0 call $moonbit.init_array8 +#| local.get 1) + +///| +extern "wasm" fn mbt_ffi_free(position : Int) = +#|(func (param i32) local.get 0 call $moonbit.decref) + +///| +#doc(hidden) +pub fn wasmExportInfo() -> Int { + @plasmoid.wasmExportInfo() +} + +///| +#doc(hidden) +pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int { + @plasmoid.wasmExportRender(p0, p1) +} + +///| +#doc(hidden) +pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit { + @plasmoid.wasmExportInfoPostReturn(p0) +} + +///| +#doc(hidden) +pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit { + @plasmoid.wasmExportRenderPostReturn(p0) +} + +///| +#doc(hidden) +pub fn wasmExportPopup() -> Int { + @plasmoid.wasmExportPopup() +} + +///| +#doc(hidden) +pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit { + @plasmoid.wasmExportPopupPostReturn(p0) +} + +///| +#doc(hidden) +pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int { + @plasmoid.wasmExportOnEvent(p0, p1, p2, p3) +} + diff --git a/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid/README.md b/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid/README.md new file mode 100644 index 0000000..53ecf69 --- /dev/null +++ b/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid/README.md @@ -0,0 +1 @@ +The widget (plasmoid) contract. \ No newline at end of file diff --git a/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid/ffi.mbt b/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid/ffi.mbt new file mode 100644 index 0000000..006f31f --- /dev/null +++ b/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid/ffi.mbt @@ -0,0 +1,409 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + +///| +#doc(hidden) +pub fn wasmExportInfo() -> Int { + + let (result) : (PlasmoidInfo) = info(); + let return_area = mbt_ffi_malloc(32) + + let ptr = mbt_ffi_str2ptr((result).id) + mbt_ffi_store32((return_area) + 4, (result).id.length()) + mbt_ffi_store32((return_area) + 0, ptr) + + let ptr0 = mbt_ffi_str2ptr((result).name) + mbt_ffi_store32((return_area) + 12, (result).name.length()) + mbt_ffi_store32((return_area) + 8, ptr0) + mbt_ffi_store32((return_area) + 16, (((result).preferred).w).reinterpret_as_int()) + mbt_ffi_store32((return_area) + 20, (((result).preferred).h).reinterpret_as_int()) + mbt_ffi_store32((return_area) + 24, ((result).min_width).reinterpret_as_int()) + mbt_ffi_store8((return_area) + 28, (if (result).stretch { 1 } else { 0 })) + let ret = return_area + return ret + +} + +///| +#doc(hidden) +pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit { + mbt_ffi_free(mbt_ffi_load32((p0) + 0)) + mbt_ffi_free(mbt_ffi_load32((p0) + 8)) + +} + +///| +#doc(hidden) +pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int { + + let (result) : (Array[@types.DrawOp]) = render(@types.Size::{w : (p0).reinterpret_as_uint(), h : (p1).reinterpret_as_uint()}); + let return_area = mbt_ffi_malloc(8) + + let address = mbt_ffi_malloc((result).length() * 32); + for index = 0; index < (result).length(); index = index + 1 { + let iter_elem : @types.DrawOp = (result)[(index)] + let iter_base = address + (index * 32); + + match iter_elem { + FillRect(payload) => { + mbt_ffi_store8((iter_base) + 0, (0)) + mbt_ffi_store32((iter_base) + 4, ((payload).rect).x) + mbt_ffi_store32((iter_base) + 8, ((payload).rect).y) + mbt_ffi_store32((iter_base) + 12, (((payload).rect).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, (((payload).rect).h).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 20, (((payload).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload).radius).reinterpret_as_int()) + + () + } + StrokeRect(payload0) => { + mbt_ffi_store8((iter_base) + 0, (1)) + mbt_ffi_store32((iter_base) + 4, ((payload0).rect).x) + mbt_ffi_store32((iter_base) + 8, ((payload0).rect).y) + mbt_ffi_store32((iter_base) + 12, (((payload0).rect).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, (((payload0).rect).h).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 20, (((payload0).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload0).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload0).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload0).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload0).width).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 28, ((payload0).radius).reinterpret_as_int()) + + () + } + Line(payload1) => { + mbt_ffi_store8((iter_base) + 0, (2)) + mbt_ffi_store32((iter_base) + 4, ((payload1).start).x) + mbt_ffi_store32((iter_base) + 8, ((payload1).start).y) + mbt_ffi_store32((iter_base) + 12, ((payload1).end).x) + mbt_ffi_store32((iter_base) + 16, ((payload1).end).y) + mbt_ffi_store8((iter_base) + 20, (((payload1).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload1).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload1).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload1).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload1).width).reinterpret_as_int()) + + () + } + Circle(payload2) => { + mbt_ffi_store8((iter_base) + 0, (3)) + mbt_ffi_store32((iter_base) + 4, ((payload2).center).x) + mbt_ffi_store32((iter_base) + 8, ((payload2).center).y) + mbt_ffi_store32((iter_base) + 12, ((payload2).radius).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 16, (((payload2).color).r).to_int()) + mbt_ffi_store8((iter_base) + 17, (((payload2).color).g).to_int()) + mbt_ffi_store8((iter_base) + 18, (((payload2).color).b).to_int()) + mbt_ffi_store8((iter_base) + 19, (((payload2).color).a).to_int()) + mbt_ffi_store8((iter_base) + 20, (if (payload2).filled { 1 } else { 0 })) + + () + } + Text(payload3) => { + mbt_ffi_store8((iter_base) + 0, (4)) + mbt_ffi_store32((iter_base) + 4, ((payload3).origin).x) + mbt_ffi_store32((iter_base) + 8, ((payload3).origin).y) + + let ptr = mbt_ffi_str2ptr((payload3).text) + mbt_ffi_store32((iter_base) + 16, (payload3).text.length()) + mbt_ffi_store32((iter_base) + 12, ptr) + mbt_ffi_store32((iter_base) + 20, (((payload3).style).size).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 24, ((((payload3).style).color).r).to_int()) + mbt_ffi_store8((iter_base) + 25, ((((payload3).style).color).g).to_int()) + mbt_ffi_store8((iter_base) + 26, ((((payload3).style).color).b).to_int()) + mbt_ffi_store8((iter_base) + 27, ((((payload3).style).color).a).to_int()) + mbt_ffi_store8((iter_base) + 28, ((payload3).style).align.ordinal()) + mbt_ffi_store8((iter_base) + 29, (if ((payload3).style).bold { 1 } else { 0 })) + + () + } + PushClip(payload4) => { + mbt_ffi_store8((iter_base) + 0, (5)) + mbt_ffi_store32((iter_base) + 4, (payload4).x) + mbt_ffi_store32((iter_base) + 8, (payload4).y) + mbt_ffi_store32((iter_base) + 12, ((payload4).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, ((payload4).h).reinterpret_as_int()) + + () + } + PopClip => { + mbt_ffi_store8((iter_base) + 0, (6)) + + () + } + } + + } + mbt_ffi_store32((return_area) + 4, (result).length()) + mbt_ffi_store32((return_area) + 0, address) + let ret = return_area + return ret + +} + +///| +#doc(hidden) +pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit { + + for index = 0; index < (mbt_ffi_load32((p0) + 4)); index = index + 1 { + let iter_base = (mbt_ffi_load32((p0) + 0)) + (index * 32) + + match (mbt_ffi_load8_u((iter_base) + 0)) { + 0 => () + 1 => () + 2 => () + 3 => () + 4 => { + mbt_ffi_free(mbt_ffi_load32((iter_base) + 12)) + + } + 5 => () + 6 => () + _ => panic() + } + + } + mbt_ffi_free(mbt_ffi_load32((p0) + 0)) + +} + +///| +#doc(hidden) +pub fn wasmExportPopup() -> Int { + + let (result) : (PopupSurface?) = popup(); + let return_area = mbt_ffi_malloc(20) + + match (result) { + None => { + mbt_ffi_store8((return_area) + 0, (0)) + + () + } + Some(payload0) => { + mbt_ffi_store8((return_area) + 0, (1)) + mbt_ffi_store32((return_area) + 4, (((payload0).size).w).reinterpret_as_int()) + mbt_ffi_store32((return_area) + 8, (((payload0).size).h).reinterpret_as_int()) + + let address = mbt_ffi_malloc(((payload0).ops).length() * 32); + for index = 0; index < ((payload0).ops).length(); index = index + 1 { + let iter_elem : @types.DrawOp = ((payload0).ops)[(index)] + let iter_base = address + (index * 32); + + match iter_elem { + FillRect(payload1) => { + mbt_ffi_store8((iter_base) + 0, (0)) + mbt_ffi_store32((iter_base) + 4, ((payload1).rect).x) + mbt_ffi_store32((iter_base) + 8, ((payload1).rect).y) + mbt_ffi_store32((iter_base) + 12, (((payload1).rect).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, (((payload1).rect).h).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 20, (((payload1).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload1).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload1).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload1).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload1).radius).reinterpret_as_int()) + + () + } + StrokeRect(payload2) => { + mbt_ffi_store8((iter_base) + 0, (1)) + mbt_ffi_store32((iter_base) + 4, ((payload2).rect).x) + mbt_ffi_store32((iter_base) + 8, ((payload2).rect).y) + mbt_ffi_store32((iter_base) + 12, (((payload2).rect).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, (((payload2).rect).h).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 20, (((payload2).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload2).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload2).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload2).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload2).width).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 28, ((payload2).radius).reinterpret_as_int()) + + () + } + Line(payload3) => { + mbt_ffi_store8((iter_base) + 0, (2)) + mbt_ffi_store32((iter_base) + 4, ((payload3).start).x) + mbt_ffi_store32((iter_base) + 8, ((payload3).start).y) + mbt_ffi_store32((iter_base) + 12, ((payload3).end).x) + mbt_ffi_store32((iter_base) + 16, ((payload3).end).y) + mbt_ffi_store8((iter_base) + 20, (((payload3).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload3).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload3).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload3).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload3).width).reinterpret_as_int()) + + () + } + Circle(payload4) => { + mbt_ffi_store8((iter_base) + 0, (3)) + mbt_ffi_store32((iter_base) + 4, ((payload4).center).x) + mbt_ffi_store32((iter_base) + 8, ((payload4).center).y) + mbt_ffi_store32((iter_base) + 12, ((payload4).radius).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 16, (((payload4).color).r).to_int()) + mbt_ffi_store8((iter_base) + 17, (((payload4).color).g).to_int()) + mbt_ffi_store8((iter_base) + 18, (((payload4).color).b).to_int()) + mbt_ffi_store8((iter_base) + 19, (((payload4).color).a).to_int()) + mbt_ffi_store8((iter_base) + 20, (if (payload4).filled { 1 } else { 0 })) + + () + } + Text(payload5) => { + mbt_ffi_store8((iter_base) + 0, (4)) + mbt_ffi_store32((iter_base) + 4, ((payload5).origin).x) + mbt_ffi_store32((iter_base) + 8, ((payload5).origin).y) + + let ptr = mbt_ffi_str2ptr((payload5).text) + mbt_ffi_store32((iter_base) + 16, (payload5).text.length()) + mbt_ffi_store32((iter_base) + 12, ptr) + mbt_ffi_store32((iter_base) + 20, (((payload5).style).size).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 24, ((((payload5).style).color).r).to_int()) + mbt_ffi_store8((iter_base) + 25, ((((payload5).style).color).g).to_int()) + mbt_ffi_store8((iter_base) + 26, ((((payload5).style).color).b).to_int()) + mbt_ffi_store8((iter_base) + 27, ((((payload5).style).color).a).to_int()) + mbt_ffi_store8((iter_base) + 28, ((payload5).style).align.ordinal()) + mbt_ffi_store8((iter_base) + 29, (if ((payload5).style).bold { 1 } else { 0 })) + + () + } + PushClip(payload6) => { + mbt_ffi_store8((iter_base) + 0, (5)) + mbt_ffi_store32((iter_base) + 4, (payload6).x) + mbt_ffi_store32((iter_base) + 8, (payload6).y) + mbt_ffi_store32((iter_base) + 12, ((payload6).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, ((payload6).h).reinterpret_as_int()) + + () + } + PopClip => { + mbt_ffi_store8((iter_base) + 0, (6)) + + () + } + } + + } + mbt_ffi_store32((return_area) + 16, ((payload0).ops).length()) + mbt_ffi_store32((return_area) + 12, address) + + () + } + } + let ret = return_area + return ret + +} + +///| +#doc(hidden) +pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit { + + match (mbt_ffi_load8_u((p0) + 0)) { + 0 => () + 1 => { + + for index = 0; index < (mbt_ffi_load32((p0) + 16)); index = index + 1 { + let iter_base = (mbt_ffi_load32((p0) + 12)) + (index * 32) + + match (mbt_ffi_load8_u((iter_base) + 0)) { + 0 => () + 1 => () + 2 => () + 3 => () + 4 => { + mbt_ffi_free(mbt_ffi_load32((iter_base) + 12)) + + } + 5 => () + 6 => () + _ => panic() + } + + } + mbt_ffi_free(mbt_ffi_load32((p0) + 12)) + + } + _ => panic() + } + +} + +///| +#doc(hidden) +pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int { + + let lifted = match (p1) { + 0 => { + + @types.InputEvent::PointerMove(@types.Point::{x : p2, y : p3}) + } + 1 => { + + @types.InputEvent::PointerDown(@types.Point::{x : p2, y : p3}) + } + 2 => { + + @types.InputEvent::PointerUp(@types.Point::{x : p2, y : p3}) + } + 3 => { + + @types.InputEvent::PointerLeave + } + 4 => { + + @types.InputEvent::FocusLost + } + 5 => { + + let result = mbt_ffi_ptr2str(p2, p3) + + @types.InputEvent::KeyDown(result) + } + _ => panic() + } + + let (result0) : (Bool) = on_event(Surface::from(p0), lifted); + let ret = (if result0 { 1 } else { 0 }) + return ret + +} + +///| +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = +#|(func (param i32) (result i32) local.get 0 i32.load8_u) + +///| +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = +#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) + +///| +extern "wasm" fn mbt_ffi_free(position : Int) = +#|(func (param i32) local.get 0 call $moonbit.decref) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = +#|(func (param i32) (result i32) (local i32) +#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc +#| local.tee 1 i32.const 0 call $moonbit.init_array8 +#| local.get 1) + +///| +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = +#|(func (param i32) (result i32) local.get 0) + +///| +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = +#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) + +///| +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = +#|(func (param i32) (result i32) local.get 0 i32.load) + +///| +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = +#|(func (param i32) (param i32) (result i32) +#| local.get 0 +#| local.get 1 call $moonbit.init_array16 +#| local.get 0) + diff --git a/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid/moon.pkg b/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid/moon.pkg new file mode 100644 index 0000000..b814460 --- /dev/null +++ b/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid/moon.pkg @@ -0,0 +1,8 @@ +import { + "moonplasma/desktop/interface/moonplasma/desktop/types" @types, + "moonplasma/desktop/interface/moonplasma/desktop/theme" @theme, + "moonplasma/desktop/interface/moonplasma/desktop/clock" @clock, + "moonplasma/desktop/lib/clock" @logic, +} + +warnings = "-44" diff --git a/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid/pkg.generated.mbti b/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid/pkg.generated.mbti new file mode 100644 index 0000000..339f758 --- /dev/null +++ b/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid/pkg.generated.mbti @@ -0,0 +1,42 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid" + +import { + "moonplasma/desktop/interface/moonplasma/desktop/types", +} + +// Values +pub fn info() -> PlasmoidInfo + +pub fn on_event(Surface, @types.InputEvent) -> Bool + +pub fn popup() -> PopupSurface? + +pub fn render(@types.Size) -> Array[@types.DrawOp] + +// Errors + +// Types and methods +pub(all) struct PlasmoidInfo { + id : String + name : String + preferred : @types.Size + min_width : UInt32 + stretch : Bool +} + +pub(all) struct PopupSurface { + size : @types.Size + ops : Array[@types.DrawOp] +} + +pub(all) enum Surface { + WIDGET + POPUP +} +pub fn Surface::from(Int32) -> Self +pub fn Surface::ordinal(Self) -> Int32 + +// Type aliases + +// Traits diff --git a/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid/stub.mbt b/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid/stub.mbt new file mode 100644 index 0000000..7284246 --- /dev/null +++ b/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid/stub.mbt @@ -0,0 +1,29 @@ +///| Implementation of `moonplasma:desktop/plasmoid` for the binary clock. +/// All logic lives in lib/clock; this file only adapts host capabilities. + +///| +pub fn info() -> PlasmoidInfo { + let (id, name, w, h, min_w) = @logic.binary_info() + { + id, + name, + preferred: { w: w.reinterpret_as_uint(), h: h.reinterpret_as_uint() }, + min_width: min_w.reinterpret_as_uint(), + stretch: false, + } +} + +///| +pub fn render(size : @types.Size) -> Array[@types.DrawOp] { + @logic.render_binary(size, @theme.get_tokens(), @clock.now()) +} + +///| +pub fn popup() -> PopupSurface? { + None +} + +///| +pub fn on_event(_target : Surface, _event : @types.InputEvent) -> Bool { + false +} diff --git a/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid/top.mbt b/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid/top.mbt new file mode 100644 index 0000000..24d7d0e --- /dev/null +++ b/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid/top.mbt @@ -0,0 +1,42 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! +///| +pub(all) struct PlasmoidInfo { + id : String; name : String; preferred : @types.Size; min_width : UInt; stretch : Bool +} +///| +pub(all) struct PopupSurface { + size : @types.Size; ops : Array[@types.DrawOp] +} +///| +pub(all) enum Surface { + WIDGET; POPUP +} derive() + +///| +pub fn Surface::ordinal(self : Surface) -> Int { + match self { + WIDGET => 0 + POPUP => 1 + } +} + +///| +pub fn Surface::from(self : Int) -> Surface { + match self { + 0 => WIDGET + 1 => POPUP + _ => panic() + } +} +///| +declare pub fn info() -> PlasmoidInfo +///| +/// Draw the widget into a `size` box (local coordinates). +declare pub fn render(size : @types.Size) -> Array[@types.DrawOp] +///| +/// Present when the widget wants a popup surface (e.g. a launcher menu). +declare pub fn popup() -> PopupSurface? +///| +/// Returns true when the widget's visuals changed and a redraw is needed. +declare pub fn on_event(target : Surface, event : @types.InputEvent) -> Bool + diff --git a/components/clock-binary/gen/moon.pkg b/components/clock-binary/gen/moon.pkg new file mode 100644 index 0000000..200d36e --- /dev/null +++ b/components/clock-binary/gen/moon.pkg @@ -0,0 +1,26 @@ +import { + "moonplasma/desktop/components/clock-binary/gen/interface/moonplasma/desktop/plasmoid" @plasmoid, +} + +warnings = "-44" + +pkgtype(kind: "foreign_library") + +options( + link: { + "wasm": { + "export-memory-name": "memory", + "heap-start-address": 16, + "exports": [ + "mbt_ffi_cabi_realloc:cabi_realloc", + "wasmExportInfo:moonplasma:desktop/plasmoid@0.1.0#info", + "wasmExportInfoPostReturn:cabi_post_moonplasma:desktop/plasmoid@0.1.0#info", + "wasmExportOnEvent:moonplasma:desktop/plasmoid@0.1.0#on-event", + "wasmExportPopup:moonplasma:desktop/plasmoid@0.1.0#popup", + "wasmExportPopupPostReturn:cabi_post_moonplasma:desktop/plasmoid@0.1.0#popup", + "wasmExportRender:moonplasma:desktop/plasmoid@0.1.0#render", + "wasmExportRenderPostReturn:cabi_post_moonplasma:desktop/plasmoid@0.1.0#render" + ], + }, + }, +) diff --git a/components/clock-binary/gen/pkg.generated.mbti b/components/clock-binary/gen/pkg.generated.mbti new file mode 100644 index 0000000..a7937bb --- /dev/null +++ b/components/clock-binary/gen/pkg.generated.mbti @@ -0,0 +1,13 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/components/clock-binary/gen" + +// Values +pub fn mbt_ffi_cabi_realloc(Int32, Int32, Int32, Int32) -> Int32 + +// Errors + +// Types and methods + +// Type aliases + +// Traits diff --git a/components/clock-digital/gen/ffi.mbt b/components/clock-digital/gen/ffi.mbt new file mode 100644 index 0000000..38e7374 --- /dev/null +++ b/components/clock-digital/gen/ffi.mbt @@ -0,0 +1,82 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + +///| +pub fn mbt_ffi_cabi_realloc( +src_offset : Int, +src_size : Int, +_dst_alignment : Int, +dst_size : Int, +) -> Int { + // malloc + if src_offset == 0 && src_size == 0 { + return mbt_ffi_malloc(dst_size) + } + // free + if dst_size == 0 { + mbt_ffi_free(src_offset) + return 0 + } + // realloc + let dst = mbt_ffi_malloc(dst_size) + mbt_ffi_copy(dst, src_offset, if src_size < dst_size { src_size } else { dst_size }) + mbt_ffi_free(src_offset) + dst +} + +///| +extern "wasm" fn mbt_ffi_copy(dest : Int, src : Int, len : Int) = +#|(func (param i32) (param i32) (param i32) local.get 0 local.get 1 local.get 2 memory.copy) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = +#|(func (param i32) (result i32) (local i32) +#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc +#| local.tee 1 i32.const 0 call $moonbit.init_array8 +#| local.get 1) + +///| +extern "wasm" fn mbt_ffi_free(position : Int) = +#|(func (param i32) local.get 0 call $moonbit.decref) + +///| +#doc(hidden) +pub fn wasmExportInfo() -> Int { + @plasmoid.wasmExportInfo() +} + +///| +#doc(hidden) +pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit { + @plasmoid.wasmExportRenderPostReturn(p0) +} + +///| +#doc(hidden) +pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit { + @plasmoid.wasmExportInfoPostReturn(p0) +} + +///| +#doc(hidden) +pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit { + @plasmoid.wasmExportPopupPostReturn(p0) +} + +///| +#doc(hidden) +pub fn wasmExportPopup() -> Int { + @plasmoid.wasmExportPopup() +} + +///| +#doc(hidden) +pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int { + @plasmoid.wasmExportRender(p0, p1) +} + +///| +#doc(hidden) +pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int { + @plasmoid.wasmExportOnEvent(p0, p1, p2, p3) +} + diff --git a/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid/README.md b/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid/README.md new file mode 100644 index 0000000..53ecf69 --- /dev/null +++ b/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid/README.md @@ -0,0 +1 @@ +The widget (plasmoid) contract. \ No newline at end of file diff --git a/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid/ffi.mbt b/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid/ffi.mbt new file mode 100644 index 0000000..b229d5d --- /dev/null +++ b/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid/ffi.mbt @@ -0,0 +1,409 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + +///| +#doc(hidden) +pub fn wasmExportInfo() -> Int { + + let (result) : (PlasmoidInfo) = info(); + let return_area = mbt_ffi_malloc(32) + + let ptr = mbt_ffi_str2ptr((result).id) + mbt_ffi_store32((return_area) + 4, (result).id.length()) + mbt_ffi_store32((return_area) + 0, ptr) + + let ptr0 = mbt_ffi_str2ptr((result).name) + mbt_ffi_store32((return_area) + 12, (result).name.length()) + mbt_ffi_store32((return_area) + 8, ptr0) + mbt_ffi_store32((return_area) + 16, (((result).preferred).w).reinterpret_as_int()) + mbt_ffi_store32((return_area) + 20, (((result).preferred).h).reinterpret_as_int()) + mbt_ffi_store32((return_area) + 24, ((result).min_width).reinterpret_as_int()) + mbt_ffi_store8((return_area) + 28, (if (result).stretch { 1 } else { 0 })) + let ret = return_area + return ret + +} + +///| +#doc(hidden) +pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit { + mbt_ffi_free(mbt_ffi_load32((p0) + 0)) + mbt_ffi_free(mbt_ffi_load32((p0) + 8)) + +} + +///| +#doc(hidden) +pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int { + + let (result) : (Array[@types.DrawOp]) = render(@types.Size::{w : (p0).reinterpret_as_uint(), h : (p1).reinterpret_as_uint()}); + let return_area = mbt_ffi_malloc(8) + + let address = mbt_ffi_malloc((result).length() * 32); + for index = 0; index < (result).length(); index = index + 1 { + let iter_elem : @types.DrawOp = (result)[(index)] + let iter_base = address + (index * 32); + + match iter_elem { + FillRect(payload) => { + mbt_ffi_store8((iter_base) + 0, (0)) + mbt_ffi_store32((iter_base) + 4, ((payload).rect).x) + mbt_ffi_store32((iter_base) + 8, ((payload).rect).y) + mbt_ffi_store32((iter_base) + 12, (((payload).rect).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, (((payload).rect).h).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 20, (((payload).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload).radius).reinterpret_as_int()) + + () + } + StrokeRect(payload0) => { + mbt_ffi_store8((iter_base) + 0, (1)) + mbt_ffi_store32((iter_base) + 4, ((payload0).rect).x) + mbt_ffi_store32((iter_base) + 8, ((payload0).rect).y) + mbt_ffi_store32((iter_base) + 12, (((payload0).rect).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, (((payload0).rect).h).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 20, (((payload0).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload0).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload0).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload0).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload0).width).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 28, ((payload0).radius).reinterpret_as_int()) + + () + } + Line(payload1) => { + mbt_ffi_store8((iter_base) + 0, (2)) + mbt_ffi_store32((iter_base) + 4, ((payload1).start).x) + mbt_ffi_store32((iter_base) + 8, ((payload1).start).y) + mbt_ffi_store32((iter_base) + 12, ((payload1).end).x) + mbt_ffi_store32((iter_base) + 16, ((payload1).end).y) + mbt_ffi_store8((iter_base) + 20, (((payload1).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload1).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload1).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload1).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload1).width).reinterpret_as_int()) + + () + } + Circle(payload2) => { + mbt_ffi_store8((iter_base) + 0, (3)) + mbt_ffi_store32((iter_base) + 4, ((payload2).center).x) + mbt_ffi_store32((iter_base) + 8, ((payload2).center).y) + mbt_ffi_store32((iter_base) + 12, ((payload2).radius).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 16, (((payload2).color).r).to_int()) + mbt_ffi_store8((iter_base) + 17, (((payload2).color).g).to_int()) + mbt_ffi_store8((iter_base) + 18, (((payload2).color).b).to_int()) + mbt_ffi_store8((iter_base) + 19, (((payload2).color).a).to_int()) + mbt_ffi_store8((iter_base) + 20, (if (payload2).filled { 1 } else { 0 })) + + () + } + Text(payload3) => { + mbt_ffi_store8((iter_base) + 0, (4)) + mbt_ffi_store32((iter_base) + 4, ((payload3).origin).x) + mbt_ffi_store32((iter_base) + 8, ((payload3).origin).y) + + let ptr = mbt_ffi_str2ptr((payload3).text) + mbt_ffi_store32((iter_base) + 16, (payload3).text.length()) + mbt_ffi_store32((iter_base) + 12, ptr) + mbt_ffi_store32((iter_base) + 20, (((payload3).style).size).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 24, ((((payload3).style).color).r).to_int()) + mbt_ffi_store8((iter_base) + 25, ((((payload3).style).color).g).to_int()) + mbt_ffi_store8((iter_base) + 26, ((((payload3).style).color).b).to_int()) + mbt_ffi_store8((iter_base) + 27, ((((payload3).style).color).a).to_int()) + mbt_ffi_store8((iter_base) + 28, ((payload3).style).align.ordinal()) + mbt_ffi_store8((iter_base) + 29, (if ((payload3).style).bold { 1 } else { 0 })) + + () + } + PushClip(payload4) => { + mbt_ffi_store8((iter_base) + 0, (5)) + mbt_ffi_store32((iter_base) + 4, (payload4).x) + mbt_ffi_store32((iter_base) + 8, (payload4).y) + mbt_ffi_store32((iter_base) + 12, ((payload4).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, ((payload4).h).reinterpret_as_int()) + + () + } + PopClip => { + mbt_ffi_store8((iter_base) + 0, (6)) + + () + } + } + + } + mbt_ffi_store32((return_area) + 4, (result).length()) + mbt_ffi_store32((return_area) + 0, address) + let ret = return_area + return ret + +} + +///| +#doc(hidden) +pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit { + + for index = 0; index < (mbt_ffi_load32((p0) + 4)); index = index + 1 { + let iter_base = (mbt_ffi_load32((p0) + 0)) + (index * 32) + + match (mbt_ffi_load8_u((iter_base) + 0)) { + 0 => () + 1 => () + 2 => () + 3 => () + 4 => { + mbt_ffi_free(mbt_ffi_load32((iter_base) + 12)) + + } + 5 => () + 6 => () + _ => panic() + } + + } + mbt_ffi_free(mbt_ffi_load32((p0) + 0)) + +} + +///| +#doc(hidden) +pub fn wasmExportPopup() -> Int { + + let (result) : (PopupSurface?) = popup(); + let return_area = mbt_ffi_malloc(20) + + match (result) { + None => { + mbt_ffi_store8((return_area) + 0, (0)) + + () + } + Some(payload0) => { + mbt_ffi_store8((return_area) + 0, (1)) + mbt_ffi_store32((return_area) + 4, (((payload0).size).w).reinterpret_as_int()) + mbt_ffi_store32((return_area) + 8, (((payload0).size).h).reinterpret_as_int()) + + let address = mbt_ffi_malloc(((payload0).ops).length() * 32); + for index = 0; index < ((payload0).ops).length(); index = index + 1 { + let iter_elem : @types.DrawOp = ((payload0).ops)[(index)] + let iter_base = address + (index * 32); + + match iter_elem { + FillRect(payload1) => { + mbt_ffi_store8((iter_base) + 0, (0)) + mbt_ffi_store32((iter_base) + 4, ((payload1).rect).x) + mbt_ffi_store32((iter_base) + 8, ((payload1).rect).y) + mbt_ffi_store32((iter_base) + 12, (((payload1).rect).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, (((payload1).rect).h).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 20, (((payload1).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload1).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload1).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload1).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload1).radius).reinterpret_as_int()) + + () + } + StrokeRect(payload2) => { + mbt_ffi_store8((iter_base) + 0, (1)) + mbt_ffi_store32((iter_base) + 4, ((payload2).rect).x) + mbt_ffi_store32((iter_base) + 8, ((payload2).rect).y) + mbt_ffi_store32((iter_base) + 12, (((payload2).rect).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, (((payload2).rect).h).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 20, (((payload2).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload2).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload2).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload2).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload2).width).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 28, ((payload2).radius).reinterpret_as_int()) + + () + } + Line(payload3) => { + mbt_ffi_store8((iter_base) + 0, (2)) + mbt_ffi_store32((iter_base) + 4, ((payload3).start).x) + mbt_ffi_store32((iter_base) + 8, ((payload3).start).y) + mbt_ffi_store32((iter_base) + 12, ((payload3).end).x) + mbt_ffi_store32((iter_base) + 16, ((payload3).end).y) + mbt_ffi_store8((iter_base) + 20, (((payload3).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload3).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload3).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload3).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload3).width).reinterpret_as_int()) + + () + } + Circle(payload4) => { + mbt_ffi_store8((iter_base) + 0, (3)) + mbt_ffi_store32((iter_base) + 4, ((payload4).center).x) + mbt_ffi_store32((iter_base) + 8, ((payload4).center).y) + mbt_ffi_store32((iter_base) + 12, ((payload4).radius).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 16, (((payload4).color).r).to_int()) + mbt_ffi_store8((iter_base) + 17, (((payload4).color).g).to_int()) + mbt_ffi_store8((iter_base) + 18, (((payload4).color).b).to_int()) + mbt_ffi_store8((iter_base) + 19, (((payload4).color).a).to_int()) + mbt_ffi_store8((iter_base) + 20, (if (payload4).filled { 1 } else { 0 })) + + () + } + Text(payload5) => { + mbt_ffi_store8((iter_base) + 0, (4)) + mbt_ffi_store32((iter_base) + 4, ((payload5).origin).x) + mbt_ffi_store32((iter_base) + 8, ((payload5).origin).y) + + let ptr = mbt_ffi_str2ptr((payload5).text) + mbt_ffi_store32((iter_base) + 16, (payload5).text.length()) + mbt_ffi_store32((iter_base) + 12, ptr) + mbt_ffi_store32((iter_base) + 20, (((payload5).style).size).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 24, ((((payload5).style).color).r).to_int()) + mbt_ffi_store8((iter_base) + 25, ((((payload5).style).color).g).to_int()) + mbt_ffi_store8((iter_base) + 26, ((((payload5).style).color).b).to_int()) + mbt_ffi_store8((iter_base) + 27, ((((payload5).style).color).a).to_int()) + mbt_ffi_store8((iter_base) + 28, ((payload5).style).align.ordinal()) + mbt_ffi_store8((iter_base) + 29, (if ((payload5).style).bold { 1 } else { 0 })) + + () + } + PushClip(payload6) => { + mbt_ffi_store8((iter_base) + 0, (5)) + mbt_ffi_store32((iter_base) + 4, (payload6).x) + mbt_ffi_store32((iter_base) + 8, (payload6).y) + mbt_ffi_store32((iter_base) + 12, ((payload6).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, ((payload6).h).reinterpret_as_int()) + + () + } + PopClip => { + mbt_ffi_store8((iter_base) + 0, (6)) + + () + } + } + + } + mbt_ffi_store32((return_area) + 16, ((payload0).ops).length()) + mbt_ffi_store32((return_area) + 12, address) + + () + } + } + let ret = return_area + return ret + +} + +///| +#doc(hidden) +pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit { + + match (mbt_ffi_load8_u((p0) + 0)) { + 0 => () + 1 => { + + for index = 0; index < (mbt_ffi_load32((p0) + 16)); index = index + 1 { + let iter_base = (mbt_ffi_load32((p0) + 12)) + (index * 32) + + match (mbt_ffi_load8_u((iter_base) + 0)) { + 0 => () + 1 => () + 2 => () + 3 => () + 4 => { + mbt_ffi_free(mbt_ffi_load32((iter_base) + 12)) + + } + 5 => () + 6 => () + _ => panic() + } + + } + mbt_ffi_free(mbt_ffi_load32((p0) + 12)) + + } + _ => panic() + } + +} + +///| +#doc(hidden) +pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int { + + let lifted = match (p1) { + 0 => { + + @types.InputEvent::PointerMove(@types.Point::{x : p2, y : p3}) + } + 1 => { + + @types.InputEvent::PointerDown(@types.Point::{x : p2, y : p3}) + } + 2 => { + + @types.InputEvent::PointerUp(@types.Point::{x : p2, y : p3}) + } + 3 => { + + @types.InputEvent::PointerLeave + } + 4 => { + + @types.InputEvent::FocusLost + } + 5 => { + + let result = mbt_ffi_ptr2str(p2, p3) + + @types.InputEvent::KeyDown(result) + } + _ => panic() + } + + let (result0) : (Bool) = on_event(Surface::from(p0), lifted); + let ret = (if result0 { 1 } else { 0 }) + return ret + +} + +///| +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = +#|(func (param i32) (result i32) local.get 0 i32.load) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = +#|(func (param i32) (result i32) (local i32) +#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc +#| local.tee 1 i32.const 0 call $moonbit.init_array8 +#| local.get 1) + +///| +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = +#|(func (param i32) (result i32) local.get 0 i32.load8_u) + +///| +extern "wasm" fn mbt_ffi_free(position : Int) = +#|(func (param i32) local.get 0 call $moonbit.decref) + +///| +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = +#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) + +///| +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = +#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) + +///| +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = +#|(func (param i32) (result i32) local.get 0) + +///| +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = +#|(func (param i32) (param i32) (result i32) +#| local.get 0 +#| local.get 1 call $moonbit.init_array16 +#| local.get 0) + diff --git a/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid/moon.pkg b/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid/moon.pkg new file mode 100644 index 0000000..b814460 --- /dev/null +++ b/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid/moon.pkg @@ -0,0 +1,8 @@ +import { + "moonplasma/desktop/interface/moonplasma/desktop/types" @types, + "moonplasma/desktop/interface/moonplasma/desktop/theme" @theme, + "moonplasma/desktop/interface/moonplasma/desktop/clock" @clock, + "moonplasma/desktop/lib/clock" @logic, +} + +warnings = "-44" diff --git a/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid/pkg.generated.mbti b/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid/pkg.generated.mbti new file mode 100644 index 0000000..ff73348 --- /dev/null +++ b/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid/pkg.generated.mbti @@ -0,0 +1,42 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid" + +import { + "moonplasma/desktop/interface/moonplasma/desktop/types", +} + +// Values +pub fn info() -> PlasmoidInfo + +pub fn on_event(Surface, @types.InputEvent) -> Bool + +pub fn popup() -> PopupSurface? + +pub fn render(@types.Size) -> Array[@types.DrawOp] + +// Errors + +// Types and methods +pub(all) struct PlasmoidInfo { + id : String + name : String + preferred : @types.Size + min_width : UInt32 + stretch : Bool +} + +pub(all) struct PopupSurface { + size : @types.Size + ops : Array[@types.DrawOp] +} + +pub(all) enum Surface { + WIDGET + POPUP +} +pub fn Surface::from(Int32) -> Self +pub fn Surface::ordinal(Self) -> Int32 + +// Type aliases + +// Traits diff --git a/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid/stub.mbt b/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid/stub.mbt new file mode 100644 index 0000000..f79a0e2 --- /dev/null +++ b/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid/stub.mbt @@ -0,0 +1,29 @@ +///| Implementation of `moonplasma:desktop/plasmoid` for the digital clock. +/// All logic lives in lib/clock; this file only adapts host capabilities. + +///| +pub fn info() -> PlasmoidInfo { + let (id, name, w, h, min_w) = @logic.digital_info() + { + id, + name, + preferred: { w: w.reinterpret_as_uint(), h: h.reinterpret_as_uint() }, + min_width: min_w.reinterpret_as_uint(), + stretch: false, + } +} + +///| +pub fn render(size : @types.Size) -> Array[@types.DrawOp] { + @logic.render_digital(size, @theme.get_tokens(), @clock.now()) +} + +///| +pub fn popup() -> PopupSurface? { + None +} + +///| +pub fn on_event(_target : Surface, _event : @types.InputEvent) -> Bool { + false +} diff --git a/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid/top.mbt b/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid/top.mbt new file mode 100644 index 0000000..24d7d0e --- /dev/null +++ b/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid/top.mbt @@ -0,0 +1,42 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! +///| +pub(all) struct PlasmoidInfo { + id : String; name : String; preferred : @types.Size; min_width : UInt; stretch : Bool +} +///| +pub(all) struct PopupSurface { + size : @types.Size; ops : Array[@types.DrawOp] +} +///| +pub(all) enum Surface { + WIDGET; POPUP +} derive() + +///| +pub fn Surface::ordinal(self : Surface) -> Int { + match self { + WIDGET => 0 + POPUP => 1 + } +} + +///| +pub fn Surface::from(self : Int) -> Surface { + match self { + 0 => WIDGET + 1 => POPUP + _ => panic() + } +} +///| +declare pub fn info() -> PlasmoidInfo +///| +/// Draw the widget into a `size` box (local coordinates). +declare pub fn render(size : @types.Size) -> Array[@types.DrawOp] +///| +/// Present when the widget wants a popup surface (e.g. a launcher menu). +declare pub fn popup() -> PopupSurface? +///| +/// Returns true when the widget's visuals changed and a redraw is needed. +declare pub fn on_event(target : Surface, event : @types.InputEvent) -> Bool + diff --git a/components/clock-digital/gen/moon.pkg b/components/clock-digital/gen/moon.pkg new file mode 100644 index 0000000..2794909 --- /dev/null +++ b/components/clock-digital/gen/moon.pkg @@ -0,0 +1,26 @@ +import { + "moonplasma/desktop/components/clock-digital/gen/interface/moonplasma/desktop/plasmoid" @plasmoid, +} + +warnings = "-44" + +pkgtype(kind: "foreign_library") + +options( + link: { + "wasm": { + "export-memory-name": "memory", + "heap-start-address": 16, + "exports": [ + "mbt_ffi_cabi_realloc:cabi_realloc", + "wasmExportInfo:moonplasma:desktop/plasmoid@0.1.0#info", + "wasmExportInfoPostReturn:cabi_post_moonplasma:desktop/plasmoid@0.1.0#info", + "wasmExportOnEvent:moonplasma:desktop/plasmoid@0.1.0#on-event", + "wasmExportPopup:moonplasma:desktop/plasmoid@0.1.0#popup", + "wasmExportPopupPostReturn:cabi_post_moonplasma:desktop/plasmoid@0.1.0#popup", + "wasmExportRender:moonplasma:desktop/plasmoid@0.1.0#render", + "wasmExportRenderPostReturn:cabi_post_moonplasma:desktop/plasmoid@0.1.0#render" + ], + }, + }, +) diff --git a/components/clock-digital/gen/pkg.generated.mbti b/components/clock-digital/gen/pkg.generated.mbti new file mode 100644 index 0000000..7423ff0 --- /dev/null +++ b/components/clock-digital/gen/pkg.generated.mbti @@ -0,0 +1,13 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/components/clock-digital/gen" + +// Values +pub fn mbt_ffi_cabi_realloc(Int32, Int32, Int32, Int32) -> Int32 + +// Errors + +// Types and methods + +// Type aliases + +// Traits diff --git a/components/launcher/gen/ffi.mbt b/components/launcher/gen/ffi.mbt new file mode 100644 index 0000000..d361033 --- /dev/null +++ b/components/launcher/gen/ffi.mbt @@ -0,0 +1,82 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + +///| +pub fn mbt_ffi_cabi_realloc( +src_offset : Int, +src_size : Int, +_dst_alignment : Int, +dst_size : Int, +) -> Int { + // malloc + if src_offset == 0 && src_size == 0 { + return mbt_ffi_malloc(dst_size) + } + // free + if dst_size == 0 { + mbt_ffi_free(src_offset) + return 0 + } + // realloc + let dst = mbt_ffi_malloc(dst_size) + mbt_ffi_copy(dst, src_offset, if src_size < dst_size { src_size } else { dst_size }) + mbt_ffi_free(src_offset) + dst +} + +///| +extern "wasm" fn mbt_ffi_copy(dest : Int, src : Int, len : Int) = +#|(func (param i32) (param i32) (param i32) local.get 0 local.get 1 local.get 2 memory.copy) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = +#|(func (param i32) (result i32) (local i32) +#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc +#| local.tee 1 i32.const 0 call $moonbit.init_array8 +#| local.get 1) + +///| +extern "wasm" fn mbt_ffi_free(position : Int) = +#|(func (param i32) local.get 0 call $moonbit.decref) + +///| +#doc(hidden) +pub fn wasmExportInfo() -> Int { + @plasmoid.wasmExportInfo() +} + +///| +#doc(hidden) +pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int { + @plasmoid.wasmExportOnEvent(p0, p1, p2, p3) +} + +///| +#doc(hidden) +pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit { + @plasmoid.wasmExportRenderPostReturn(p0) +} + +///| +#doc(hidden) +pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit { + @plasmoid.wasmExportInfoPostReturn(p0) +} + +///| +#doc(hidden) +pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int { + @plasmoid.wasmExportRender(p0, p1) +} + +///| +#doc(hidden) +pub fn wasmExportPopup() -> Int { + @plasmoid.wasmExportPopup() +} + +///| +#doc(hidden) +pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit { + @plasmoid.wasmExportPopupPostReturn(p0) +} + diff --git a/components/launcher/gen/interface/moonplasma/desktop/plasmoid/README.md b/components/launcher/gen/interface/moonplasma/desktop/plasmoid/README.md new file mode 100644 index 0000000..53ecf69 --- /dev/null +++ b/components/launcher/gen/interface/moonplasma/desktop/plasmoid/README.md @@ -0,0 +1 @@ +The widget (plasmoid) contract. \ No newline at end of file diff --git a/components/launcher/gen/interface/moonplasma/desktop/plasmoid/ffi.mbt b/components/launcher/gen/interface/moonplasma/desktop/plasmoid/ffi.mbt new file mode 100644 index 0000000..ec871b3 --- /dev/null +++ b/components/launcher/gen/interface/moonplasma/desktop/plasmoid/ffi.mbt @@ -0,0 +1,409 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + +///| +#doc(hidden) +pub fn wasmExportInfo() -> Int { + + let (result) : (PlasmoidInfo) = info(); + let return_area = mbt_ffi_malloc(32) + + let ptr = mbt_ffi_str2ptr((result).id) + mbt_ffi_store32((return_area) + 4, (result).id.length()) + mbt_ffi_store32((return_area) + 0, ptr) + + let ptr0 = mbt_ffi_str2ptr((result).name) + mbt_ffi_store32((return_area) + 12, (result).name.length()) + mbt_ffi_store32((return_area) + 8, ptr0) + mbt_ffi_store32((return_area) + 16, (((result).preferred).w).reinterpret_as_int()) + mbt_ffi_store32((return_area) + 20, (((result).preferred).h).reinterpret_as_int()) + mbt_ffi_store32((return_area) + 24, ((result).min_width).reinterpret_as_int()) + mbt_ffi_store8((return_area) + 28, (if (result).stretch { 1 } else { 0 })) + let ret = return_area + return ret + +} + +///| +#doc(hidden) +pub fn wasmExportInfoPostReturn(p0 : Int) -> Unit { + mbt_ffi_free(mbt_ffi_load32((p0) + 0)) + mbt_ffi_free(mbt_ffi_load32((p0) + 8)) + +} + +///| +#doc(hidden) +pub fn wasmExportRender(p0 : Int, p1 : Int) -> Int { + + let (result) : (Array[@types.DrawOp]) = render(@types.Size::{w : (p0).reinterpret_as_uint(), h : (p1).reinterpret_as_uint()}); + let return_area = mbt_ffi_malloc(8) + + let address = mbt_ffi_malloc((result).length() * 32); + for index = 0; index < (result).length(); index = index + 1 { + let iter_elem : @types.DrawOp = (result)[(index)] + let iter_base = address + (index * 32); + + match iter_elem { + FillRect(payload) => { + mbt_ffi_store8((iter_base) + 0, (0)) + mbt_ffi_store32((iter_base) + 4, ((payload).rect).x) + mbt_ffi_store32((iter_base) + 8, ((payload).rect).y) + mbt_ffi_store32((iter_base) + 12, (((payload).rect).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, (((payload).rect).h).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 20, (((payload).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload).radius).reinterpret_as_int()) + + () + } + StrokeRect(payload0) => { + mbt_ffi_store8((iter_base) + 0, (1)) + mbt_ffi_store32((iter_base) + 4, ((payload0).rect).x) + mbt_ffi_store32((iter_base) + 8, ((payload0).rect).y) + mbt_ffi_store32((iter_base) + 12, (((payload0).rect).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, (((payload0).rect).h).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 20, (((payload0).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload0).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload0).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload0).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload0).width).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 28, ((payload0).radius).reinterpret_as_int()) + + () + } + Line(payload1) => { + mbt_ffi_store8((iter_base) + 0, (2)) + mbt_ffi_store32((iter_base) + 4, ((payload1).start).x) + mbt_ffi_store32((iter_base) + 8, ((payload1).start).y) + mbt_ffi_store32((iter_base) + 12, ((payload1).end).x) + mbt_ffi_store32((iter_base) + 16, ((payload1).end).y) + mbt_ffi_store8((iter_base) + 20, (((payload1).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload1).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload1).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload1).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload1).width).reinterpret_as_int()) + + () + } + Circle(payload2) => { + mbt_ffi_store8((iter_base) + 0, (3)) + mbt_ffi_store32((iter_base) + 4, ((payload2).center).x) + mbt_ffi_store32((iter_base) + 8, ((payload2).center).y) + mbt_ffi_store32((iter_base) + 12, ((payload2).radius).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 16, (((payload2).color).r).to_int()) + mbt_ffi_store8((iter_base) + 17, (((payload2).color).g).to_int()) + mbt_ffi_store8((iter_base) + 18, (((payload2).color).b).to_int()) + mbt_ffi_store8((iter_base) + 19, (((payload2).color).a).to_int()) + mbt_ffi_store8((iter_base) + 20, (if (payload2).filled { 1 } else { 0 })) + + () + } + Text(payload3) => { + mbt_ffi_store8((iter_base) + 0, (4)) + mbt_ffi_store32((iter_base) + 4, ((payload3).origin).x) + mbt_ffi_store32((iter_base) + 8, ((payload3).origin).y) + + let ptr = mbt_ffi_str2ptr((payload3).text) + mbt_ffi_store32((iter_base) + 16, (payload3).text.length()) + mbt_ffi_store32((iter_base) + 12, ptr) + mbt_ffi_store32((iter_base) + 20, (((payload3).style).size).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 24, ((((payload3).style).color).r).to_int()) + mbt_ffi_store8((iter_base) + 25, ((((payload3).style).color).g).to_int()) + mbt_ffi_store8((iter_base) + 26, ((((payload3).style).color).b).to_int()) + mbt_ffi_store8((iter_base) + 27, ((((payload3).style).color).a).to_int()) + mbt_ffi_store8((iter_base) + 28, ((payload3).style).align.ordinal()) + mbt_ffi_store8((iter_base) + 29, (if ((payload3).style).bold { 1 } else { 0 })) + + () + } + PushClip(payload4) => { + mbt_ffi_store8((iter_base) + 0, (5)) + mbt_ffi_store32((iter_base) + 4, (payload4).x) + mbt_ffi_store32((iter_base) + 8, (payload4).y) + mbt_ffi_store32((iter_base) + 12, ((payload4).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, ((payload4).h).reinterpret_as_int()) + + () + } + PopClip => { + mbt_ffi_store8((iter_base) + 0, (6)) + + () + } + } + + } + mbt_ffi_store32((return_area) + 4, (result).length()) + mbt_ffi_store32((return_area) + 0, address) + let ret = return_area + return ret + +} + +///| +#doc(hidden) +pub fn wasmExportRenderPostReturn(p0 : Int) -> Unit { + + for index = 0; index < (mbt_ffi_load32((p0) + 4)); index = index + 1 { + let iter_base = (mbt_ffi_load32((p0) + 0)) + (index * 32) + + match (mbt_ffi_load8_u((iter_base) + 0)) { + 0 => () + 1 => () + 2 => () + 3 => () + 4 => { + mbt_ffi_free(mbt_ffi_load32((iter_base) + 12)) + + } + 5 => () + 6 => () + _ => panic() + } + + } + mbt_ffi_free(mbt_ffi_load32((p0) + 0)) + +} + +///| +#doc(hidden) +pub fn wasmExportPopup() -> Int { + + let (result) : (PopupSurface?) = popup(); + let return_area = mbt_ffi_malloc(20) + + match (result) { + None => { + mbt_ffi_store8((return_area) + 0, (0)) + + () + } + Some(payload0) => { + mbt_ffi_store8((return_area) + 0, (1)) + mbt_ffi_store32((return_area) + 4, (((payload0).size).w).reinterpret_as_int()) + mbt_ffi_store32((return_area) + 8, (((payload0).size).h).reinterpret_as_int()) + + let address = mbt_ffi_malloc(((payload0).ops).length() * 32); + for index = 0; index < ((payload0).ops).length(); index = index + 1 { + let iter_elem : @types.DrawOp = ((payload0).ops)[(index)] + let iter_base = address + (index * 32); + + match iter_elem { + FillRect(payload1) => { + mbt_ffi_store8((iter_base) + 0, (0)) + mbt_ffi_store32((iter_base) + 4, ((payload1).rect).x) + mbt_ffi_store32((iter_base) + 8, ((payload1).rect).y) + mbt_ffi_store32((iter_base) + 12, (((payload1).rect).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, (((payload1).rect).h).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 20, (((payload1).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload1).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload1).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload1).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload1).radius).reinterpret_as_int()) + + () + } + StrokeRect(payload2) => { + mbt_ffi_store8((iter_base) + 0, (1)) + mbt_ffi_store32((iter_base) + 4, ((payload2).rect).x) + mbt_ffi_store32((iter_base) + 8, ((payload2).rect).y) + mbt_ffi_store32((iter_base) + 12, (((payload2).rect).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, (((payload2).rect).h).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 20, (((payload2).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload2).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload2).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload2).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload2).width).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 28, ((payload2).radius).reinterpret_as_int()) + + () + } + Line(payload3) => { + mbt_ffi_store8((iter_base) + 0, (2)) + mbt_ffi_store32((iter_base) + 4, ((payload3).start).x) + mbt_ffi_store32((iter_base) + 8, ((payload3).start).y) + mbt_ffi_store32((iter_base) + 12, ((payload3).end).x) + mbt_ffi_store32((iter_base) + 16, ((payload3).end).y) + mbt_ffi_store8((iter_base) + 20, (((payload3).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload3).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload3).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload3).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload3).width).reinterpret_as_int()) + + () + } + Circle(payload4) => { + mbt_ffi_store8((iter_base) + 0, (3)) + mbt_ffi_store32((iter_base) + 4, ((payload4).center).x) + mbt_ffi_store32((iter_base) + 8, ((payload4).center).y) + mbt_ffi_store32((iter_base) + 12, ((payload4).radius).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 16, (((payload4).color).r).to_int()) + mbt_ffi_store8((iter_base) + 17, (((payload4).color).g).to_int()) + mbt_ffi_store8((iter_base) + 18, (((payload4).color).b).to_int()) + mbt_ffi_store8((iter_base) + 19, (((payload4).color).a).to_int()) + mbt_ffi_store8((iter_base) + 20, (if (payload4).filled { 1 } else { 0 })) + + () + } + Text(payload5) => { + mbt_ffi_store8((iter_base) + 0, (4)) + mbt_ffi_store32((iter_base) + 4, ((payload5).origin).x) + mbt_ffi_store32((iter_base) + 8, ((payload5).origin).y) + + let ptr = mbt_ffi_str2ptr((payload5).text) + mbt_ffi_store32((iter_base) + 16, (payload5).text.length()) + mbt_ffi_store32((iter_base) + 12, ptr) + mbt_ffi_store32((iter_base) + 20, (((payload5).style).size).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 24, ((((payload5).style).color).r).to_int()) + mbt_ffi_store8((iter_base) + 25, ((((payload5).style).color).g).to_int()) + mbt_ffi_store8((iter_base) + 26, ((((payload5).style).color).b).to_int()) + mbt_ffi_store8((iter_base) + 27, ((((payload5).style).color).a).to_int()) + mbt_ffi_store8((iter_base) + 28, ((payload5).style).align.ordinal()) + mbt_ffi_store8((iter_base) + 29, (if ((payload5).style).bold { 1 } else { 0 })) + + () + } + PushClip(payload6) => { + mbt_ffi_store8((iter_base) + 0, (5)) + mbt_ffi_store32((iter_base) + 4, (payload6).x) + mbt_ffi_store32((iter_base) + 8, (payload6).y) + mbt_ffi_store32((iter_base) + 12, ((payload6).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, ((payload6).h).reinterpret_as_int()) + + () + } + PopClip => { + mbt_ffi_store8((iter_base) + 0, (6)) + + () + } + } + + } + mbt_ffi_store32((return_area) + 16, ((payload0).ops).length()) + mbt_ffi_store32((return_area) + 12, address) + + () + } + } + let ret = return_area + return ret + +} + +///| +#doc(hidden) +pub fn wasmExportPopupPostReturn(p0 : Int) -> Unit { + + match (mbt_ffi_load8_u((p0) + 0)) { + 0 => () + 1 => { + + for index = 0; index < (mbt_ffi_load32((p0) + 16)); index = index + 1 { + let iter_base = (mbt_ffi_load32((p0) + 12)) + (index * 32) + + match (mbt_ffi_load8_u((iter_base) + 0)) { + 0 => () + 1 => () + 2 => () + 3 => () + 4 => { + mbt_ffi_free(mbt_ffi_load32((iter_base) + 12)) + + } + 5 => () + 6 => () + _ => panic() + } + + } + mbt_ffi_free(mbt_ffi_load32((p0) + 12)) + + } + _ => panic() + } + +} + +///| +#doc(hidden) +pub fn wasmExportOnEvent(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int { + + let lifted = match (p1) { + 0 => { + + @types.InputEvent::PointerMove(@types.Point::{x : p2, y : p3}) + } + 1 => { + + @types.InputEvent::PointerDown(@types.Point::{x : p2, y : p3}) + } + 2 => { + + @types.InputEvent::PointerUp(@types.Point::{x : p2, y : p3}) + } + 3 => { + + @types.InputEvent::PointerLeave + } + 4 => { + + @types.InputEvent::FocusLost + } + 5 => { + + let result = mbt_ffi_ptr2str(p2, p3) + + @types.InputEvent::KeyDown(result) + } + _ => panic() + } + + let (result0) : (Bool) = on_event(Surface::from(p0), lifted); + let ret = (if result0 { 1 } else { 0 }) + return ret + +} + +///| +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = +#|(func (param i32) (param i32) (result i32) +#| local.get 0 +#| local.get 1 call $moonbit.init_array16 +#| local.get 0) + +///| +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = +#|(func (param i32) (result i32) local.get 0) + +///| +extern "wasm" fn mbt_ffi_free(position : Int) = +#|(func (param i32) local.get 0 call $moonbit.decref) + +///| +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = +#|(func (param i32) (result i32) local.get 0 i32.load) + +///| +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = +#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) + +///| +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = +#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = +#|(func (param i32) (result i32) (local i32) +#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc +#| local.tee 1 i32.const 0 call $moonbit.init_array8 +#| local.get 1) + +///| +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = +#|(func (param i32) (result i32) local.get 0 i32.load8_u) + diff --git a/components/launcher/gen/interface/moonplasma/desktop/plasmoid/moon.pkg b/components/launcher/gen/interface/moonplasma/desktop/plasmoid/moon.pkg new file mode 100644 index 0000000..d247e12 --- /dev/null +++ b/components/launcher/gen/interface/moonplasma/desktop/plasmoid/moon.pkg @@ -0,0 +1,9 @@ +import { + "moonplasma/desktop/interface/moonplasma/desktop/types" @types, + "moonplasma/desktop/interface/moonplasma/desktop/theme" @theme, + "moonplasma/desktop/interface/moonplasma/desktop/app-catalog" @app_catalog, + "moonplasma/desktop/interface/moonplasma/desktop/app-launch" @app_launch, + "moonplasma/desktop/lib/launcher" @logic, +} + +warnings = "-44" diff --git a/components/launcher/gen/interface/moonplasma/desktop/plasmoid/pkg.generated.mbti b/components/launcher/gen/interface/moonplasma/desktop/plasmoid/pkg.generated.mbti new file mode 100644 index 0000000..37fc34d --- /dev/null +++ b/components/launcher/gen/interface/moonplasma/desktop/plasmoid/pkg.generated.mbti @@ -0,0 +1,42 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/components/launcher/gen/interface/moonplasma/desktop/plasmoid" + +import { + "moonplasma/desktop/interface/moonplasma/desktop/types", +} + +// Values +pub fn info() -> PlasmoidInfo + +pub fn on_event(Surface, @types.InputEvent) -> Bool + +pub fn popup() -> PopupSurface? + +pub fn render(@types.Size) -> Array[@types.DrawOp] + +// Errors + +// Types and methods +pub(all) struct PlasmoidInfo { + id : String + name : String + preferred : @types.Size + min_width : UInt32 + stretch : Bool +} + +pub(all) struct PopupSurface { + size : @types.Size + ops : Array[@types.DrawOp] +} + +pub(all) enum Surface { + WIDGET + POPUP +} +pub fn Surface::from(Int32) -> Self +pub fn Surface::ordinal(Self) -> Int32 + +// Type aliases + +// Traits diff --git a/components/launcher/gen/interface/moonplasma/desktop/plasmoid/stub.mbt b/components/launcher/gen/interface/moonplasma/desktop/plasmoid/stub.mbt new file mode 100644 index 0000000..46ae24a --- /dev/null +++ b/components/launcher/gen/interface/moonplasma/desktop/plasmoid/stub.mbt @@ -0,0 +1,42 @@ +///| Implementation of `moonplasma:desktop/plasmoid` for the launcher. +/// The state machine lives in lib/launcher; this adapts host capabilities. + +///| +let state : @logic.State = @logic.State::new() + +///| +pub fn info() -> PlasmoidInfo { + { + id: "org.moonplasma.launcher", + name: "Application Launcher", + preferred: { w: 150, h: 34 }, + min_width: 60, + stretch: false, + } +} + +///| +pub fn render(size : @types.Size) -> Array[@types.DrawOp] { + @logic.render_button(size, @theme.get_tokens(), state) +} + +///| +pub fn popup() -> PopupSurface? { + if !state.open { + return None + } + let apps = @app_catalog.list_apps() + Some({ + size: @logic.popup_size(apps, state), + ops: @logic.render_popup(apps, @theme.get_tokens(), state), + }) +} + +///| +pub fn on_event(target : Surface, event : @types.InputEvent) -> Bool { + let t : @logic.Target = match target { + WIDGET => Widget + POPUP => Popup + } + @logic.handle_event(@app_catalog.list_apps(), state, t, event, @app_launch.launch) +} diff --git a/components/launcher/gen/interface/moonplasma/desktop/plasmoid/top.mbt b/components/launcher/gen/interface/moonplasma/desktop/plasmoid/top.mbt new file mode 100644 index 0000000..24d7d0e --- /dev/null +++ b/components/launcher/gen/interface/moonplasma/desktop/plasmoid/top.mbt @@ -0,0 +1,42 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! +///| +pub(all) struct PlasmoidInfo { + id : String; name : String; preferred : @types.Size; min_width : UInt; stretch : Bool +} +///| +pub(all) struct PopupSurface { + size : @types.Size; ops : Array[@types.DrawOp] +} +///| +pub(all) enum Surface { + WIDGET; POPUP +} derive() + +///| +pub fn Surface::ordinal(self : Surface) -> Int { + match self { + WIDGET => 0 + POPUP => 1 + } +} + +///| +pub fn Surface::from(self : Int) -> Surface { + match self { + 0 => WIDGET + 1 => POPUP + _ => panic() + } +} +///| +declare pub fn info() -> PlasmoidInfo +///| +/// Draw the widget into a `size` box (local coordinates). +declare pub fn render(size : @types.Size) -> Array[@types.DrawOp] +///| +/// Present when the widget wants a popup surface (e.g. a launcher menu). +declare pub fn popup() -> PopupSurface? +///| +/// Returns true when the widget's visuals changed and a redraw is needed. +declare pub fn on_event(target : Surface, event : @types.InputEvent) -> Bool + diff --git a/components/launcher/gen/moon.pkg b/components/launcher/gen/moon.pkg new file mode 100644 index 0000000..818c872 --- /dev/null +++ b/components/launcher/gen/moon.pkg @@ -0,0 +1,26 @@ +import { + "moonplasma/desktop/components/launcher/gen/interface/moonplasma/desktop/plasmoid" @plasmoid, +} + +warnings = "-44" + +pkgtype(kind: "foreign_library") + +options( + link: { + "wasm": { + "export-memory-name": "memory", + "heap-start-address": 16, + "exports": [ + "mbt_ffi_cabi_realloc:cabi_realloc", + "wasmExportInfo:moonplasma:desktop/plasmoid@0.1.0#info", + "wasmExportInfoPostReturn:cabi_post_moonplasma:desktop/plasmoid@0.1.0#info", + "wasmExportOnEvent:moonplasma:desktop/plasmoid@0.1.0#on-event", + "wasmExportPopup:moonplasma:desktop/plasmoid@0.1.0#popup", + "wasmExportPopupPostReturn:cabi_post_moonplasma:desktop/plasmoid@0.1.0#popup", + "wasmExportRender:moonplasma:desktop/plasmoid@0.1.0#render", + "wasmExportRenderPostReturn:cabi_post_moonplasma:desktop/plasmoid@0.1.0#render" + ], + }, + }, +) diff --git a/components/launcher/gen/pkg.generated.mbti b/components/launcher/gen/pkg.generated.mbti new file mode 100644 index 0000000..722650d --- /dev/null +++ b/components/launcher/gen/pkg.generated.mbti @@ -0,0 +1,13 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/components/launcher/gen" + +// Values +pub fn mbt_ffi_cabi_realloc(Int32, Int32, Int32, Int32) -> Int32 + +// Errors + +// Types and methods + +// Type aliases + +// Traits diff --git a/components/shell/gen/ffi.mbt b/components/shell/gen/ffi.mbt new file mode 100644 index 0000000..b5daa6f --- /dev/null +++ b/components/shell/gen/ffi.mbt @@ -0,0 +1,82 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + +///| +pub fn mbt_ffi_cabi_realloc( +src_offset : Int, +src_size : Int, +_dst_alignment : Int, +dst_size : Int, +) -> Int { + // malloc + if src_offset == 0 && src_size == 0 { + return mbt_ffi_malloc(dst_size) + } + // free + if dst_size == 0 { + mbt_ffi_free(src_offset) + return 0 + } + // realloc + let dst = mbt_ffi_malloc(dst_size) + mbt_ffi_copy(dst, src_offset, if src_size < dst_size { src_size } else { dst_size }) + mbt_ffi_free(src_offset) + dst +} + +///| +extern "wasm" fn mbt_ffi_copy(dest : Int, src : Int, len : Int) = +#|(func (param i32) (param i32) (param i32) local.get 0 local.get 1 local.get 2 memory.copy) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = +#|(func (param i32) (result i32) (local i32) +#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc +#| local.tee 1 i32.const 0 call $moonbit.init_array8 +#| local.get 1) + +///| +extern "wasm" fn mbt_ffi_free(position : Int) = +#|(func (param i32) local.get 0 call $moonbit.decref) + +///| +#doc(hidden) +pub fn wasmExportPopupPosition(p0 : Int, p1 : Int, p2 : Int, p3 : Int, p4 : Int, p5 : Int, p6 : Int, p7 : Int, p8 : Int, p9 : Int, p10 : Int, p11 : Int) -> Int { + @panel-layout.wasmExportPopupPosition(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11) +} + +///| +#doc(hidden) +pub fn wasmExportRenderBackgroundPostReturn(p0 : Int) -> Unit { + @desktop-surface.wasmExportRenderBackgroundPostReturn(p0) +} + +///| +#doc(hidden) +pub fn wasmExportRenderPanelPostReturn(p0 : Int) -> Unit { + @panel-layout.wasmExportRenderPanelPostReturn(p0) +} + +///| +#doc(hidden) +pub fn wasmExportComputeLayoutPostReturn(p0 : Int) -> Unit { + @panel-layout.wasmExportComputeLayoutPostReturn(p0) +} + +///| +#doc(hidden) +pub fn wasmExportComputeLayout(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int { + @panel-layout.wasmExportComputeLayout(p0, p1, p2, p3) +} + +///| +#doc(hidden) +pub fn wasmExportRenderPanel(p0 : Int, p1 : Int, p2 : Int, p3 : Int, p4 : Int, p5 : Int) -> Int { + @panel-layout.wasmExportRenderPanel(p0, p1, p2, p3, p4, p5) +} + +///| +#doc(hidden) +pub fn wasmExportRenderBackground(p0 : Int, p1 : Int) -> Int { + @desktop-surface.wasmExportRenderBackground(p0, p1) +} + diff --git a/components/shell/gen/interface/moonplasma/desktop/desktop-surface/README.md b/components/shell/gen/interface/moonplasma/desktop/desktop-surface/README.md new file mode 100644 index 0000000..49c146e --- /dev/null +++ b/components/shell/gen/interface/moonplasma/desktop/desktop-surface/README.md @@ -0,0 +1 @@ +Desktop surface contract (wallpaper / desktop containment). \ No newline at end of file diff --git a/components/shell/gen/interface/moonplasma/desktop/desktop-surface/ffi.mbt b/components/shell/gen/interface/moonplasma/desktop/desktop-surface/ffi.mbt new file mode 100644 index 0000000..7ad118c --- /dev/null +++ b/components/shell/gen/interface/moonplasma/desktop/desktop-surface/ffi.mbt @@ -0,0 +1,171 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + +///| +#doc(hidden) +pub fn wasmExportRenderBackground(p0 : Int, p1 : Int) -> Int { + + let (result) : (Array[@types.DrawOp]) = render_background(@types.Size::{w : (p0).reinterpret_as_uint(), h : (p1).reinterpret_as_uint()}); + let return_area = mbt_ffi_malloc(8) + + let address = mbt_ffi_malloc((result).length() * 32); + for index = 0; index < (result).length(); index = index + 1 { + let iter_elem : @types.DrawOp = (result)[(index)] + let iter_base = address + (index * 32); + + match iter_elem { + FillRect(payload) => { + mbt_ffi_store8((iter_base) + 0, (0)) + mbt_ffi_store32((iter_base) + 4, ((payload).rect).x) + mbt_ffi_store32((iter_base) + 8, ((payload).rect).y) + mbt_ffi_store32((iter_base) + 12, (((payload).rect).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, (((payload).rect).h).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 20, (((payload).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload).radius).reinterpret_as_int()) + + () + } + StrokeRect(payload0) => { + mbt_ffi_store8((iter_base) + 0, (1)) + mbt_ffi_store32((iter_base) + 4, ((payload0).rect).x) + mbt_ffi_store32((iter_base) + 8, ((payload0).rect).y) + mbt_ffi_store32((iter_base) + 12, (((payload0).rect).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, (((payload0).rect).h).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 20, (((payload0).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload0).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload0).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload0).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload0).width).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 28, ((payload0).radius).reinterpret_as_int()) + + () + } + Line(payload1) => { + mbt_ffi_store8((iter_base) + 0, (2)) + mbt_ffi_store32((iter_base) + 4, ((payload1).start).x) + mbt_ffi_store32((iter_base) + 8, ((payload1).start).y) + mbt_ffi_store32((iter_base) + 12, ((payload1).end).x) + mbt_ffi_store32((iter_base) + 16, ((payload1).end).y) + mbt_ffi_store8((iter_base) + 20, (((payload1).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload1).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload1).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload1).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload1).width).reinterpret_as_int()) + + () + } + Circle(payload2) => { + mbt_ffi_store8((iter_base) + 0, (3)) + mbt_ffi_store32((iter_base) + 4, ((payload2).center).x) + mbt_ffi_store32((iter_base) + 8, ((payload2).center).y) + mbt_ffi_store32((iter_base) + 12, ((payload2).radius).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 16, (((payload2).color).r).to_int()) + mbt_ffi_store8((iter_base) + 17, (((payload2).color).g).to_int()) + mbt_ffi_store8((iter_base) + 18, (((payload2).color).b).to_int()) + mbt_ffi_store8((iter_base) + 19, (((payload2).color).a).to_int()) + mbt_ffi_store8((iter_base) + 20, (if (payload2).filled { 1 } else { 0 })) + + () + } + Text(payload3) => { + mbt_ffi_store8((iter_base) + 0, (4)) + mbt_ffi_store32((iter_base) + 4, ((payload3).origin).x) + mbt_ffi_store32((iter_base) + 8, ((payload3).origin).y) + + let ptr = mbt_ffi_str2ptr((payload3).text) + mbt_ffi_store32((iter_base) + 16, (payload3).text.length()) + mbt_ffi_store32((iter_base) + 12, ptr) + mbt_ffi_store32((iter_base) + 20, (((payload3).style).size).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 24, ((((payload3).style).color).r).to_int()) + mbt_ffi_store8((iter_base) + 25, ((((payload3).style).color).g).to_int()) + mbt_ffi_store8((iter_base) + 26, ((((payload3).style).color).b).to_int()) + mbt_ffi_store8((iter_base) + 27, ((((payload3).style).color).a).to_int()) + mbt_ffi_store8((iter_base) + 28, ((payload3).style).align.ordinal()) + mbt_ffi_store8((iter_base) + 29, (if ((payload3).style).bold { 1 } else { 0 })) + + () + } + PushClip(payload4) => { + mbt_ffi_store8((iter_base) + 0, (5)) + mbt_ffi_store32((iter_base) + 4, (payload4).x) + mbt_ffi_store32((iter_base) + 8, (payload4).y) + mbt_ffi_store32((iter_base) + 12, ((payload4).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, ((payload4).h).reinterpret_as_int()) + + () + } + PopClip => { + mbt_ffi_store8((iter_base) + 0, (6)) + + () + } + } + + } + mbt_ffi_store32((return_area) + 4, (result).length()) + mbt_ffi_store32((return_area) + 0, address) + let ret = return_area + return ret + +} + +///| +#doc(hidden) +pub fn wasmExportRenderBackgroundPostReturn(p0 : Int) -> Unit { + + for index = 0; index < (mbt_ffi_load32((p0) + 4)); index = index + 1 { + let iter_base = (mbt_ffi_load32((p0) + 0)) + (index * 32) + + match (mbt_ffi_load8_u((iter_base) + 0)) { + 0 => () + 1 => () + 2 => () + 3 => () + 4 => { + mbt_ffi_free(mbt_ffi_load32((iter_base) + 12)) + + } + 5 => () + 6 => () + _ => panic() + } + + } + mbt_ffi_free(mbt_ffi_load32((p0) + 0)) + +} + +///| +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = +#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) + +///| +extern "wasm" fn mbt_ffi_free(position : Int) = +#|(func (param i32) local.get 0 call $moonbit.decref) + +///| +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = +#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) + +///| +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = +#|(func (param i32) (result i32) local.get 0 i32.load) + +///| +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = +#|(func (param i32) (result i32) local.get 0 i32.load8_u) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = +#|(func (param i32) (result i32) (local i32) +#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc +#| local.tee 1 i32.const 0 call $moonbit.init_array8 +#| local.get 1) + +///| +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = +#|(func (param i32) (result i32) local.get 0) + diff --git a/components/shell/gen/interface/moonplasma/desktop/desktop-surface/moon.pkg b/components/shell/gen/interface/moonplasma/desktop/desktop-surface/moon.pkg new file mode 100644 index 0000000..9600f3f --- /dev/null +++ b/components/shell/gen/interface/moonplasma/desktop/desktop-surface/moon.pkg @@ -0,0 +1,7 @@ +import { + "moonplasma/desktop/interface/moonplasma/desktop/types" @types, + "moonplasma/desktop/interface/moonplasma/desktop/theme" @theme, + "moonplasma/desktop/lib/shell" @logic, +} + +warnings = "-44" diff --git a/components/shell/gen/interface/moonplasma/desktop/desktop-surface/pkg.generated.mbti b/components/shell/gen/interface/moonplasma/desktop/desktop-surface/pkg.generated.mbti new file mode 100644 index 0000000..47ee755 --- /dev/null +++ b/components/shell/gen/interface/moonplasma/desktop/desktop-surface/pkg.generated.mbti @@ -0,0 +1,17 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/components/shell/gen/interface/moonplasma/desktop/desktop-surface" + +import { + "moonplasma/desktop/interface/moonplasma/desktop/types", +} + +// Values +pub fn render_background(@types.Size) -> Array[@types.DrawOp] + +// Errors + +// Types and methods + +// Type aliases + +// Traits diff --git a/components/shell/gen/interface/moonplasma/desktop/desktop-surface/stub.mbt b/components/shell/gen/interface/moonplasma/desktop/desktop-surface/stub.mbt new file mode 100644 index 0000000..15f7f97 --- /dev/null +++ b/components/shell/gen/interface/moonplasma/desktop/desktop-surface/stub.mbt @@ -0,0 +1,6 @@ +///| `moonplasma:desktop/desktop-surface` for the reference shell. + +///| +pub fn render_background(screen : @types.Size) -> Array[@types.DrawOp] { + @logic.render_background(screen, @theme.get_tokens()) +} diff --git a/components/shell/gen/interface/moonplasma/desktop/desktop-surface/top.mbt b/components/shell/gen/interface/moonplasma/desktop/desktop-surface/top.mbt new file mode 100644 index 0000000..12e5199 --- /dev/null +++ b/components/shell/gen/interface/moonplasma/desktop/desktop-surface/top.mbt @@ -0,0 +1,4 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! +///| +declare pub fn render_background(screen : @types.Size) -> Array[@types.DrawOp] + diff --git a/components/shell/gen/interface/moonplasma/desktop/panel-layout/README.md b/components/shell/gen/interface/moonplasma/desktop/panel-layout/README.md new file mode 100644 index 0000000..7c2f99f --- /dev/null +++ b/components/shell/gen/interface/moonplasma/desktop/panel-layout/README.md @@ -0,0 +1 @@ +Panel layout/chrome contract (the plasmashell "containment" analogue). \ No newline at end of file diff --git a/components/shell/gen/interface/moonplasma/desktop/panel-layout/ffi.mbt b/components/shell/gen/interface/moonplasma/desktop/panel-layout/ffi.mbt new file mode 100644 index 0000000..ed9209f --- /dev/null +++ b/components/shell/gen/interface/moonplasma/desktop/panel-layout/ffi.mbt @@ -0,0 +1,248 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + +///| +#doc(hidden) +pub fn wasmExportComputeLayout(p0 : Int, p1 : Int, p2 : Int, p3 : Int) -> Int { + + let array : Array[Slot] = []; + for index = 0; index < (p3); index = index + 1 { + let iter_base = (p2) + (index * 24) + + let result = mbt_ffi_ptr2str(mbt_ffi_load32((iter_base) + 0), mbt_ffi_load32((iter_base) + 4)) + + array.push(Slot::{id : result, preferred : @types.Size::{w : (mbt_ffi_load32((iter_base) + 8)).reinterpret_as_uint(), h : (mbt_ffi_load32((iter_base) + 12)).reinterpret_as_uint()}, min_width : (mbt_ffi_load32((iter_base) + 16)).reinterpret_as_uint(), stretch : (mbt_ffi_load8_u((iter_base) + 20) != 0), align : Edge::from(mbt_ffi_load8_u((iter_base) + 21))}) + } + mbt_ffi_free(p2) + + let (result0) : (Layout) = compute_layout(@types.Size::{w : (p0).reinterpret_as_uint(), h : (p1).reinterpret_as_uint()}, array); + let return_area = mbt_ffi_malloc(24) + mbt_ffi_store32((return_area) + 0, ((result0).panel).x) + mbt_ffi_store32((return_area) + 4, ((result0).panel).y) + mbt_ffi_store32((return_area) + 8, (((result0).panel).w).reinterpret_as_int()) + mbt_ffi_store32((return_area) + 12, (((result0).panel).h).reinterpret_as_int()) + + let address = mbt_ffi_malloc(((result0).placements).length() * 24); + for index1 = 0; index1 < ((result0).placements).length(); index1 = index1 + 1 { + let iter_elem : Placement = ((result0).placements)[(index1)] + let iter_base = address + (index1 * 24); + + let ptr = mbt_ffi_str2ptr((iter_elem).id) + mbt_ffi_store32((iter_base) + 4, (iter_elem).id.length()) + mbt_ffi_store32((iter_base) + 0, ptr) + mbt_ffi_store32((iter_base) + 8, ((iter_elem).rect).x) + mbt_ffi_store32((iter_base) + 12, ((iter_elem).rect).y) + mbt_ffi_store32((iter_base) + 16, (((iter_elem).rect).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 20, (((iter_elem).rect).h).reinterpret_as_int()) + + } + mbt_ffi_store32((return_area) + 20, ((result0).placements).length()) + mbt_ffi_store32((return_area) + 16, address) + let ret = return_area + return ret + +} + +///| +#doc(hidden) +pub fn wasmExportComputeLayoutPostReturn(p0 : Int) -> Unit { + + for index = 0; index < (mbt_ffi_load32((p0) + 20)); index = index + 1 { + let iter_base = (mbt_ffi_load32((p0) + 16)) + (index * 24) + mbt_ffi_free(mbt_ffi_load32((iter_base) + 0)) + + } + mbt_ffi_free(mbt_ffi_load32((p0) + 16)) + +} + +///| +#doc(hidden) +pub fn wasmExportRenderPanel(p0 : Int, p1 : Int, p2 : Int, p3 : Int, p4 : Int, p5 : Int) -> Int { + + let (result) : (Array[@types.DrawOp]) = render_panel(@types.Size::{w : (p0).reinterpret_as_uint(), h : (p1).reinterpret_as_uint()}, @types.Rect::{x : p2, y : p3, w : (p4).reinterpret_as_uint(), h : (p5).reinterpret_as_uint()}); + let return_area = mbt_ffi_malloc(8) + + let address = mbt_ffi_malloc((result).length() * 32); + for index = 0; index < (result).length(); index = index + 1 { + let iter_elem : @types.DrawOp = (result)[(index)] + let iter_base = address + (index * 32); + + match iter_elem { + FillRect(payload) => { + mbt_ffi_store8((iter_base) + 0, (0)) + mbt_ffi_store32((iter_base) + 4, ((payload).rect).x) + mbt_ffi_store32((iter_base) + 8, ((payload).rect).y) + mbt_ffi_store32((iter_base) + 12, (((payload).rect).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, (((payload).rect).h).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 20, (((payload).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload).radius).reinterpret_as_int()) + + () + } + StrokeRect(payload0) => { + mbt_ffi_store8((iter_base) + 0, (1)) + mbt_ffi_store32((iter_base) + 4, ((payload0).rect).x) + mbt_ffi_store32((iter_base) + 8, ((payload0).rect).y) + mbt_ffi_store32((iter_base) + 12, (((payload0).rect).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, (((payload0).rect).h).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 20, (((payload0).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload0).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload0).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload0).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload0).width).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 28, ((payload0).radius).reinterpret_as_int()) + + () + } + Line(payload1) => { + mbt_ffi_store8((iter_base) + 0, (2)) + mbt_ffi_store32((iter_base) + 4, ((payload1).start).x) + mbt_ffi_store32((iter_base) + 8, ((payload1).start).y) + mbt_ffi_store32((iter_base) + 12, ((payload1).end).x) + mbt_ffi_store32((iter_base) + 16, ((payload1).end).y) + mbt_ffi_store8((iter_base) + 20, (((payload1).color).r).to_int()) + mbt_ffi_store8((iter_base) + 21, (((payload1).color).g).to_int()) + mbt_ffi_store8((iter_base) + 22, (((payload1).color).b).to_int()) + mbt_ffi_store8((iter_base) + 23, (((payload1).color).a).to_int()) + mbt_ffi_store32((iter_base) + 24, ((payload1).width).reinterpret_as_int()) + + () + } + Circle(payload2) => { + mbt_ffi_store8((iter_base) + 0, (3)) + mbt_ffi_store32((iter_base) + 4, ((payload2).center).x) + mbt_ffi_store32((iter_base) + 8, ((payload2).center).y) + mbt_ffi_store32((iter_base) + 12, ((payload2).radius).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 16, (((payload2).color).r).to_int()) + mbt_ffi_store8((iter_base) + 17, (((payload2).color).g).to_int()) + mbt_ffi_store8((iter_base) + 18, (((payload2).color).b).to_int()) + mbt_ffi_store8((iter_base) + 19, (((payload2).color).a).to_int()) + mbt_ffi_store8((iter_base) + 20, (if (payload2).filled { 1 } else { 0 })) + + () + } + Text(payload3) => { + mbt_ffi_store8((iter_base) + 0, (4)) + mbt_ffi_store32((iter_base) + 4, ((payload3).origin).x) + mbt_ffi_store32((iter_base) + 8, ((payload3).origin).y) + + let ptr = mbt_ffi_str2ptr((payload3).text) + mbt_ffi_store32((iter_base) + 16, (payload3).text.length()) + mbt_ffi_store32((iter_base) + 12, ptr) + mbt_ffi_store32((iter_base) + 20, (((payload3).style).size).reinterpret_as_int()) + mbt_ffi_store8((iter_base) + 24, ((((payload3).style).color).r).to_int()) + mbt_ffi_store8((iter_base) + 25, ((((payload3).style).color).g).to_int()) + mbt_ffi_store8((iter_base) + 26, ((((payload3).style).color).b).to_int()) + mbt_ffi_store8((iter_base) + 27, ((((payload3).style).color).a).to_int()) + mbt_ffi_store8((iter_base) + 28, ((payload3).style).align.ordinal()) + mbt_ffi_store8((iter_base) + 29, (if ((payload3).style).bold { 1 } else { 0 })) + + () + } + PushClip(payload4) => { + mbt_ffi_store8((iter_base) + 0, (5)) + mbt_ffi_store32((iter_base) + 4, (payload4).x) + mbt_ffi_store32((iter_base) + 8, (payload4).y) + mbt_ffi_store32((iter_base) + 12, ((payload4).w).reinterpret_as_int()) + mbt_ffi_store32((iter_base) + 16, ((payload4).h).reinterpret_as_int()) + + () + } + PopClip => { + mbt_ffi_store8((iter_base) + 0, (6)) + + () + } + } + + } + mbt_ffi_store32((return_area) + 4, (result).length()) + mbt_ffi_store32((return_area) + 0, address) + let ret = return_area + return ret + +} + +///| +#doc(hidden) +pub fn wasmExportRenderPanelPostReturn(p0 : Int) -> Unit { + + for index = 0; index < (mbt_ffi_load32((p0) + 4)); index = index + 1 { + let iter_base = (mbt_ffi_load32((p0) + 0)) + (index * 32) + + match (mbt_ffi_load8_u((iter_base) + 0)) { + 0 => () + 1 => () + 2 => () + 3 => () + 4 => { + mbt_ffi_free(mbt_ffi_load32((iter_base) + 12)) + + } + 5 => () + 6 => () + _ => panic() + } + + } + mbt_ffi_free(mbt_ffi_load32((p0) + 0)) + +} + +///| +#doc(hidden) +pub fn wasmExportPopupPosition(p0 : Int, p1 : Int, p2 : Int, p3 : Int, p4 : Int, p5 : Int, p6 : Int, p7 : Int, p8 : Int, p9 : Int, p10 : Int, p11 : Int) -> Int { + + let (result) : (@types.Rect) = popup_position(@types.Size::{w : (p0).reinterpret_as_uint(), h : (p1).reinterpret_as_uint()}, @types.Rect::{x : p2, y : p3, w : (p4).reinterpret_as_uint(), h : (p5).reinterpret_as_uint()}, @types.Rect::{x : p6, y : p7, w : (p8).reinterpret_as_uint(), h : (p9).reinterpret_as_uint()}, @types.Size::{w : (p10).reinterpret_as_uint(), h : (p11).reinterpret_as_uint()}); + let return_area = mbt_ffi_malloc(16) + mbt_ffi_store32((return_area) + 0, (result).x) + mbt_ffi_store32((return_area) + 4, (result).y) + mbt_ffi_store32((return_area) + 8, ((result).w).reinterpret_as_int()) + mbt_ffi_store32((return_area) + 12, ((result).h).reinterpret_as_int()) + let ret = return_area + return ret + +} + +///| +extern "wasm" fn mbt_ffi_store8(offset : Int, value : Int) = +#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store8) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = +#|(func (param i32) (result i32) (local i32) +#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc +#| local.tee 1 i32.const 0 call $moonbit.init_array8 +#| local.get 1) + +///| +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = +#|(func (param i32) (param i32) (result i32) +#| local.get 0 +#| local.get 1 call $moonbit.init_array16 +#| local.get 0) + +///| +extern "wasm" fn mbt_ffi_store32(offset : Int, value : Int) = +#|(func (param i32) (param i32) local.get 0 local.get 1 i32.store) + +///| +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = +#|(func (param i32) (result i32) local.get 0) + +///| +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = +#|(func (param i32) (result i32) local.get 0 i32.load8_u) + +///| +extern "wasm" fn mbt_ffi_free(position : Int) = +#|(func (param i32) local.get 0 call $moonbit.decref) + +///| +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = +#|(func (param i32) (result i32) local.get 0 i32.load) + diff --git a/components/shell/gen/interface/moonplasma/desktop/panel-layout/moon.pkg b/components/shell/gen/interface/moonplasma/desktop/panel-layout/moon.pkg new file mode 100644 index 0000000..b9a3b05 --- /dev/null +++ b/components/shell/gen/interface/moonplasma/desktop/panel-layout/moon.pkg @@ -0,0 +1,9 @@ +import { + "moonplasma/desktop/interface/moonplasma/desktop/types" @types, + "moonplasma/desktop/interface/moonplasma/desktop/theme" @theme, + "moonplasma/desktop/lib/shell" @shell, + "moonplasma/desktop/lib/panel" @panel, + "moonplasma/desktop/lib/ui" @ui, +} + +warnings = "-44" diff --git a/components/shell/gen/interface/moonplasma/desktop/panel-layout/pkg.generated.mbti b/components/shell/gen/interface/moonplasma/desktop/panel-layout/pkg.generated.mbti new file mode 100644 index 0000000..13cbc45 --- /dev/null +++ b/components/shell/gen/interface/moonplasma/desktop/panel-layout/pkg.generated.mbti @@ -0,0 +1,45 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/components/shell/gen/interface/moonplasma/desktop/panel-layout" + +import { + "moonplasma/desktop/interface/moonplasma/desktop/types", +} + +// Values +pub fn compute_layout(@types.Size, Array[Slot]) -> Layout + +pub fn popup_position(@types.Size, @types.Rect, @types.Rect, @types.Size) -> @types.Rect + +pub fn render_panel(@types.Size, @types.Rect) -> Array[@types.DrawOp] + +// Errors + +// Types and methods +pub(all) enum Edge { + START + END +} +pub fn Edge::from(Int32) -> Self +pub fn Edge::ordinal(Self) -> Int32 + +pub(all) struct Layout { + panel : @types.Rect + placements : Array[Placement] +} + +pub(all) struct Placement { + id : String + rect : @types.Rect +} + +pub(all) struct Slot { + id : String + preferred : @types.Size + min_width : UInt32 + stretch : Bool + align : Edge +} + +// Type aliases + +// Traits diff --git a/components/shell/gen/interface/moonplasma/desktop/panel-layout/stub.mbt b/components/shell/gen/interface/moonplasma/desktop/panel-layout/stub.mbt new file mode 100644 index 0000000..52c3b06 --- /dev/null +++ b/components/shell/gen/interface/moonplasma/desktop/panel-layout/stub.mbt @@ -0,0 +1,57 @@ +///| `moonplasma:desktop/panel-layout` for the reference shell. Geometry is in +/// lib/panel (pure, unit-tested); this adapts the WIT records. + +///| +pub fn compute_layout(screen : @types.Size, slots : Array[Slot]) -> Layout { + let t = @theme.get_tokens() + let margin = 5 + let ins = slots.map(s => @panel.SlotIn::{ + id: s.id, + pref_w: s.preferred.w.reinterpret_as_int(), + pref_h: s.preferred.h.reinterpret_as_int(), + min_w: s.min_width.reinterpret_as_int(), + stretch: s.stretch, + end_align: match s.align { + START => false + END => true + }, + }) + match @panel.layout( + screen.w.reinterpret_as_int(), + screen.h.reinterpret_as_int(), + t.panel_height.reinterpret_as_int(), + margin, + t.spacing.reinterpret_as_int(), + ins, + ) { + // Fail loudly: a trap surfaces in the host as a component error. + Err(e) => abort("panel layout failed: " + e) + Ok(l) => { + panel: @ui.rect(l.x, l.y, l.w, l.h), + placements: l.placements.map(p => { id: p.id, rect: @ui.rect(p.x, p.y, p.w, p.h) }), + } + } +} + +///| +pub fn render_panel(_screen : @types.Size, panel : @types.Rect) -> Array[@types.DrawOp] { + @shell.render_panel(panel, @theme.get_tokens()) +} + +///| +pub fn popup_position( + screen : @types.Size, + panel : @types.Rect, + anchor : @types.Rect, + popup : @types.Size, +) -> @types.Rect { + let (x, y) = @panel.popup_position( + screen.w.reinterpret_as_int(), + panel.y, + anchor.x, + popup.w.reinterpret_as_int(), + popup.h.reinterpret_as_int(), + 8, + ) + @ui.rect(x, y, popup.w.reinterpret_as_int(), popup.h.reinterpret_as_int()) +} diff --git a/components/shell/gen/interface/moonplasma/desktop/panel-layout/top.mbt b/components/shell/gen/interface/moonplasma/desktop/panel-layout/top.mbt new file mode 100644 index 0000000..d360171 --- /dev/null +++ b/components/shell/gen/interface/moonplasma/desktop/panel-layout/top.mbt @@ -0,0 +1,44 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! +///| +pub(all) enum Edge { + START; END +} derive() + +///| +pub fn Edge::ordinal(self : Edge) -> Int { + match self { + START => 0 + END => 1 + } +} + +///| +pub fn Edge::from(self : Int) -> Edge { + match self { + 0 => START + 1 => END + _ => panic() + } +} +///| +pub(all) struct Slot { + id : String; preferred : @types.Size; min_width : UInt; stretch : Bool; align : Edge +} +///| +pub(all) struct Placement { + id : String; rect : @types.Rect +} +///| +pub(all) struct Layout { + panel : @types.Rect; placements : Array[Placement] +} +///| +/// Decide where the panel sits and where each widget goes. +declare pub fn compute_layout(screen : @types.Size, slots : Array[Slot]) -> Layout +///| +/// Panel background/frame (drawn beneath the widgets), in screen coords. +declare pub fn render_panel(screen : @types.Size, panel : @types.Rect) -> Array[@types.DrawOp] +///| +/// Place a popup of `popup` size for the widget at `anchor`. +declare pub fn popup_position(screen : @types.Size, panel : @types.Rect, anchor : @types.Rect, popup : @types.Size) -> @types.Rect + diff --git a/components/shell/gen/moon.pkg b/components/shell/gen/moon.pkg new file mode 100644 index 0000000..dce6bcc --- /dev/null +++ b/components/shell/gen/moon.pkg @@ -0,0 +1,27 @@ +import { + "moonplasma/desktop/components/shell/gen/interface/moonplasma/desktop/desktop-surface" @desktop-surface, + "moonplasma/desktop/components/shell/gen/interface/moonplasma/desktop/panel-layout" @panel-layout, +} + +warnings = "-44" + +pkgtype(kind: "foreign_library") + +options( + link: { + "wasm": { + "export-memory-name": "memory", + "heap-start-address": 16, + "exports": [ + "mbt_ffi_cabi_realloc:cabi_realloc", + "wasmExportComputeLayout:moonplasma:desktop/panel-layout@0.1.0#compute-layout", + "wasmExportComputeLayoutPostReturn:cabi_post_moonplasma:desktop/panel-layout@0.1.0#compute-layout", + "wasmExportPopupPosition:moonplasma:desktop/panel-layout@0.1.0#popup-position", + "wasmExportRenderBackground:moonplasma:desktop/desktop-surface@0.1.0#render-background", + "wasmExportRenderBackgroundPostReturn:cabi_post_moonplasma:desktop/desktop-surface@0.1.0#render-background", + "wasmExportRenderPanel:moonplasma:desktop/panel-layout@0.1.0#render-panel", + "wasmExportRenderPanelPostReturn:cabi_post_moonplasma:desktop/panel-layout@0.1.0#render-panel" + ], + }, + }, +) diff --git a/components/shell/gen/pkg.generated.mbti b/components/shell/gen/pkg.generated.mbti new file mode 100644 index 0000000..5804a30 --- /dev/null +++ b/components/shell/gen/pkg.generated.mbti @@ -0,0 +1,13 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/components/shell/gen" + +// Values +pub fn mbt_ffi_cabi_realloc(Int32, Int32, Int32, Int32) -> Int32 + +// Errors + +// Types and methods + +// Type aliases + +// Traits diff --git a/config/apps.json b/config/apps.json new file mode 100644 index 0000000..8ca5d24 --- /dev/null +++ b/config/apps.json @@ -0,0 +1,12 @@ +[ + {"id": "org.moonplasma.terminal", "name": "Terminal", "comment": "Command-line shell", "category": "System", "glyph": ">_"}, + {"id": "org.moonplasma.files", "name": "Files", "comment": "Browse folders and files", "category": "Utilities", "glyph": "F"}, + {"id": "org.moonplasma.browser", "name": "Web Browser", "comment": "Browse the web", "category": "Internet", "glyph": "W"}, + {"id": "org.moonplasma.settings", "name": "System Settings", "comment": "Configure the desktop", "category": "System", "glyph": "S"}, + {"id": "org.moonplasma.editor", "name": "Text Editor", "comment": "Edit plain text files", "category": "Utilities", "glyph": "T"}, + {"id": "org.moonplasma.music", "name": "Music Player", "comment": "Play your music library", "category": "Multimedia", "glyph": "M"}, + {"id": "org.moonplasma.calc", "name": "Calculator", "comment": "Do quick calculations", "category": "Utilities", "glyph": "="}, + {"id": "org.moonplasma.monitor", "name": "System Monitor", "comment": "Processes and resources", "category": "System", "glyph": "%"}, + {"id": "org.moonplasma.photos", "name": "Image Viewer", "comment": "View pictures", "category": "Graphics", "glyph": "I"}, + {"id": "org.moonplasma.notes", "name": "Notes", "comment": "Sticky notes", "category": "Office", "glyph": "N"} +] diff --git a/config/desktop.binary-clock.json b/config/desktop.binary-clock.json new file mode 100644 index 0000000..e505822 --- /dev/null +++ b/config/desktop.binary-clock.json @@ -0,0 +1,9 @@ +{ + "screen": {"w": 1280, "h": 720}, + "theme": "moon-night", + "shell": {"component": "shell", "grants": ["theme"]}, + "panel": [ + {"id": "launcher", "component": "launcher", "align": "start", "grants": ["theme", "app-catalog", "app-launch"]}, + {"id": "clock", "component": "clock-binary", "align": "end", "grants": ["theme", "clock"]} + ] +} diff --git a/config/desktop.json b/config/desktop.json new file mode 100644 index 0000000..64b0a6d --- /dev/null +++ b/config/desktop.json @@ -0,0 +1,9 @@ +{ + "screen": {"w": 1280, "h": 720}, + "theme": "moon-night", + "shell": {"component": "shell", "grants": ["theme"]}, + "panel": [ + {"id": "launcher", "component": "launcher", "align": "start", "grants": ["theme", "app-catalog", "app-launch"]}, + {"id": "clock", "component": "clock-digital", "align": "end", "grants": ["theme", "clock"]} + ] +} diff --git a/config/themes/moon-day.json b/config/themes/moon-day.json new file mode 100644 index 0000000..585a75a --- /dev/null +++ b/config/themes/moon-day.json @@ -0,0 +1,19 @@ +{ + "name": "Moon Day", + "palette": { + "desktop-top": "#cfe3ff", + "desktop-bottom": "#8fb4e8", + "surface": "#f4f6fbf2", + "surface-hover": "#dde3f0", + "surface-popup": "#fbfcffF5", + "foreground": "#1b2233", + "foreground-muted": "#5b6577", + "accent": "#3b6bff", + "accent-foreground": "#ffffff", + "border": "#b9c3d6" + }, + "font-size": 14, + "radius": 6, + "spacing": 6, + "panel-height": 44 +} diff --git a/config/themes/moon-night.json b/config/themes/moon-night.json new file mode 100644 index 0000000..af3e00a --- /dev/null +++ b/config/themes/moon-night.json @@ -0,0 +1,19 @@ +{ + "name": "Moon Night", + "palette": { + "desktop-top": "#16213e", + "desktop-bottom": "#0b1020", + "surface": "#1f2937f2", + "surface-hover": "#374151", + "surface-popup": "#111827f5", + "foreground": "#f3f4f6", + "foreground-muted": "#9ca3af", + "accent": "#7c9cff", + "accent-foreground": "#0b1020", + "border": "#3b4658" + }, + "font-size": 14, + "radius": 6, + "spacing": 6, + "panel-height": 44 +} diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md new file mode 100644 index 0000000..9967510 --- /dev/null +++ b/docs/ARCHITECTURE.md @@ -0,0 +1,277 @@ +# moon-plasma architecture + +> Status legend used throughout: **[M0]** implemented in this repository today, +> **[designed]** interface sketched here but not in `wit/` yet, **[open]** needs a decision. + +moon-plasma is a KDE-Plasma-like desktop in which **every part is a WebAssembly +component** (Component Model, WIT-defined interfaces, written in MoonBit) running +on top of a deliberately tiny trusted **host**. The point is not to clone Plasma +pixel for pixel; it is to take Plasma's *decomposition* (shell / window manager / +runner / settings / notifications / tray / session …) and make each seam a typed, +versioned, permission-checked, hot-swappable interface. + +## 1. Plasma → component-model map + +| Plasma piece | What it does | moon-plasma counterpart | Component or host? | +|---|---|---|---| +| `plasmashell` (containments, panels) | Hosts the desktop & panels, loads plasmoids | `shell` component exporting `desktop-surface` + `panel-layout` **[M0]** | component | +| Plasmoids / widgets (QML + C++/JS) | Clock, task manager, kickoff… | `widget` world exporting `plasmoid` **[M0]**: `digital-clock`, `binary-clock`, `launcher` | component, one instance per widget | +| Plasma Look-and-Feel, colour schemes, Breeze, Kirigami theme | Design tokens, icons, cursors, fonts | `theme` interface (`tokens`) **[M0]**; icon/cursor/font interfaces **[designed]**; a "look-and-feel" bundle = theme tokens + default layout + wallpaper | tokens served by a `theme-provider` component (M0: static JSON in host) | +| KWin (WM policy: stacking, focus, tiling, rules, virtual desktops) | Decides where windows go | `window-manager` world: exports `wm-policy` (place/resize/focus decisions), imports `window-registry` **[designed]** | component | +| KWin (compositing: scene graph, damage, scanout) | Draws windows to screen | Rasteriser/scanout of the **render-list** | **host** (only because it touches GPU/DRM) | +| KWin decorations (Aurorae etc.) | Titlebar/borders | `decoration` interface: returns draw-ops + hit regions for a window state **[designed]** | component | +| KWin effects / scripts | Overview, blur, wobbly… | `effect` interface: declarative per-frame transform of the scene (no raw shaders in M-early) **[designed]** | component (+ host primitives like blur) | +| KRunner / Kickoff search | Query many backends, ranked results | `search-provider` interface (`query(text) → list`, `run(match)`); `runner` component fans out to providers **[designed]**. Launcher widget does substring search locally in M0 | components | +| System Settings + KCM modules | Config UIs per area | `settings-page` interface: a KCM is a component with grants only for its own config groups **[designed]** | components | +| KConfig / kconfig XT | Hierarchical typed config, cascading, immutable keys | `config-store` interface: `group/key → value` variant, change events, layered (system < user < activity) **[designed]** | store in **host** (needs durable FS), policy in components | +| KNotifications / `plasma-workspace` notification server | `org.freedesktop.Notifications`, history, DND | `notifications` interface (apps `notify`), `notification-center` component renders toasts + history **[designed]** | components | +| StatusNotifierItem / system tray | Tray icons + menus from apps | `tray-registry` (items register `tray-item` exports), `system-tray` widget **[designed]** | components | +| `ksmserver` / `startplasma` / systemd integration | Session start, restore, logout | `session` interface (logout, suspend, lock; power events) **[designed]**; **init sequence** = host reads `session.json`, starts a `session-manager` component which starts the rest | host (bootstrap only) + component | +| KGlobalAccel / KWin shortcuts | Global shortcuts | `shortcuts` interface: components register accelerators → action ids; host matches raw key events against the table **[designed]** | table in host (input path), policy in component | +| Activities (`kactivitymanagerd`) | Per-activity layouts/history | `activities` component holding current activity; `config-store` layering keys on it **[designed]** | component | +| KIO / Dolphin | URL-based VFS, file manager | `vfs` interface with URL schemes; `vfs-provider` components (`file`, `trash`, `sftp`…); Dolphin = a component app using `vfs` + `plasmoid`-style render lists **[designed]** | providers: components atop host `fs`/`net` capabilities | +| Klipper | Clipboard manager | `clipboard` interface (read/write typed MIME list; separate read/write grants) **[designed]** | host owns the system clipboard; history = component | +| Powerdevil, solid | Power & hardware | `power`/`devices` interfaces **[designed]** | host (hardware), policy = component | +| KScreen | Output config | `outputs` interface **[designed]** | host (display), UI = KCM component | +| KWallet | Secrets | `secrets` interface; separate trust level **[designed]** | component with a very narrow grant | +| Baloo | File index | `search-provider` over `vfs` **[designed]** | component | +| SDDM | Login | `login` world: a full shell variant that gets `auth` capability **[open]** | component | + +## 2. What is in the host, and nothing else + +The host is the trusted computing base. Rule of thumb: **if it can be expressed as +"a pure function of its inputs + capabilities we hand it", it is a component.** +The host only does what a component *cannot* do by construction: + +1. **Engine & lifecycle** – compile/instantiate components, supervise them + (trap → visible fault + restart policy), enforce resource limits + (fuel/epoch deadlines on wasmtime; **not available under jco** — a looping + component can hang the M0 host, a known limitation), hot-swap instances. +2. **Capability broker** – owns the *only* path from components to the outside + world; wires each instance with exactly the interface implementations it is + granted (§6). +3. **Device ownership** – display/DRM/GPU, input devices (libinput), audio, + network sockets, real filesystem, clipboard, D-Bus/portal bridges. Components + see these only through narrow WIT interfaces. +4. **Render-list rasteriser / scanout** – turns the composed render-list into + pixels (Canvas2D in M0). It interprets a *closed vocabulary* of draw-ops; it + has no policy. +5. **Input demux & delivery** – reads raw events, applies the shortcut table, + delivers the rest to the focus/grab target the `window-manager`/shell + component names (§5). +6. **Bootstrap** – reads `session.json` (which components, which grants) and + starts the session-manager component. + +Everything else – panel layout, window placement, focus policy, decorations, +theming, search, notifications, settings UIs, tray, the launcher – is a component +and can be replaced by a different `.wasm` that implements the same world. + +```mermaid +flowchart TB + subgraph host["host (trusted, small)"] + eng["engine + supervisor + hot-swap"] + cap["capability broker"] + ras["render-list rasteriser / scanout"] + inp["input demux"] + dev["devices: display, input, fs, net, clipboard"] + end + subgraph comps["components (sandboxed, swappable)"] + shell["shell (desktop-surface, panel-layout)"] + wm["window-manager policy"] + w1["widget: clock"] + w2["widget: launcher"] + run["runner + search providers"] + notif["notification-center"] + kcm["settings pages"] + end + comps -- "typed WIT calls\n(host-mediated)" --> host + host -- "render-list" --> ras --> dev + dev -- "raw input" --> inp --> comps + cap --- comps +``` + +## 3. Component-to-component communication: host-mediated calls (decision) + +Options considered: + +| | static composition (`wasm-tools compose`/WAC) | dynamic linking / shared-everything | **host-mediated typed calls (chosen)** | +|---|---|---|---| +| Hot-swap one part | re-link and restart the composite | not available in toolchains yet | swap one instance; others keep state | +| Per-link capability attenuation | none (composed = same trust) | none | yes: each instance gets its own import wiring | +| Fault isolation | one trap kills the composite | n/a | per-instance | +| Third-party/untrusted widgets | no | no | yes | +| Cost | none (direct calls) | none | host call per hop (JS: ~µs; fine for UI-rate calls) | +| Maturity today | good (`wac`, `wasm-tools compose`) | immature | works now (what M0 does) | + +**Decision:** components never call each other directly. The host holds the +instances and routes: today it is hub-and-spoke (host → shell for layout, host → +widget for render/events, as in `host/src/desktop.mjs`), later through a +**service registry**: a component *exports* a typed interface (e.g. +`search-provider`), the host lets *importers* with the matching grant call it, +via a host-owned `registry` interface (`lookup(interface-name) → handle`). +Messages stay typed WIT values (records/variants); no stringly-typed JSON bus. +Event broadcast (theme changed, activity changed) is a `subscribe/poll` pair +until component-model async (WASI p3) is usable in our hosts. + +Static composition remains available as a **build-time optimisation inside one +trust domain** (e.g. fusing `shell` with a built-in tray into one `.wasm`), never +across grants. + +## 4. Rendering: shared render-list, not per-component textures (decision) + +Components return **render-lists** (`list`, see `wit/types.wit`) in +their own local coordinates; the host/compositor translates, clips, orders and +rasterises them. Components never receive pixels or GPU handles. + +Why: it is sandbox-friendly (no shared memory, nothing to leak or overrun), +serialisable (record/replay, remote desktop, golden-file tests — the ASCII and +scene-JSON dumps in M0 are exactly this), host-agnostic (Canvas2D now, +Skia/wgpu/software later, all from the same WIT), and cheap for UI-sized scenes. + +Costs and mitigations: (a) copying lists across the boundary each frame → +add a revision counter and let `render` return "unchanged" so the host reuses the +cached list; add damage rects; (b) text needs metrics → M0 uses a fixed 0.6 em +advance contract; a host `text` interface (`measure`, shaping, fonts) is the next +step; (c) content that is *not* vector (video, foreign Wayland/X clients, WebGL +canvases) → add a second surface kind: a WIT **resource** `buffer-surface` +(dmabuf/shm handle owned by the host, written by a granted producer) which the +render-list references via a `draw-surface` op **[designed, M5]**. + +The UI toolkit question: components can link any MoonBit library into +themselves. `moon-gpui` (GPUI port) is a natural fit because its scene/geometry/ +colour packages map almost 1:1 onto our draw-op vocabulary; in that arrangement +GPUI runs *inside each component* and its scene is flattened into +`list`. This is **[open]**: `/workspace/moon-gpui` currently only has a +README, so nothing was verified. + +## 5. Input routing + +* The host reads raw device events and (a) matches them against the global + shortcut table, (b) otherwise hands them to the **routing component**: + `window-manager`/`shell` returns the target (surface id, local coordinates, + grab/focus changes). This keeps focus-follows-mouse, click-to-raise, tiling + gestures, etc. as replaceable policy. +* **[M0 shortcut, stated honestly]** the host itself does hit-testing against the + placements the shell returned, and routes: popup > widget under pointer; + pointer-down outside an open popup sends `focus-lost` to the popup owner, then + falls through. Keyboard goes to the popup owner. This is ~60 lines of host code + and is the first thing to move into the shell component (M2). +* Events are values (`input-event` variant), delivered with surface-local + coordinates, so a component never learns screen geometry it was not given. + +## 6. Permission / capability model + +WASI-style, deny-by-default: + +1. A component's **imports are its declared needs.** `scripts/build.sh` records + them in `build/components/.meta.json` (derived from the binary). +2. The **desktop config** (`config/desktop.json`) *grants* capabilities per + component instance. **[M0]** The host refuses to start a component whose + imports are not all granted (`PermissionError`), rejects unknown capability + names, and wires only granted interfaces into the import object. + Tests: `host/test/desktop.test.mjs`. +3. **Attenuation, not just on/off [designed]:** a grant supplies the host's + implementation of the interface *for that instance*: a `vfs` granted to + System Settings is rooted at `~/.config`, the same interface granted to a + file manager is rooted at `$HOME`; `config-store` is scoped to named groups; + `net` carries a host allowlist. +4. **Unforgeable handles:** capabilities that are objects (an open file, a + `buffer-surface`, a notification handle) are WIT `resource`s — a component can + only use handles the host gave it. +5. **User consent [designed]:** requests outside the manifest go to a + `permission-prompt` component (itself heavily restricted); decisions persist in + `config-store`. +6. **Supervision [M0 partial]:** a trapping component becomes a *visible* error + tile + a recorded fault (never swallowed); the CLI exits non-zero when faults + exist. Automatic restart/backoff is **[designed]**. + +## 7. Versioning WIT packages + +* Packages are semver'd (`moonplasma:desktop@0.1.0`). While `0.x`, any minor may + break; components pin the exact package version in their world. +* From `1.0`: **additive-only minors** – new interfaces, new functions, new + worlds, new variant cases at the *end* only when consumers are required to + handle unknown cases. WIT records cannot grow compatibly, so anything likely to + grow (e.g. `plasmoid-info`, `tokens`) should become `record` + `option`/`list` + extension points before 1.0, or be replaced by a new interface version + (`plasmoid@1.1`) that the host serves alongside the old one. +* Split by domain so versions move independently: `moonplasma:desktop` (types, + theme, plasmoid, panel), later `moonplasma:wm`, `moonplasma:search`, + `moonplasma:notify`, `moonplasma:config`, `moonplasma:session`, `moonplasma:vfs`. +* The host advertises the set of interface versions it implements and may + serve N and N-1 side by side via adapters; a component declares what it + targets and fails to load otherwise (no silent downgrade). +* CI gate **[M0]**: every component must pass `wasm-tools component targets + --world wit `; generated bindings must match `wit/` + (`scripts/gen-bindings.sh --check`). Registry publication (OCI/warg) **[open]**. + +## 8. Host strategy (decision and feasibility) + +| Option | What it is | Time-to-pixels | Fits the "everything is a component" goal | Main risks | +|---|---|---|---|---| +| **(a) Browser/Node host with jco** | components transpiled to JS+core wasm; host in JS; Canvas2D now, WebGPU later | **hours — done in M0** | components yes; host = JS runtime (large TCB: browser) | no real windows/devices; JS can't pre-empt a looping component; browser is not a desktop session | +| **(b) Native host embedding wasmtime** | Rust host using `wasmtime::component` + `bindgen!`; software/GPU rendering into a window (winit/SDL) or DRM | days–weeks | best: small native TCB, fuel/epoch limits, real FS/net/devices | host is Rust, not MoonBit; wasmtime's C API cannot instantiate components with host imports as conveniently, so a MoonBit-native host via FFI is **unverified** and probably not worth it | +| **(c) Nested compositor in an existing session** | (b) running as a window/Wayland client first, later a real compositor (smithay) hosting foreign Wayland apps | weeks–months | needed to run real apps | scope; Wayland/EGL/input details | + +**Recommendation:** (a) for M0–M2 (done: it is the fastest way to prove the WIT +design with real MoonBit components), then (b) as the *reference host* in M3–M4 +using the **same WIT and the same build outputs** (the components are standard; +only `host/` changes), then (c) from M5 as the path to real windows. The WIT stays +host-agnostic: nothing in `wit/` mentions JS, a browser or a window system. What +does **not** transfer is `host/src/desktop.mjs`; it is intentionally small +(~200 lines) and is the executable spec for the Rust host. + +## 9. Interface catalogue + +Implemented in `wit/` (package `moonplasma:desktop@0.1.0`): + +| Interface | Purpose | +|---|---| +| `types` | geometry, colour, `draw-op` render-list vocabulary, `input-event`, `datetime`, `app-entry` | +| `theme` | `get-tokens()` – palette + metrics (read per render so theme swaps are live) | +| `plasmoid` (export) | `info`, `render(size)`, `popup`, `on-event(surface, event)` | +| `panel-layout` (export) | `compute-layout`, `render-panel`, `popup-position` | +| `desktop-surface` (export) | `render-background` | +| `clock`, `app-catalog`, `app-launch` (imports) | host capabilities used by the PoC widgets | + +Worlds: `widget` (theme + plasmoid), `clock-widget`, `launcher-widget`, `panel`, `shell`. + +Designed next (no WIT yet): `window-registry`/`wm-policy`/`decoration`, `search-provider`, +`config-store`, `notifications`, `tray-registry`, `shortcuts`, `clipboard`, `session`/`power`, +`vfs`, `activities`, `settings-page`, `registry`, `buffer-surface`, `text`. + +## 10. What is a PoC stub today + +* Host does hit-testing/routing (see §5), time and app list are host-provided statics. +* `app-launch.launch` records the id and logs; it does not start anything. +* Text uses a fixed-advance contract; no font/shaping/icon interfaces (glyph letters stand in for icons). +* No window manager, compositor, notifications, settings, tray, session, shortcuts, clipboard, files. +* Theme is a JSON file read by the host, not a `theme-provider` component. +* No resource limits under jco; no hot reload on file change (swap is an API call). + +## 11. Roadmap + +| M | Goal | Status | +|---|---|---| +| **M0** | Toolchain proof, WIT v0.1 (`widget`/`panel`/`shell`), host (Node+browser), 4 components, tests, CI, swap/theme/permission demos | **done (this PR)** | +| M1 | `config-store` + `theme-provider` component; persisted settings; hot reload of `.wasm` on change; `text` interface (measure/fonts) and icon theme | next | +| M2 | Move input routing + focus policy into the shell/WM component; more widgets (task manager stub, system tray, notifications toasts); `search-provider` + KRunner component | | +| M3 | Native reference host: Rust + wasmtime (`bindgen!`), software rasteriser into a winit window, fuel/epoch limits, restart supervision; CI runs the *same* integration tests against both hosts | | +| M4 | Window-manager world with synthetic windows (no real apps yet): stacking/tiling policies as swappable components, decorations, virtual desktops, activities | | +| M5 | Nested compositor (smithay) hosting real Wayland clients; `buffer-surface` resource; GPU rasteriser | | +| M6 | Settings (KCM-style) framework, notifications daemon bridge (D-Bus portal), tray (SNI bridge), clipboard, power/session | | +| M7 | `vfs` + file manager component; search/indexer; look-and-feel packages | | +| M8 | Standalone session (DRM/KMS + libinput), login manager world, packaging/registry for components | | + +## 12. Open design questions (with recommendations) + +1. **Host language/long-term host** — Rust+wasmtime native host vs trying to keep even the host in MoonBit. *Recommend Rust+wasmtime for M3; revisit MoonBit-native host only if wasmtime's C API gains full component embedding.* +2. **Render-list vs textures** — *Recommend render-list as the default, `buffer-surface` resource only for non-vector content (§4).* +3. **UI toolkit inside components** — adopt `moon-gpui` or a tiny immediate-mode helper (`lib/ui`)? *Recommend `lib/ui` until moon-gpui has a stable scene package and a flatten-to-draw-op adapter, then migrate widget internals; keep the WIT draw-op vocabulary as the stable boundary.* +4. **Text and fonts** — host-provided shaping (`text` interface) vs components bundling a shaper. *Recommend host-provided: layout needs metrics from the same engine that rasterises.* +5. **Async** — wait for WASI p3 async in jco/wasmtime/wit-bindgen-moonbit or keep sync + poll. *Recommend sync + poll through M3; the backend support exists but hosts are not uniformly ready.* +6. **Who owns hit-testing** — move to the shell/WM component at M2 (§5). *Recommend yes, host only for grabs it must enforce (shortcuts, secure attention).* +7. **Config format & ownership** — KConfig-like INI layering vs structured store. *Recommend a typed `config-store` with layered scopes (system/user/activity) and change events; INI import/export as a component.* +8. **Packaging & trust** — signed component bundles with manifests (grants requested, WIT versions targeted) vs bare `.wasm` + config. *Recommend a manifest custom section in the `.wasm` + signature, host shows requested grants; M3+.* +9. **Foreign-app strategy** — nested Wayland (M5) vs only native components. *Recommend nested Wayland; otherwise the desktop is not usable day to day.* +10. **Plasma compatibility** — try to load real plasmoid QML/KPackages? *Recommend no; mimic concepts (containments, plasmoids, KCM, KRunner plugins) but not binary/QML compatibility.* diff --git a/docs/TOOLCHAIN.md b/docs/TOOLCHAIN.md new file mode 100644 index 0000000..45cd441 --- /dev/null +++ b/docs/TOOLCHAIN.md @@ -0,0 +1,124 @@ +# Toolchain: what works today (verified 2026-11-24) + +Everything here was run on x86_64 Linux (glibc 2.43 locally; CI uses +`node:20-bookworm`, glibc 2.36), without root. + +## Verdict + +**MoonBit can produce real WebAssembly Components today**, via the official +`wit-bindgen moonbit` backend plus `wasm-tools component new`. No MoonBit +compiler flag is needed: MoonBit emits a *core* wasm module (linear-memory +`wasm` target) that exports the canonical-ABI symbols `wit-bindgen` generated, +and `wasm-tools` wraps it into a component. + +| Piece | Status | Notes | +|---|---|---| +| `moon build --target wasm` | works | Used for all components (linear memory, own GC/alloc). | +| `moon build --target wasm-gc` | not usable for components | The canonical ABI needs linear memory + `cabi_realloc`; wit-bindgen's MoonBit backend targets `wasm` only (`preferred_target = "wasm"` in the generated `moon.mod`). | +| `wit-bindgen moonbit` (0.63.0) | works | Generates guest bindings: types, imports, `declare pub fn` stubs for exports, `link.exports` config. Handles records, variants, enums, options, results, lists, strings. Resources/async/streams exist in the backend but are **not** used here. | +| `wasm-tools component embed/new` (1.263.0) | works | `--encoding utf16` (MoonBit strings are UTF-16). | +| `wasm-tools component targets` | works | Used as a **WIT conformance test**: asserts each component implements its declared world. | +| `jco transpile` (1.42.0) | works | Component → JS + core wasm. Used for the M0 host. `--instantiation async` lets the host pass a *per-instance* import object, which is how capability grants work. | +| `wasmtime` (51.0.0) | validates/compiles | `wasmtime compile` accepts every component. We do **not** run them under wasmtime yet: a component with host imports needs an embedder (Rust/C-API) to supply them — `wasmtime run` cannot. That is M4. | +| mooncakes packages | see below | Nothing needed at M0. | + +### Pipeline + +``` +wit/*.wit ──wit-bindgen moonbit──▶ interface/ world/ components//gen/ (committed) + │ + stub.mbt (hand-written, thin) → lib/* (pure logic, unit-tested) +moon build --target wasm --release ──▶ _build/.../gen.wasm (core module) +wasm-tools component embed wit --world W --encoding utf16 ─▶ wasm-tools component new ─▶ build/components/.wasm +wasm-tools component targets --world W wit .wasm (conformance) +jco transpile --instantiation async ─▶ build/jco// (host glue) +``` + +Component sizes are 24–33 KB each (release build, no wasm-opt). + +### Workflow details / gotchas found + +* `wit-bindgen moonbit` does **not** write a stub for exported functions in this + version; export packages contain `declare pub fn …` and you implement them in + a `stub.mbt` *in the same package*. We keep `stub.mbt` to adapters only; logic + lives in `lib/*` packages so `moon test` can cover it. +* Using one `--out-dir .` with a distinct `--gen-dir components//gen` per + component makes all components share **one** copy of the imported types + (`interface/…/types`), so `lib/*` helpers work across components. +* Generated helper functions are emitted in nondeterministic order, so + `scripts/gen-bindings.sh --check` compares sorted lines, not bytes. +* `moon.mod.json` is no longer accepted by this moon (0.1.20261119): use `moon.mod`. +* jco strips the `@version` from import keys (`moonplasma:desktop/clock`), and + maps WIT `variant` → `{tag, val}`, `enum` → string, `option` → value/`undefined`, + `result` import returns → `{tag:'ok'|'err', val}` (or throw). +* `moon test` runs on the wasm target through `moonrun`; packages that import the + generated `types` package are testable (the extern "wasm" helpers are only called + at the boundary). +* wit-bindgen 0.63 moonbit emits deprecation warnings under newer moon + (`#deprecated pub extend`); harmless. + +### Packages surveyed on mooncakes.io (for later milestones) + +| Package | Relevance | Backends / caveat | +|---|---|---| +| `mizchi/wit` 0.4.x | WIT parser/resolver in MoonBit | could power an in-MoonBit `moon-plasma` CLI that inspects worlds; not needed at M0 | +| `moonrockz/wit` | WIT scanner/CST/formatter | same | +| `mizchi/wite` 0.11 | component-aware analyzer/optimizer (`wite` can verify a component against WIT, compose WAC) | candidate replacement for `wasm-tools` size/verify steps | +| `moonbitlang/async` | async runtime (native/…); not a component-model async | the component-model async ABI (WASIp3) is in wit-bindgen's backend but out of scope until hosts support it | +| `moonbitlang/core/json` | JSON | core, all backends — for the settings store (M3) | + +The `wasm2elf-mb`, `moonview`, `webby`, `curl-wasm`, `moon-mud` and `moon-gpui` +checkouts on this machine were consulted for conventions only; nothing is +imported from them. (`moon-gpui` currently contains only a README here — the +`docs/PORTING.md` referenced in the task is not present in `/workspace/moon-gpui`.) + +## Exact setup + +```bash +# 1. MoonBit (not installed by our scripts) +curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash # moon 0.1.20261119 +export PATH="$HOME/.moon/bin:$PATH" + +# 2. wasm-tools, wit-bindgen, wasmtime → ./.tools/bin (versions in scripts/versions.env) +scripts/setup-toolchain.sh + +# 3. jco + playwright-core → host/node_modules (Node ≥ 20) +(cd host && npm ci) + +# 4. build every component, then test everything +scripts/build.sh # or: scripts/build.sh clock-binary (one component only) +scripts/test.sh +``` + +Pinned versions: moon 0.1.20261119 (moonc `738607b`), wasm-tools 1.263.0, +wit-bindgen 0.63.0, wasmtime 51.0.0, jco 1.42.0, Node 20/24. + +### Hello-world proof (what `scripts/build.sh` does for `clock-digital`) + +```bash +wit-bindgen moonbit wit --world clock-widget --out-dir . \ + --gen-dir components/clock-digital/gen --project-name moonplasma/desktop --ignore-module-file +moon build --target wasm --release +wasm-tools component embed wit _build/wasm/release/build/components/clock-digital/gen/gen.wasm \ + --world clock-widget --encoding utf16 -o e.wasm +wasm-tools component new e.wasm -o build/components/clock-digital.wasm +wasm-tools component wit build/components/clock-digital.wasm +# world root { import moonplasma:desktop/types@0.1.0; +# import moonplasma:desktop/clock@0.1.0; +# import moonplasma:desktop/theme@0.1.0; +# export moonplasma:desktop/plasmoid@0.1.0; } +jco transpile build/components/clock-digital.wasm -o build/jco/clock-digital --instantiation async +node host/src/cli.mjs --time 2026-11-24T14:07:00 # instantiates all components, prints the desktop +``` + +### Browser screenshots + +`scripts/screenshot.mjs` drives the browser host in headless Chromium through +`playwright-core`. It needs a Chromium **headless shell** binary; locally: + +```bash +export CHROME_PATH=$(ls ~/.cache/ms-playwright/chromium_headless_shell-*/*/chrome-headless-shell) +node scripts/screenshot.mjs docs/screenshots --tag m0 +``` + +(The full `chrome` binary under `chromium-*/` hung on launch in this sandbox; the headless shell works.) +CI does not take screenshots (no browser in the job image); the Node host tests cover the same code path minus Canvas2D. diff --git a/docs/screenshots/m0-1-desktop.png b/docs/screenshots/m0-1-desktop.png new file mode 100644 index 0000000..95b83b5 Binary files /dev/null and b/docs/screenshots/m0-1-desktop.png differ diff --git a/docs/screenshots/m0-2-launcher-open.png b/docs/screenshots/m0-2-launcher-open.png new file mode 100644 index 0000000..6b12d3b Binary files /dev/null and b/docs/screenshots/m0-2-launcher-open.png differ diff --git a/docs/screenshots/m0-3-binary-clock-swapped.png b/docs/screenshots/m0-3-binary-clock-swapped.png new file mode 100644 index 0000000..baa6559 Binary files /dev/null and b/docs/screenshots/m0-3-binary-clock-swapped.png differ diff --git a/docs/screenshots/m0-4-day-theme.png b/docs/screenshots/m0-4-day-theme.png new file mode 100644 index 0000000..a535914 Binary files /dev/null and b/docs/screenshots/m0-4-day-theme.png differ diff --git a/host/package-lock.json b/host/package-lock.json new file mode 100644 index 0000000..4e9d6e9 --- /dev/null +++ b/host/package-lock.json @@ -0,0 +1,3141 @@ +{ + "name": "moon-plasma-host", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "moon-plasma-host", + "version": "0.1.0", + "devDependencies": { + "@bytecodealliance/jco": "1.42.0", + "playwright-core": "^1.50.0" + } + }, + "node_modules/@andreiltd/componentize-qjs-binding-darwin-arm64": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@andreiltd/componentize-qjs-binding-darwin-arm64/-/componentize-qjs-binding-darwin-arm64-0.5.0.tgz", + "integrity": "sha512-JuFOac1TF2uo8IVD49EiChvOgUiKjN9euXFcQPcPnqW12Yqp2dWmyW1GQSFVoxtHJEh6AnvkJbpq1yaR/pW9RA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@andreiltd/componentize-qjs-binding-darwin-x64": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@andreiltd/componentize-qjs-binding-darwin-x64/-/componentize-qjs-binding-darwin-x64-0.5.0.tgz", + "integrity": "sha512-kvF5qv8WXsH0z3N7FkI8BiaPA52+/e6Mz6mDSMgOm0JDO7mNtvcuRZkENrTol38R+4R7fr2TOq06GOq1gLhIQA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@andreiltd/componentize-qjs-binding-linux-arm64-gnu": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@andreiltd/componentize-qjs-binding-linux-arm64-gnu/-/componentize-qjs-binding-linux-arm64-gnu-0.5.0.tgz", + "integrity": "sha512-7m4aCaM4eaPHO0/uI1nwSYcP9OwTiJBjw3IO6vle3ov3lipl+Jlqpu2nckxMM0tx5Q+RUnStIWWQhDsdJ35kmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@andreiltd/componentize-qjs-binding-linux-arm64-musl": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@andreiltd/componentize-qjs-binding-linux-arm64-musl/-/componentize-qjs-binding-linux-arm64-musl-0.5.0.tgz", + "integrity": "sha512-+nWPAPfmjM4BPEt0axyEwQbG26BhkmnxdvEjkvUa+7kVeVjyWlw7B3By+N+257WYDhwaIhp2mFnWYaSR8deyDg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@andreiltd/componentize-qjs-binding-linux-x64-gnu": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@andreiltd/componentize-qjs-binding-linux-x64-gnu/-/componentize-qjs-binding-linux-x64-gnu-0.5.0.tgz", + "integrity": "sha512-eX+34TYDMRgKA1huyqax91PjG6HutJXcLqA+Dxa4hZEqL1xglHYUhhfVnVwgWrfMPejRTX8XiFKyvBqYP0DtqA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@andreiltd/componentize-qjs-binding-linux-x64-musl": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@andreiltd/componentize-qjs-binding-linux-x64-musl/-/componentize-qjs-binding-linux-x64-musl-0.5.0.tgz", + "integrity": "sha512-5lRm08zbY6Bu78yTTSRnvYs1m4yXKISmNxXEPQO262Chp4JPMqnb2bYIrSwEmTVZWAEbqZuEEhHkX9p8kBpAMA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@andreiltd/componentize-qjs-binding-win32-arm64-msvc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@andreiltd/componentize-qjs-binding-win32-arm64-msvc/-/componentize-qjs-binding-win32-arm64-msvc-0.5.0.tgz", + "integrity": "sha512-c8fXs5sc5dOUp+cCLzYFRNcae7v/nXll3+FEGD7alIBoHkboTcwGumAnEoZY325ko1y3wyV4d6FVSNkU6a8W8w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@andreiltd/componentize-qjs-binding-win32-x64-msvc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@andreiltd/componentize-qjs-binding-win32-x64-msvc/-/componentize-qjs-binding-win32-x64-msvc-0.5.0.tgz", + "integrity": "sha512-xKxyDjKKpopKoEwY5lFjODqICv/LiPXtLsrSFB3TuXnF7XjcnzD2xhDCa2DnhjqNl7FOhOji19k6EO8H5nDB9A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@bytecodealliance/componentize-js": { + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.23.0.tgz", + "integrity": "sha512-Qc2+lrwJHU7lq4CBMyVVYE8ASyUFeegMYdRnMVG0wNpNiATzGDF/mWpjDNTeVZeT8L9chhK3vuLaQE9FVANvfw==", + "dev": true, + "workspaces": [ + "." + ], + "dependencies": { + "@bytecodealliance/jco": "^1.15.1", + "@bytecodealliance/weval": "^0.5.0", + "@bytecodealliance/wizer": "^10.0.0", + "es-module-lexer": "^1.6.0", + "oxc-parser": "^0.76.0" + }, + "bin": { + "componentize-js": "src/cli.js" + } + }, + "node_modules/@bytecodealliance/componentize-js-0-19-3": { + "name": "@bytecodealliance/componentize-js", + "version": "0.19.3", + "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.19.3.tgz", + "integrity": "sha512-ju7Y4WeF0B9uMkSPHJgmT6ouEfSwbe9M1uR/YOnYZjBpxJjH9qzxIkJg/kf8NycVDyFJ2/lscmJ1E1uPiDQVRQ==", + "dev": true, + "workspaces": [ + "." + ], + "dependencies": { + "@bytecodealliance/jco": "^1.15.1", + "@bytecodealliance/wizer": "^10.0.0", + "es-module-lexer": "^1.6.0", + "oxc-parser": "^0.76.0" + }, + "bin": { + "componentize-js": "src/cli.js" + } + }, + "node_modules/@bytecodealliance/jco": { + "version": "1.42.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-1.42.0.tgz", + "integrity": "sha512-kQZ+Y4Gcc5XIXP+sKNAya+ZvOQxO0l5QFLlpmx5KUwlpeAaNK0+81mjx24Iq5evQac5MA0U/2YxMaI+xGSDacA==", + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)", + "dependencies": { + "@bytecodealliance/componentize-js": "^0.23.0", + "@bytecodealliance/componentize-js-0-19-3": "npm:@bytecodealliance/componentize-js@^0.19.3", + "@bytecodealliance/jco-std": "^0.11.0", + "@bytecodealliance/jco-transpile": "^0.24.0", + "@bytecodealliance/preview2-shim": "^0.31.1", + "binaryen": "^132.0.0", + "commander": "^14", + "componentize-qjs": "^0.5.0", + "mkdirp": "^3", + "regexpu-core": "6.4.0", + "rolldown": "^1.2.4", + "typescript": "7.0.2", + "typescript-compiler-api": "npm:typescript@6.0.3", + "unenv": "2.0.0-rc.24" + }, + "bin": { + "jco": "dist/jco.js" + } + }, + "node_modules/@bytecodealliance/jco-node-fs": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-node-fs/-/jco-node-fs-0.3.2.tgz", + "integrity": "sha512-yxvqQreNcOQdMsEKZomkSqThtkxrAz3f1Cmy8BsV0UHi9saa2/D1KDB14IAXPYwDq/maS6lCzS+MuMQx6QkUgA==", + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)", + "engines": { + "node": ">=20" + }, + "optionalDependencies": { + "@bytecodealliance/jco-node-fs-darwin-arm64": "0.3.2", + "@bytecodealliance/jco-node-fs-darwin-x64": "0.3.2", + "@bytecodealliance/jco-node-fs-linux-arm64-gnu": "0.3.2", + "@bytecodealliance/jco-node-fs-linux-arm64-musl": "0.3.2", + "@bytecodealliance/jco-node-fs-linux-x64-gnu": "0.3.2", + "@bytecodealliance/jco-node-fs-linux-x64-musl": "0.3.2", + "@bytecodealliance/jco-node-fs-win32-arm64-msvc": "0.3.2", + "@bytecodealliance/jco-node-fs-win32-x64-msvc": "0.3.2" + } + }, + "node_modules/@bytecodealliance/jco-node-fs-darwin-arm64": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-node-fs-darwin-arm64/-/jco-node-fs-darwin-arm64-0.3.2.tgz", + "integrity": "sha512-WXQq1tRVUWhbK+ImH0G8Kni2AR0sdokLf/KyXRw5P6n4A9ZbgMHOuPfN/PEsYgw4eosuTAonutK0xILk/hA81A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20" + } + }, + "node_modules/@bytecodealliance/jco-node-fs-darwin-x64": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-node-fs-darwin-x64/-/jco-node-fs-darwin-x64-0.3.2.tgz", + "integrity": "sha512-Fy/OjHnto7hNE5ksewVkmAMXG/uXyj+RAKFZWQFTzFkp73UyT5vuPjKq3nvx9KolUGWBG37BudEMb4ZAoD9TbQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20" + } + }, + "node_modules/@bytecodealliance/jco-node-fs-linux-arm64-gnu": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-node-fs-linux-arm64-gnu/-/jco-node-fs-linux-arm64-gnu-0.3.2.tgz", + "integrity": "sha512-OafRtRu3tfOFQARfkia/LDEqSo2R3yAL1xPwzf4RcRW6JqkOY7qKWsUS5+LPVo/aFaSkMX7F7bdFGpFPmcoZJg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "(Apache-2.0 WITH LLVM-exception)", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20" + } + }, + "node_modules/@bytecodealliance/jco-node-fs-linux-arm64-musl": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-node-fs-linux-arm64-musl/-/jco-node-fs-linux-arm64-musl-0.3.2.tgz", + "integrity": "sha512-JblDiwD7+Y+w0d/tjaNDX4QdGvh5lyuDc+S/jDeT7sYA1caA9yiwIjLa8PC/lm2xudqSxD+Cuy4AosXvl+qI0g==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "(Apache-2.0 WITH LLVM-exception)", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20" + } + }, + "node_modules/@bytecodealliance/jco-node-fs-linux-x64-gnu": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-node-fs-linux-x64-gnu/-/jco-node-fs-linux-x64-gnu-0.3.2.tgz", + "integrity": "sha512-6FzmHoLOsa6b4X9AuFLsvlpNF66Dt4sRRftZHaT1I1pYzCWrJkkpgNJhRXxf67ZPmOwBZJT4dan/g752Rx4xRw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "(Apache-2.0 WITH LLVM-exception)", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20" + } + }, + "node_modules/@bytecodealliance/jco-node-fs-linux-x64-musl": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-node-fs-linux-x64-musl/-/jco-node-fs-linux-x64-musl-0.3.2.tgz", + "integrity": "sha512-SbAJG2PDV8YAHBESHU9sVSckOitJyvlezdF4CGP5/mOp01JnijVkLVXzGK62yVSfa5TpAybbSd1rk+v36NAW/Q==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "(Apache-2.0 WITH LLVM-exception)", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20" + } + }, + "node_modules/@bytecodealliance/jco-node-fs-win32-arm64-msvc": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-node-fs-win32-arm64-msvc/-/jco-node-fs-win32-arm64-msvc-0.3.2.tgz", + "integrity": "sha512-nUWYdFysRQJGsIOCk0KAYN2smkNYiHG7rZ7m+0ZXqP+5wqWxKEjkDsORwXiBjdaWFLVww0anZ3SBxrju6P7hXQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20" + } + }, + "node_modules/@bytecodealliance/jco-node-fs-win32-x64-msvc": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-node-fs-win32-x64-msvc/-/jco-node-fs-win32-x64-msvc-0.3.2.tgz", + "integrity": "sha512-RsPj2t8TvltsMWK7/Z7JcVC/IWPMi07/AJkNLiNTCuGTdT/sseqTThJJwhuz3sjFw7dJdxA+bSGT+23y/KT0fw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20" + } + }, + "node_modules/@bytecodealliance/jco-std": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-std/-/jco-std-0.11.0.tgz", + "integrity": "sha512-f1mWZ9Ixg47Fdy5whK+73xIFSzzQRm7xIHLOoNyumWU0cQKqc5t+SiE9sZiWiyYvKQMwmtFlN1JVQ5yNK20BjA==", + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)", + "dependencies": { + "@noble/hashes": "1.8.0", + "acorn": "8.17.0", + "acorn-walk": "8.3.5", + "minimatch": "10.2.6", + "punycode": "2.3.1", + "readable-stream": "4.7.0", + "urlpattern-polyfill": "10.1.0", + "web-streams-polyfill": "4.2.0", + "whatwg-url": "14.2.0" + }, + "peerDependencies": { + "@bytecodealliance/preview2-shim": "^0.31.1" + }, + "peerDependenciesMeta": { + "@bytecodealliance/preview2-shim": { + "optional": true + } + } + }, + "node_modules/@bytecodealliance/jco-transpile": { + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco-transpile/-/jco-transpile-0.24.0.tgz", + "integrity": "sha512-ISCXvZc+TOX07L+V9WhO7tg8zv1zj9Ll48tT0tKZTUo5O5Cxwn2tCSAMvDtA6Ni6V0baosB3XCaBVFkLNpuBSA==", + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)", + "dependencies": { + "@bytecodealliance/preview2-shim": "^0.31.1", + "@bytecodealliance/preview3-shim": "^0.14.1", + "binaryen": "^132.0.0", + "oxc-minify": "^0.151.0" + } + }, + "node_modules/@bytecodealliance/preview2-shim": { + "version": "0.31.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.31.1.tgz", + "integrity": "sha512-uDVB/IhExDW70TquqVx2l2Q5uwwpH7r5M2ltYccux+0YxXBm4TvqyNHTyYxcoLBsoAar28o7uZSj7GOKVx9uvA==", + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)", + "dependencies": { + "@bytecodealliance/jco-node-fs": "0.3.2" + } + }, + "node_modules/@bytecodealliance/preview3-shim": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/preview3-shim/-/preview3-shim-0.14.1.tgz", + "integrity": "sha512-rUFh6kIFQEjGbe/TwbGhQPQojOZFiXwk/qr9M21fik3CC/Kk1UJsP9OHNhcdPni6W1+P8ITx/6iJnno+me7Cig==", + "dev": true, + "license": "(Apache-2.0 WITH LLVM-exception)", + "dependencies": { + "@bytecodealliance/jco-node-fs": "0.3.2", + "@bytecodealliance/preview2-shim": "^0.31.1" + } + }, + "node_modules/@bytecodealliance/weval": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/weval/-/weval-0.5.1.tgz", + "integrity": "sha512-Hb8qRoF3b2UgkZqeDTzaTKGITa31KCLcoyfFstE/uO/aYVUyHweaNDchF4SNrPQfEpiBwRnMUilI4Jbbl8Hl6w==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@napi-rs/lzma": "^1.1.2", + "fflate": "^0.8.3", + "tar": "^7.5.19" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@bytecodealliance/wizer": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer/-/wizer-10.0.0.tgz", + "integrity": "sha512-ziWmovyu1jQl9TsKlfC2bwuUZwxVPFHlX4fOqTzxhgS76jITIo45nzODEwPgU+jjmOr8F3YX2V2wAChC5NKujg==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "wizer": "wizer.js" + }, + "engines": { + "node": ">=16" + }, + "optionalDependencies": { + "@bytecodealliance/wizer-darwin-arm64": "10.0.0", + "@bytecodealliance/wizer-darwin-x64": "10.0.0", + "@bytecodealliance/wizer-linux-arm64": "10.0.0", + "@bytecodealliance/wizer-linux-s390x": "10.0.0", + "@bytecodealliance/wizer-linux-x64": "10.0.0", + "@bytecodealliance/wizer-win32-x64": "10.0.0" + } + }, + "node_modules/@bytecodealliance/wizer-darwin-arm64": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-darwin-arm64/-/wizer-darwin-arm64-10.0.0.tgz", + "integrity": "sha512-dhZTWel+xccGTKSJtI9A7oM4yyP20FWflsT+AoqkOqkCY7kCNrj4tmMtZ6GXZFRDkrPY5+EnOh62sfShEibAMA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "bin": { + "wizer-darwin-arm64": "wizer" + } + }, + "node_modules/@bytecodealliance/wizer-darwin-x64": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-darwin-x64/-/wizer-darwin-x64-10.0.0.tgz", + "integrity": "sha512-r/LUIZw6Q3Hf4htd46mD+EBxfwjBkxVIrTM1r+B2pTCddoBYQnKVdVsI4UFyy7NoBxzEg8F8BwmTNoSLmFRjpw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "bin": { + "wizer-darwin-x64": "wizer" + } + }, + "node_modules/@bytecodealliance/wizer-linux-arm64": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-linux-arm64/-/wizer-linux-arm64-10.0.0.tgz", + "integrity": "sha512-pGSfFWXzeTqHm6z1PtVaEn+7Fm3QGC8YnHrzBV4sQDVS3N1NwmuHZAc8kslmlFPNdu61ycEvdOsSgCny8JPQvg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "bin": { + "wizer-linux-arm64": "wizer" + } + }, + "node_modules/@bytecodealliance/wizer-linux-s390x": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-linux-s390x/-/wizer-linux-s390x-10.0.0.tgz", + "integrity": "sha512-O8vHxRTAdb1lUnVXMIMTcp/9q4pq1D4iIKigJCipg2JN15taV9uFAWh0fO88wylXwuSlO7dOE1AwQl54fMKXQg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "bin": { + "wizer-linux-s390x": "wizer" + } + }, + "node_modules/@bytecodealliance/wizer-linux-x64": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-linux-x64/-/wizer-linux-x64-10.0.0.tgz", + "integrity": "sha512-fJtM1sy43FBMnp+xpapFX6U1YdTBKA/1T4CYfG/qeE8jn0SXk2EuiYoY/EnC2uyNy9hjTrvfdYO5n4MXW0EIdQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "bin": { + "wizer-linux-x64": "wizer" + } + }, + "node_modules/@bytecodealliance/wizer-win32-x64": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-win32-x64/-/wizer-win32-x64-10.0.0.tgz", + "integrity": "sha512-55BPLfGT7iT7gH5M69NpTM16QknJZ7OxJ0z73VOEoeGA9CT8QPKMRzFKsPIvLs+W8G28fdudFA94nElrdkp3Kg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "bin": { + "wizer-win32-x64": "wizer" + } + }, + "node_modules/@emnapi/core": { + "version": "2.0.0-beta.3", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-2.0.0-beta.3.tgz", + "integrity": "sha512-KA+gOBtbifRATmUa/Gpf5C2B2EJ0r4brHUT3XSgACeHREcuiObXH56xd+B3fFsEFbUT04VBEe6MuZiCtMp0tQg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "2.2.0", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "2.0.0-beta.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-2.0.0-beta.3.tgz", + "integrity": "sha512-ayb/PyyLzpwRyFVxeC0uoEHu59QlB1iWGcGsOpXQcaB/Dc+uGfBmNmpCHp3HmTT0t8lSsMmg3j7+tdJW/TlHjQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/wasi-threads": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-2.2.0.tgz", + "integrity": "sha512-JP7OYH38Q7+pyTAe14raZHLQIK7BDKbdwji+Xi3pcd/6QkJYQH3SX4wu6EplGrGJWRepoNzedfm0G3B9Z4e9Rw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@isaacs/fs-minipass": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz", + "integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==", + "dev": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.0.4" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/@napi-rs/lzma": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma/-/lzma-1.5.3.tgz", + "integrity": "sha512-QSIzELPyd2A7mcaDiJEWjwzApoAOWq9PVl9xYq+CxzIwstufv48s8aBgOUr0sgbjGmb15aYU88YKNaFaCaOuhQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^22.20 || ^24.12 || >=25" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "optionalDependencies": { + "@napi-rs/lzma-android-arm-eabi": "1.5.3", + "@napi-rs/lzma-android-arm64": "1.5.3", + "@napi-rs/lzma-darwin-arm64": "1.5.3", + "@napi-rs/lzma-darwin-x64": "1.5.3", + "@napi-rs/lzma-freebsd-x64": "1.5.3", + "@napi-rs/lzma-linux-arm-gnueabihf": "1.5.3", + "@napi-rs/lzma-linux-arm64-gnu": "1.5.3", + "@napi-rs/lzma-linux-arm64-musl": "1.5.3", + "@napi-rs/lzma-linux-ppc64-gnu": "1.5.3", + "@napi-rs/lzma-linux-riscv64-gnu": "1.5.3", + "@napi-rs/lzma-linux-s390x-gnu": "1.5.3", + "@napi-rs/lzma-linux-x64-gnu": "1.5.3", + "@napi-rs/lzma-linux-x64-musl": "1.5.3", + "@napi-rs/lzma-wasm32-wasi": "1.5.3", + "@napi-rs/lzma-win32-arm64-msvc": "1.5.3", + "@napi-rs/lzma-win32-ia32-msvc": "1.5.3", + "@napi-rs/lzma-win32-x64-msvc": "1.5.3" + } + }, + "node_modules/@napi-rs/lzma-android-arm-eabi": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-android-arm-eabi/-/lzma-android-arm-eabi-1.5.3.tgz", + "integrity": "sha512-Jo8Ej9sTXZO+vHVllHPYxcHVoW4dQe30eLx7wk3H786vv2zy/qIIi5KoO6WhK/VsSBhAb13xbIa/vc4maUgp8Q==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-android-arm64": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-android-arm64/-/lzma-android-arm64-1.5.3.tgz", + "integrity": "sha512-BUEMluJxOJ/9WkZH/IFyyi3viNQGEByodAHDbmJ/k7mVhabGIxjYBea3MmnyTZoIoqZs/ftAKH7jhVCIj+k6mw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-darwin-arm64": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-darwin-arm64/-/lzma-darwin-arm64-1.5.3.tgz", + "integrity": "sha512-ea46AUzmoGqWnrDP8JNea14TCiVMmxWtaD/d5YjRgh1KbL3YfZ9O2BZzfF7DAF+yrVuAQqS52rHveysjnzYlJA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-darwin-x64": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-darwin-x64/-/lzma-darwin-x64-1.5.3.tgz", + "integrity": "sha512-/vz8UpAe/9fV7JiTrT+lAV9Xk9bK4F28u8JRDNIYdGaT7lXP0r/e7YjDvBuJZ9bJtStW4nn/08q5Q7yfFmsF1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-freebsd-x64": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-freebsd-x64/-/lzma-freebsd-x64-1.5.3.tgz", + "integrity": "sha512-gAxemzm8Zk1OaMXihd0L8zeAb/P+71NqhrYnrPVweW3cTXg7XACC+zXQsvENAvHhkroeHCfaMmFupRwfHi+u7A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-linux-arm-gnueabihf": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-arm-gnueabihf/-/lzma-linux-arm-gnueabihf-1.5.3.tgz", + "integrity": "sha512-T7ZvCSEAKGoYSw7vIwdKgk1ZaYl8V1JLTgWSlGhnYBau23R9qZP79ONiF7FTosXnvR8G9RLe9peVuVGS5GI7ig==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-linux-arm64-gnu": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-arm64-gnu/-/lzma-linux-arm64-gnu-1.5.3.tgz", + "integrity": "sha512-fEfgGb/y8jo2X57cTtMQ62XSD57rxDbpSbT38TSq0gSMKg6A/zq3oOxZLRfoCuZkL3cDtuZMi4fAuo6xIkP5eQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-linux-arm64-musl": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-arm64-musl/-/lzma-linux-arm64-musl-1.5.3.tgz", + "integrity": "sha512-Phe10HwfNrtM7U2XsVLhJGePWOgx0BVW2/EWUBq1hoPkmKuUTjbrFj8y4XSTGS5eHMWABUtehnkbX+MPnN5sKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-linux-ppc64-gnu": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-ppc64-gnu/-/lzma-linux-ppc64-gnu-1.5.3.tgz", + "integrity": "sha512-rhuUE76jYbXZaR5oXAWqvfXzxoZKaCFM1nTH3yrdmz2Jtog5mnFcmyJ9WjDFmUgzQo062p1WfXWm3FA8SJOwaA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-linux-riscv64-gnu": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-riscv64-gnu/-/lzma-linux-riscv64-gnu-1.5.3.tgz", + "integrity": "sha512-ogeKmHMV80J1uGYu5Lg4XVacyQxv9wapsEMEKH6beFtouIpo5wZMod5/zGLNHA+sg0/9HIAQbm/bVFJ5flkiQQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-linux-s390x-gnu": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-s390x-gnu/-/lzma-linux-s390x-gnu-1.5.3.tgz", + "integrity": "sha512-FvFzkI1zzVUqpX21UQdLZ0efTPxDolaCH1bqIp6k7hMTtx0RNwHJgcrsbGXQisAJ8uLWKRKncwNVL8MzcBVxUg==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-linux-x64-gnu": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.3.tgz", + "integrity": "sha512-cqF0sRTngwVgnH0y7OV/5zWKWZomMYY71t3gzjtmJou4oPoWQHjxmO1Jo5E3GqUg2bPk+Fp3DcRw1xLAeKs1cg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-linux-x64-musl": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-musl/-/lzma-linux-x64-musl-1.5.3.tgz", + "integrity": "sha512-ZBMasmon/mQmwIKNCWDJagq/zq45vvDQzhSijJSBSIgyef8IRvoD9O4H2lq62Lrq3toHxhlMD2D85jwUVr4QQw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-wasm32-wasi": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-wasm32-wasi/-/lzma-wasm32-wasi-1.5.3.tgz", + "integrity": "sha512-gJ2YpVByn8xNbSCbOwQhCN9Jc2ZQY0ERx/K3XFDldbyiFXCphbEnciptp3bwqcp+WUJvIvpZxcKP1+6tcUEj1g==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "2.0.0-beta.3", + "@emnapi/runtime": "2.0.0-beta.3", + "@napi-rs/wasm-runtime": "~1.2.7" + }, + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-win32-arm64-msvc": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-win32-arm64-msvc/-/lzma-win32-arm64-msvc-1.5.3.tgz", + "integrity": "sha512-oB9iJluslRc3bZ3upZ7ZD2tJfICX3tjTsqS8jUUWK+d7PpJei/oZ3YklBLNyczmLZ+JXHYZlBbotIeVCaoNGPw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-win32-ia32-msvc": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-win32-ia32-msvc/-/lzma-win32-ia32-msvc-1.5.3.tgz", + "integrity": "sha512-b5HxoRno1C9kS9I9pH9E7uYO9oMEQZ2RuOzAs8+PafoHzcHA5KMzSibNfA//seedILG1w22IS7YfrW4s0+4FvA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/lzma-win32-x64-msvc": { + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-win32-x64-msvc/-/lzma-win32-x64-msvc-1.5.3.tgz", + "integrity": "sha512-cPH8uIK0aaD9KZ0FTPBBPTIvncNHQ2Si3DNTP2rjPWyDRVV+syT2dWvlmkiklKgnRipXtx4eJ+tYQZhG30/+9w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.7.tgz", + "integrity": "sha512-zJccwplOAbgfZju95IUHazLnx9RAPtPN2YGJXI6UbrgeaR9QfPjGrQL6ERkSAtnVCA4Q+83ApGyaX5zdpCaKkQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.3" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1 || 2.0.0-beta.2 || 2.0.0-beta.3", + "@emnapi/runtime": "^1.7.1 || 2.0.0-beta.2 || 2.0.0-beta.3" + } + }, + "node_modules/@noble/hashes": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.8.0.tgz", + "integrity": "sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@oxc-minify/binding-android-arm-eabi": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-android-arm-eabi/-/binding-android-arm-eabi-0.151.0.tgz", + "integrity": "sha512-Y1kwFf+GCq62PWojA4u5ME99T1quxdM+VPB67kIC1x0wLmfGAWAhS9cwKIxe/bW95loAxGIruvkYDVMCrvOBvw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-android-arm64": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-android-arm64/-/binding-android-arm64-0.151.0.tgz", + "integrity": "sha512-IuRgG5pZ5Axv88yMK5nIeQHOQqrWkGd2Wcu4yUlGhV9NMr2C6N/HpJ7crLWwpflZSHgWXW5s/5AsmEN2CBJw0w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-darwin-arm64": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-darwin-arm64/-/binding-darwin-arm64-0.151.0.tgz", + "integrity": "sha512-Uuo84npyREYIOJ8ohYdc7eA+QKVcZnX4524U81+6nhdmxkMp19AZHaBGmd/tN6c7KDfsF3ATXQUOxKkCOGGxUQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-darwin-x64": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-darwin-x64/-/binding-darwin-x64-0.151.0.tgz", + "integrity": "sha512-XiWlF2PpwoiX6RcqWmFTvcxW5hH+C96l9km164vbM9wisSBoapo95dvZjEzG7lEmffHOGzb4BOAlAeeZ/WlRWw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-freebsd-x64": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-freebsd-x64/-/binding-freebsd-x64-0.151.0.tgz", + "integrity": "sha512-fM6/wcqfGp1R+zxYxHXs+P+wBpTlhU1Nr7iiZyBoCg+mphrgyYS7drUiHWoWzAvUSpicnmFm6rag9bSSWTDUMA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-linux-arm-gnueabihf": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.151.0.tgz", + "integrity": "sha512-s/aBPTyIMW9uAD0mP+xSz7UbuxXfEIi/1rEpqTd1gGjVCz2Sl58sbc65FauI4K26S9nDpk7fGc7y9C9rjK9L+A==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-linux-arm-musleabihf": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.151.0.tgz", + "integrity": "sha512-9t44xCPN7E93Pmxsov9qwEGcTc0UJa+z0ZJzvjCk0LqXdLNOQhd15k8KgVuzVbWitI19TvOX/fEC3ZVF6LB/kw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-linux-arm64-gnu": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.151.0.tgz", + "integrity": "sha512-a77EK4y+3fyD1GZiMnOUSr8x52Hx6eKjPnfIzeh4C9UgnUZBRYMsdHBbBDHLLOX1adjyluxtn4Tze7yTVByCeA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-linux-arm64-musl": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.151.0.tgz", + "integrity": "sha512-2AjX1jJsj/guky9OuM1jKmuwRVvy+8UUChK3uvrRWV89I/FyrQj9wKPj8TkuL0Ay5yL2xvZj/Ti1Qg0qiRsP+w==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-linux-ppc64-gnu": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-0.151.0.tgz", + "integrity": "sha512-l3iUa60pK2WenCy9jhO4UTK/yz9RjVIXPXqfzMdz7DA0QQZ9dxAk/p2p3ERf4KZq/MEIfvs9e4LuFVYg5PFYdQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-linux-riscv64-gnu": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.151.0.tgz", + "integrity": "sha512-v+sdB36Rp8BxmQoP5Jt6ixz7G0aN9Nayh/LvdNBW/0nkKoLHFyEAcV/Uy+79R3oB0uBC1J6DM9XlDxCC1uMkbA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-linux-riscv64-musl": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-0.151.0.tgz", + "integrity": "sha512-QER/ajZukltjbfFi4rGx6/jC5XEnImAma5P606Xnej0D3fyMC8rXPmae5Z3HyUJMt1Hd5POOkC3S5yQBNPppwQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-linux-s390x-gnu": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.151.0.tgz", + "integrity": "sha512-+r7s5IPrWPtdz/x5LiNSk0ySmzvdP0/VLwt23ULFvcU6jsMrw8DseylMfp4HxvGlJcYyKAUj7JSGxwEmEACUvw==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-linux-x64-gnu": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.151.0.tgz", + "integrity": "sha512-O1Rs0HbgKvEhTiq1bVcZnsOY6q8f4LoPE6pgOieB19Coyz1XP/ugq7XILUD6evlszBGRKliRAwycRScbl2kjqg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-linux-x64-musl": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-linux-x64-musl/-/binding-linux-x64-musl-0.151.0.tgz", + "integrity": "sha512-RSbyV8xzLsvypVTo871IYAfL5We9/8JNyAQLMXiCRnQGD/daFm/bp+iLhtoy2jelgOa6kp4H3bkdl+ci5SSwDQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-openharmony-arm64": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-openharmony-arm64/-/binding-openharmony-arm64-0.151.0.tgz", + "integrity": "sha512-WHwdIt3Kj0TQSVey3RiWXgyeZpXUz3Hapq/mdCXyxVCBkvRk/KHIxmHE32EGE/PRx+EQFHVo1+gm627XOde/qg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-win32-arm64-msvc": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.151.0.tgz", + "integrity": "sha512-mFL0B3HByMlBxspR+SeqyBR8b96QkoI2D8quQOwBXEUExR4Ozu3Ya0uyYR9MBdwvQHZZWQ2EWgum8bdHdTfl/w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-win32-ia32-msvc": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-0.151.0.tgz", + "integrity": "sha512-p6QBBxYsg0A0jUQu5NRqW/UuPtoLtmA72SE8N7Rkhn43m/gSLNTE/nFjsLSsX6T9yM8d8k5PfnYvFnSUf+IlRw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-minify/binding-win32-x64-msvc": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/@oxc-minify/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.151.0.tgz", + "integrity": "sha512-lkP3SsNXm3JUrNX9c9Ijhl3Iipw0fWuCAOOxju+YjH2AolPUbTLE664KeEDdxt8kaLCh+wCBNyqnV67OLVHZWA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-parser/binding-android-arm64": { + "version": "0.76.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm64/-/binding-android-arm64-0.76.0.tgz", + "integrity": "sha512-1XJW/16CDmF5bHE7LAyPPmEEVnxSadDgdJz+xiLqBrmC4lfAeuAfRw3HlOygcPGr+AJsbD4Z5sFJMkwjbSZlQg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@oxc-parser/binding-darwin-arm64": { + "version": "0.76.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-darwin-arm64/-/binding-darwin-arm64-0.76.0.tgz", + "integrity": "sha512-yoQwSom8xsB+JdGsPUU0xxmxLKiF2kdlrK7I56WtGKZilixuBf/TmOwNYJYLRWkBoW5l2/pDZOhBm2luwmLiLw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@oxc-parser/binding-darwin-x64": { + "version": "0.76.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-darwin-x64/-/binding-darwin-x64-0.76.0.tgz", + "integrity": "sha512-uRIopPLvr3pf2Xj7f5LKyCuqzIU6zOS+zEIR8UDYhcgJyZHnvBkfrYnfcztyIcrGdQehrFUi3uplmI09E7RdiQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@oxc-parser/binding-freebsd-x64": { + "version": "0.76.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-freebsd-x64/-/binding-freebsd-x64-0.76.0.tgz", + "integrity": "sha512-a0EOFvnOd2FqmDSvH6uWLROSlU6KV/JDKbsYDA/zRLyKcG6HCsmFnPsp8iV7/xr9WMbNgyJi6R5IMpePQlUq7Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm-gnueabihf": { + "version": "0.76.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.76.0.tgz", + "integrity": "sha512-ikRYDHL3fOdZwfJKmcdqjlLgkeNZ3Ez0qM8wAev5zlHZ+lY/Ig7qG5SCqPlvuTu+nNQ6zrFFaKvvt69EBKXU/g==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm-musleabihf": { + "version": "0.76.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.76.0.tgz", + "integrity": "sha512-dtRv5J5MRCLR7x39K8ufIIW4svIc7gYFUaI0YFXmmeOBhK/K2t/CkguPnDroKtsmXIPHDRtmJ1JJYzNcgJl6Wg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm64-gnu": { + "version": "0.76.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.76.0.tgz", + "integrity": "sha512-IE4iiiggFH2snagQxHrY5bv6dDpRMMat+vdlMN/ibonA65eOmRLp8VLTXnDiNrcla/itJ1L9qGABHNKU+SnE8g==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@oxc-parser/binding-linux-arm64-musl": { + "version": "0.76.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.76.0.tgz", + "integrity": "sha512-wi9zQPMDHrBuRuT7Iurfidc9qlZh7cKa5vfYzOWNBCaqJdgxmNOFzvYen02wVUxSWGKhpiPHxrPX0jdRyJ8Npg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@oxc-parser/binding-linux-riscv64-gnu": { + "version": "0.76.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.76.0.tgz", + "integrity": "sha512-0tqqu1pqPee2lLGY8vtYlX1L415fFn89e0a3yp4q5N9f03j1rRs0R31qesTm3bt/UK8HYjECZ+56FCVPs2MEMQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@oxc-parser/binding-linux-s390x-gnu": { + "version": "0.76.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.76.0.tgz", + "integrity": "sha512-y36Hh1a5TA+oIGtlc8lT7N9vdHXBlhBetQJW0p457KbiVQ7jF7AZkaPWhESkjHWAsTVKD2OjCa9ZqfaqhSI0FQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@oxc-parser/binding-linux-x64-gnu": { + "version": "0.76.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.76.0.tgz", + "integrity": "sha512-7/acaG9htovp3gp/J0kHgbItQTuHctl+rbqPPqZ9DRBYTz8iV8kv3QN8t8Or8i/hOmOjfZp9McDoSU1duoR4/A==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@oxc-parser/binding-linux-x64-musl": { + "version": "0.76.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-linux-x64-musl/-/binding-linux-x64-musl-0.76.0.tgz", + "integrity": "sha512-AxFt0reY6Q2rfudABmMTFGR8tFFr58NlH2rRBQgcj+F+iEwgJ+jMwAPhXd2y1I2zaI8GspuahedUYQinqxWqjA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@oxc-parser/binding-wasm32-wasi": { + "version": "0.76.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-wasm32-wasi/-/binding-wasm32-wasi-0.76.0.tgz", + "integrity": "sha512-wHdkHdhf6AWBoO8vs5cpoR6zEFY1rB+fXWtq6j/xb9j/lu1evlujRVMkh8IM/M/pOUIrNkna3nzST/mRImiveQ==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@napi-rs/wasm-runtime": "^0.2.11" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@oxc-parser/binding-wasm32-wasi/node_modules/@emnapi/core": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.3.tgz", + "integrity": "sha512-zLpS5asjEb7lq8jYLq37N6XKaE41DIexlY1rF/z4/tIl3wo13Sqm28fRyfIsKZD+NZ8mM5RoKkpW/rBcuoSZSg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.2.3", + "tslib": "^2.4.0" + } + }, + "node_modules/@oxc-parser/binding-wasm32-wasi/node_modules/@emnapi/runtime": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz", + "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@oxc-parser/binding-wasm32-wasi/node_modules/@emnapi/wasi-threads": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.3.tgz", + "integrity": "sha512-ELEBe8PsLvvJ6QMr0zLt8ffvOHW/dc1m3CEzNMg7aJUv3bMaoDtw2TXyDAwkYBuroxxuHEwhRTLJSe5sya547g==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@oxc-parser/binding-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": { + "version": "0.2.12", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.12.tgz", + "integrity": "sha512-ZVWUcfwY4E/yPitQJl481FjFo3K22D6qF0DuFH6Y/nbnE11GY5uguDxZMGXPQ8WQ0128MXQD7TnfHyK4oWoIJQ==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "^1.4.3", + "@emnapi/runtime": "^1.4.3", + "@tybys/wasm-util": "^0.10.0" + } + }, + "node_modules/@oxc-parser/binding-win32-arm64-msvc": { + "version": "0.76.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.76.0.tgz", + "integrity": "sha512-G7ZlEWcb2hNwCK3qalzqJoyB6HaTigQ/GEa7CU8sAJ/WwMdG/NnPqiC9IqpEAEy1ARSo4XMALfKbKNuqbSs5mg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@oxc-parser/binding-win32-x64-msvc": { + "version": "0.76.0", + "resolved": "https://registry.npmjs.org/@oxc-parser/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.76.0.tgz", + "integrity": "sha512-0jLzzmnu8/mqNhKBnNS2lFUbPEzRdj5ReiZwHGHpjma0+ullmmwP2AqSEqx3ssHDK9CpcEMdKOK2LsbCfhHKIA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.76.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.76.0.tgz", + "integrity": "sha512-CH3THIrSViKal8yV/Wh3FK0pFhp40nzW1MUDCik9fNuid2D/7JJXKJnfFOAvMxInGXDlvmgT6ACAzrl47TqzkQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/Boshen" + } + }, + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.3.3.tgz", + "integrity": "sha512-K1itOg1Xl50XyjLDa4qQZqaYsfiQbFbFRWXOEOupOsGr3whhm5ed4lgySd6Inohv2TB0+sdU4AxORKuS/TGang==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.3.3.tgz", + "integrity": "sha512-re+E0E3YSJXjEFzdOvBgkVUev1Gg49ileia04qy+Djn0lIMBr7pnwVOYQ+4vc9XbLClCmMziasqXHM7KTmKNKQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.3.3.tgz", + "integrity": "sha512-6pMLYsUiQJXPkUj/CG447hOBKtbe+hjWw/wbxe/mucoPKgnLSVRTzey7s0kXfqrjxhDd3gQ2hj6lgUKRumsIzw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.3.3.tgz", + "integrity": "sha512-Lz+TskwvhceQgwnP+0ox5ZeL7HDDXHKWVRpOqC1Eo05y6rYyfvvep0msGqC95kQTykXrmGgP6qwJB1NdgNZVhg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.3.3.tgz", + "integrity": "sha512-sIzqNDbA7GFDXU8k9/vcJyV1p45mCe+xHOLo9qD7gdbTbMlwB+SpnFoP7WSpC2iYdGfOX9pjBxCfViRn/Nu3Jw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.3.3.tgz", + "integrity": "sha512-HYysnZZ7HD3FM5RIBN6wDMoxtOjw4LS9HhRuQ57MsZt5XGpGRPxVpplvr7vUXRN+9MD8zb6vn1JRP06PXIuMYQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.3.3.tgz", + "integrity": "sha512-XAyLqWSoEKVc8wsDbCIz5o2sBY6ye+0YByK9ib5QxFReoM1KHyThSHsdUODa1DKNzlEfae+p9QwK62LsVwo6Nw==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.3.3.tgz", + "integrity": "sha512-oVyicDPj6vUVFRnuoQS7M2Ab8EkGWoq3a5ntyQqjtZoXfgVykIJqN2IAJSi9q9UyNoQUW0vbBLQSgGtlPJ40Kg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.3.3.tgz", + "integrity": "sha512-k7aFSWgUoi/X7jCst7UEof7pS5jc5ymD8mT/pdFE+pO1IBBI2+JU5Os4HEDqS/tYhetRggwM7MOiLP3cg1bSBQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.3.3.tgz", + "integrity": "sha512-D5mxHpr1qIb1Pt5UT+Bm2p6vJ7+VxcxWcxZCYVDFzZwWRq9iLiEg4/ROsaXFQl1O8sDQZZJ55UoRWWMK64uH5w==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.3.3.tgz", + "integrity": "sha512-nmW1O4BbNEmQI9+KTHbJgbDv0EuyZy64oBnRlMCtLJ8lQMIJ/H/iziQ0g2IUlHEhNrSebGvs9cRrlRj8oEfP+g==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.3.3.tgz", + "integrity": "sha512-ivU4JFHK5nFzrRbzp3+vwYdLj8mFckH4oz3hEl5LH/YeThr9/m2N2vF3NvLevtHq6e0COimgrEVyYTwQhh4ODg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.3.3.tgz", + "integrity": "sha512-XxZoRIkNZ/7pFgvOA8QJmx3uFjMyVz7zS2/urzlaFffoOGclDvpUAMu3AHKT551E8JBKXLxIjpYxYMdF6Mz9vQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.3.3.tgz", + "integrity": "sha512-bBl1MB2gF26PSPy3CiDLiv+A6JGI546WbsDR34LfKAywSGeBeQXaDanoDG6QdZDJs53M1QyJir5MTKTu1n4ptA==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "2.0.0-beta.2", + "@emnapi/runtime": "2.0.0-beta.2", + "@napi-rs/wasm-runtime": "1.2.6" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi/node_modules/@emnapi/core": { + "version": "2.0.0-beta.2", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-2.0.0-beta.2.tgz", + "integrity": "sha512-MzCVoWtcg4Pm2B3je5mMvYMvj3MmBKw+fU7vbsJc9/iT8ip6/eYIHo/Dsm/mr+wsHB6SEyJDuxB09Yy6r/8+4A==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "2.2.0", + "tslib": "^2.4.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi/node_modules/@emnapi/runtime": { + "version": "2.0.0-beta.2", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-2.0.0-beta.2.tgz", + "integrity": "sha512-JcrSPzPvZuNZvJqPTF9Fw25LbOJ8avzFVlaf2grmH4Cku0oGP47tRgqPZadcfj3YoZMHkFVnCYFbQM8I+i5QEw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi/node_modules/@napi-rs/wasm-runtime": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.2.6.tgz", + "integrity": "sha512-mRyDmEw9/fCDXCGfL1sbgIw/GUK0PVxRW4YwgPN61F3LQ+fSyoBFarJVzgGyhF6kRzEQZ0FejDqm4WLXSeqQmw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@tybys/wasm-util": "^0.10.3" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=23.5.0" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "peerDependencies": { + "@emnapi/core": "^1.7.1 || 2.0.0-beta.2", + "@emnapi/runtime": "^1.7.1 || 2.0.0-beta.2" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.3.3.tgz", + "integrity": "sha512-6rZur0hyen4LPhOxWIg7az1YX+Eo8Vvauc0D6lFYGK/QCvN+1XpnB8aFe3jQc/PBUGIReJJnLX3sS8h33/5v7A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.3.3.tgz", + "integrity": "sha512-Ggzyuq1mN7claruAZH10aiiM1N3LRCoMP5xDXPdU514ulL0D2bksCWgFqEmEM2/pDzEP7Dq+dcv7IH452jtr1w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.1.1.tgz", + "integrity": "sha512-glFIJDvLNDtJhT9qrMFWLPbvS+skxgt4L0K8Ei2YtnhPysAJnsI7nyxSJxKj4ADeKX0OLjC4ntRkwpLOoS3rwA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tybys/wasm-util": { + "version": "0.10.5", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.5.tgz", + "integrity": "sha512-dOGOPxlaNV+G046mZzN+9C0dAcQZeSKcXiVaM0TYy/LM4ttTmgSBDxYfovcYI8Em3+eAbiAYpvWLOv8+ZVRJKA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@typescript/typescript-aix-ppc64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz", + "integrity": "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-darwin-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz", + "integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-darwin-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.0.2.tgz", + "integrity": "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-freebsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-arm64/-/typescript-freebsd-arm64-7.0.2.tgz", + "integrity": "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-freebsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-x64/-/typescript-freebsd-x64-7.0.2.tgz", + "integrity": "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-arm": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.0.2.tgz", + "integrity": "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.0.2.tgz", + "integrity": "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-loong64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-loong64/-/typescript-linux-loong64-7.0.2.tgz", + "integrity": "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-mips64el": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-mips64el/-/typescript-linux-mips64el-7.0.2.tgz", + "integrity": "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-ppc64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-ppc64/-/typescript-linux-ppc64-7.0.2.tgz", + "integrity": "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-riscv64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-riscv64/-/typescript-linux-riscv64-7.0.2.tgz", + "integrity": "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-s390x": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-s390x/-/typescript-linux-s390x-7.0.2.tgz", + "integrity": "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz", + "integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-netbsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-arm64/-/typescript-netbsd-arm64-7.0.2.tgz", + "integrity": "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-netbsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-x64/-/typescript-netbsd-x64-7.0.2.tgz", + "integrity": "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-openbsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-arm64/-/typescript-openbsd-arm64-7.0.2.tgz", + "integrity": "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-openbsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-x64/-/typescript-openbsd-x64-7.0.2.tgz", + "integrity": "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-sunos-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-sunos-x64/-/typescript-sunos-x64-7.0.2.tgz", + "integrity": "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-win32-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.0.2.tgz", + "integrity": "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-win32-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz", + "integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dev": true, + "license": "MIT", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/acorn": { + "version": "8.17.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.17.0.tgz", + "integrity": "sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.3.5", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.5.tgz", + "integrity": "sha512-HEHNfbars9v4pgpW6SO1KSPkfoS0xVOM/9UzkJltjlsHZmJasxg8aXkuZa7SMf8vKGIBhpUsPluQSqhJFCqebw==", + "dev": true, + "license": "MIT", + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "18 || 20 || >=22" + } + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/binaryen": { + "version": "132.0.0", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-132.0.0.tgz", + "integrity": "sha512-4Usg7yEvwO3FMso3Oov6qkOOHSod1IEv+boKkh77kTljM+eNBouqCTbqWswGzbG+vDNO/b/v2C4gfEh1WgB9Lg==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "wasm-as": "bin/wasm-as", + "wasm-ctor-eval": "bin/wasm-ctor-eval", + "wasm-dis": "bin/wasm-dis", + "wasm-merge": "bin/wasm-merge", + "wasm-metadce": "bin/wasm-metadce", + "wasm-opt": "bin/wasm-opt", + "wasm-reduce": "bin/wasm-reduce", + "wasm-shell": "bin/wasm-shell", + "wasm2js": "bin/wasm2js" + } + }, + "node_modules/brace-expansion": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.1.0.tgz", + "integrity": "sha512-aa11Dv491GKnYqxaul3aRJ0szew7yMJMfZPnqD44NjGrZXoj62l41OEDDpdpC4eE2P88vBFfLuSyRhpG91NUvg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/chownr": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz", + "integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + }, + "node_modules/commander": { + "version": "14.0.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.3.tgz", + "integrity": "sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + } + }, + "node_modules/componentize-qjs": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/componentize-qjs/-/componentize-qjs-0.5.0.tgz", + "integrity": "sha512-vsuvlO1XZ+BwpaBXmwBBkrqY3eCXONG57cMn8EVJJ3o5R8yjnfMfbgtEMq8RaA4EO0BHVVXtb3ts+1UYaI/qdw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "componentize-qjs": "bin/componentize-qjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "@andreiltd/componentize-qjs-binding-darwin-arm64": "0.5.0", + "@andreiltd/componentize-qjs-binding-darwin-x64": "0.5.0", + "@andreiltd/componentize-qjs-binding-linux-arm64-gnu": "0.5.0", + "@andreiltd/componentize-qjs-binding-linux-arm64-musl": "0.5.0", + "@andreiltd/componentize-qjs-binding-linux-x64-gnu": "0.5.0", + "@andreiltd/componentize-qjs-binding-linux-x64-musl": "0.5.0", + "@andreiltd/componentize-qjs-binding-win32-arm64-msvc": "0.5.0", + "@andreiltd/componentize-qjs-binding-win32-x64-msvc": "0.5.0" + } + }, + "node_modules/es-module-lexer": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", + "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "dev": true, + "license": "MIT" + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/fflate": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.3.tgz", + "integrity": "sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA==", + "dev": true, + "license": "MIT" + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/minimatch": { + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "brace-expansion": "^5.0.8" + }, + "engines": { + "node": "18 || 20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minipass": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz", + "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/minizlib": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz", + "integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "minipass": "^7.1.2" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/mkdirp": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz", + "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==", + "dev": true, + "license": "MIT", + "bin": { + "mkdirp": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/oxc-minify": { + "version": "0.151.0", + "resolved": "https://registry.npmjs.org/oxc-minify/-/oxc-minify-0.151.0.tgz", + "integrity": "sha512-fYdJw3+WYswBWedCl3G0ReJPlHIR1msz3uf5cGAgpHOlQOxfrVu5nOp2gLnccA91Vs7Yw2nH00lj8pc0rjZvYg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/sponsors/oxc-project" + }, + "optionalDependencies": { + "@oxc-minify/binding-android-arm-eabi": "0.151.0", + "@oxc-minify/binding-android-arm64": "0.151.0", + "@oxc-minify/binding-darwin-arm64": "0.151.0", + "@oxc-minify/binding-darwin-x64": "0.151.0", + "@oxc-minify/binding-freebsd-x64": "0.151.0", + "@oxc-minify/binding-linux-arm-gnueabihf": "0.151.0", + "@oxc-minify/binding-linux-arm-musleabihf": "0.151.0", + "@oxc-minify/binding-linux-arm64-gnu": "0.151.0", + "@oxc-minify/binding-linux-arm64-musl": "0.151.0", + "@oxc-minify/binding-linux-ppc64-gnu": "0.151.0", + "@oxc-minify/binding-linux-riscv64-gnu": "0.151.0", + "@oxc-minify/binding-linux-riscv64-musl": "0.151.0", + "@oxc-minify/binding-linux-s390x-gnu": "0.151.0", + "@oxc-minify/binding-linux-x64-gnu": "0.151.0", + "@oxc-minify/binding-linux-x64-musl": "0.151.0", + "@oxc-minify/binding-openharmony-arm64": "0.151.0", + "@oxc-minify/binding-win32-arm64-msvc": "0.151.0", + "@oxc-minify/binding-win32-ia32-msvc": "0.151.0", + "@oxc-minify/binding-win32-x64-msvc": "0.151.0" + } + }, + "node_modules/oxc-parser": { + "version": "0.76.0", + "resolved": "https://registry.npmjs.org/oxc-parser/-/oxc-parser-0.76.0.tgz", + "integrity": "sha512-l98B2e9evuhES7zN99rb1QGhbzx25829TJFaKi2j0ib3/K/G5z1FdGYz6HZkrU3U8jdH7v2FC8mX1j2l9JrOUg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "^0.76.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/Boshen" + }, + "optionalDependencies": { + "@oxc-parser/binding-android-arm64": "0.76.0", + "@oxc-parser/binding-darwin-arm64": "0.76.0", + "@oxc-parser/binding-darwin-x64": "0.76.0", + "@oxc-parser/binding-freebsd-x64": "0.76.0", + "@oxc-parser/binding-linux-arm-gnueabihf": "0.76.0", + "@oxc-parser/binding-linux-arm-musleabihf": "0.76.0", + "@oxc-parser/binding-linux-arm64-gnu": "0.76.0", + "@oxc-parser/binding-linux-arm64-musl": "0.76.0", + "@oxc-parser/binding-linux-riscv64-gnu": "0.76.0", + "@oxc-parser/binding-linux-s390x-gnu": "0.76.0", + "@oxc-parser/binding-linux-x64-gnu": "0.76.0", + "@oxc-parser/binding-linux-x64-musl": "0.76.0", + "@oxc-parser/binding-wasm32-wasi": "0.76.0", + "@oxc-parser/binding-win32-arm64-msvc": "0.76.0", + "@oxc-parser/binding-win32-x64-msvc": "0.76.0" + } + }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/playwright-core": { + "version": "1.65.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.65.1.tgz", + "integrity": "sha512-hqPpz7blSMPxWVdoeE1yiBSzXsKiVOd2k+kjCvmUywD2GPO2Dd9HfcWnq9NN0GHbNZDFgZ9JfBFr+X5/BLo0qw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/readable-stream": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz", + "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==", + "dev": true, + "license": "MIT", + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/regenerate": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.5.0.tgz", + "integrity": "sha512-1s+CxXjJ71i7LNVy8nYwg47XV4y6lAnOEhsMtSKq3WpmPfhl9LuKlTqKIn/3yUpE8lBz+W+TT88Bxyhnr0U4yw==", + "dev": true, + "license": "MIT" + }, + "node_modules/regenerate-unicode-properties": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-10.3.0.tgz", + "integrity": "sha512-9ns8odR8e9q3otKeHj3DE80jZYKg6zVeZKE+zQmRKXFoVUcuiTGeO6iusDhPRoIQQPVPRvH+SfBhrTud4eczuw==", + "dev": true, + "license": "MIT", + "dependencies": { + "regenerate": "^1.4.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regexpu-core": { + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-6.4.0.tgz", + "integrity": "sha512-0ghuzq67LI9bLXpOX/ISfve/Mq33a4aFRzoQYhnnok1JOFpmE/A2TBGkNVenOGEeSBCjIiWcc6MVOG5HEQv0sA==", + "dev": true, + "license": "MIT", + "dependencies": { + "regenerate": "^1.4.2", + "regenerate-unicode-properties": "^10.2.2", + "regjsgen": "^0.8.0", + "regjsparser": "^0.13.0", + "unicode-match-property-ecmascript": "^2.0.0", + "unicode-match-property-value-ecmascript": "^2.2.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regjsgen": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.8.0.tgz", + "integrity": "sha512-RvwtGe3d7LvWiDQXeQw8p5asZUmfU1G/l6WbUXeHta7Y2PEIvBTwH6E2EfmYUK8pxcxEdEmaomqyp0vZZ7C+3Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/regjsparser": { + "version": "0.13.4", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.13.4.tgz", + "integrity": "sha512-EWV80YgFaVgFrjGCAsV7oybp4GOxbls5RzBg8OB0nKEVXsBJR1JlV8Di1JhCROg3MzTfe1RI8yitIm1eOs68iA==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "jsesc": "~3.1.0" + }, + "bin": { + "regjsparser": "bin/parser" + } + }, + "node_modules/rolldown": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.3.3.tgz", + "integrity": "sha512-ksB1g74e7haRy02OYm4lOQAlr6sK6hBpAY5R+YC30Gkv4L1COwF6M9umBAYAPxWpGow6Vr+IXtyDjH9fq7A+Zg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.159.0", + "@rolldown/pluginutils": "^1.0.0" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm-eabi": "1.3.3", + "@rolldown/binding-android-arm64": "1.3.3", + "@rolldown/binding-darwin-arm64": "1.3.3", + "@rolldown/binding-darwin-x64": "1.3.3", + "@rolldown/binding-freebsd-x64": "1.3.3", + "@rolldown/binding-linux-arm-gnueabihf": "1.3.3", + "@rolldown/binding-linux-arm64-gnu": "1.3.3", + "@rolldown/binding-linux-arm64-musl": "1.3.3", + "@rolldown/binding-linux-ppc64-gnu": "1.3.3", + "@rolldown/binding-linux-s390x-gnu": "1.3.3", + "@rolldown/binding-linux-x64-gnu": "1.3.3", + "@rolldown/binding-linux-x64-musl": "1.3.3", + "@rolldown/binding-openharmony-arm64": "1.3.3", + "@rolldown/binding-wasm32-wasi": "1.3.3", + "@rolldown/binding-win32-arm64-msvc": "1.3.3", + "@rolldown/binding-win32-x64-msvc": "1.3.3" + } + }, + "node_modules/rolldown/node_modules/@oxc-project/types": { + "version": "0.159.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.159.0.tgz", + "integrity": "sha512-QWjWhxheluOJ82kDHNyps00UvRpQCtI34B5A/SzpgQycUD/79FuvT4I0aQIfE/bdPwKmX4QPftnywFBH6FxJhQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/oxc-project" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/tar": { + "version": "7.5.23", + "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.23.tgz", + "integrity": "sha512-lkukzdoGngZHJZXxW4S/E4Fp9ghTDlyZXrQGRNoJ/LXvDKcXUTq2sg5yQe74po7Voea6n/IN09+wE/QvJMiifA==", + "dev": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/fs-minipass": "^4.0.0", + "chownr": "^3.0.0", + "minipass": "^7.1.2", + "minizlib": "^3.1.0", + "yallist": "^5.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/tr46": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz", + "integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/tslib": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz", + "integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==", + "dev": true, + "license": "0BSD", + "optional": true + }, + "node_modules/typescript": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz", + "integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc" + }, + "engines": { + "node": ">=16.20.0" + }, + "optionalDependencies": { + "@typescript/typescript-aix-ppc64": "7.0.2", + "@typescript/typescript-darwin-arm64": "7.0.2", + "@typescript/typescript-darwin-x64": "7.0.2", + "@typescript/typescript-freebsd-arm64": "7.0.2", + "@typescript/typescript-freebsd-x64": "7.0.2", + "@typescript/typescript-linux-arm": "7.0.2", + "@typescript/typescript-linux-arm64": "7.0.2", + "@typescript/typescript-linux-loong64": "7.0.2", + "@typescript/typescript-linux-mips64el": "7.0.2", + "@typescript/typescript-linux-ppc64": "7.0.2", + "@typescript/typescript-linux-riscv64": "7.0.2", + "@typescript/typescript-linux-s390x": "7.0.2", + "@typescript/typescript-linux-x64": "7.0.2", + "@typescript/typescript-netbsd-arm64": "7.0.2", + "@typescript/typescript-netbsd-x64": "7.0.2", + "@typescript/typescript-openbsd-arm64": "7.0.2", + "@typescript/typescript-openbsd-x64": "7.0.2", + "@typescript/typescript-sunos-x64": "7.0.2", + "@typescript/typescript-win32-arm64": "7.0.2", + "@typescript/typescript-win32-x64": "7.0.2" + } + }, + "node_modules/typescript-compiler-api": { + "name": "typescript", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/unenv": { + "version": "2.0.0-rc.24", + "resolved": "https://registry.npmjs.org/unenv/-/unenv-2.0.0-rc.24.tgz", + "integrity": "sha512-i7qRCmY42zmCwnYlh9H2SvLEypEFGye5iRmEMKjcGi7zk9UquigRjFtTLz0TYqr0ZGLZhaMHl/foy1bZR+Cwlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "pathe": "^2.0.3" + } + }, + "node_modules/unicode-canonical-property-names-ecmascript": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.1.tgz", + "integrity": "sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", + "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "unicode-canonical-property-names-ecmascript": "^2.0.0", + "unicode-property-aliases-ecmascript": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-value-ecmascript": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.2.1.tgz", + "integrity": "sha512-JQ84qTuMg4nVkx8ga4A16a1epI9H6uTXAknqxkGF/aFfRLw1xC/Bp24HNLaZhHSkWd3+84t8iXnp1J0kYcZHhg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-property-aliases-ecmascript": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.2.0.tgz", + "integrity": "sha512-hpbDzxUY9BFwX+UeBnxv3Sh1q7HFxj48DTmXchNgRa46lO8uj3/1iEn3MiNUYTg1g9ctIqXCCERn8gYZhHC5lQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/urlpattern-polyfill": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/urlpattern-polyfill/-/urlpattern-polyfill-10.1.0.tgz", + "integrity": "sha512-IGjKp/o0NL3Bso1PymYURCJxMPNAf/ILOpendP9f5B6e1rTJgdgiOvgfoT8VxCAdY+Wisb9uhGaJJf3yZ2V9nw==", + "dev": true, + "license": "MIT" + }, + "node_modules/web-streams-polyfill": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.2.0.tgz", + "integrity": "sha512-0rYDzGOh9EZpig92umN5g5D/9A1Kff7k0/mzPSSCY8jEQeYkgRMoY7LhbXtUCWzLCMX0TUE9aoHkjFNB7D9pfA==", + "dev": true, + "license": "MIT", + "workspaces": [ + "test/benchmark-test", + "test/rollup-test", + "test/webpack-test" + ], + "engines": { + "node": ">= 8" + } + }, + "node_modules/webidl-conversions": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz", + "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + } + }, + "node_modules/whatwg-url": { + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz", + "integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tr46": "^5.1.0", + "webidl-conversions": "^7.0.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/yallist": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz", + "integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": ">=18" + } + } + } +} diff --git a/host/package.json b/host/package.json new file mode 100644 index 0000000..edec94e --- /dev/null +++ b/host/package.json @@ -0,0 +1,14 @@ +{ + "name": "moon-plasma-host", + "private": true, + "version": "0.1.0", + "type": "module", + "description": "Host runtime for moon-plasma (M0: Node/browser host over jco-transpiled components)", + "scripts": { + "test": "node --test test/*.test.mjs" + }, + "devDependencies": { + "@bytecodealliance/jco": "1.42.0", + "playwright-core": "^1.50.0" + } +} diff --git a/host/serve.mjs b/host/serve.mjs new file mode 100644 index 0000000..7465401 --- /dev/null +++ b/host/serve.mjs @@ -0,0 +1,30 @@ +#!/usr/bin/env node +// Minimal static server for the browser host (serves host/, config/, build/ only). +// node host/serve.mjs [port] (default: $PORT or 8080) +import http from 'node:http'; +import { readFile } from 'node:fs/promises'; +import { join, extname, normalize } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const ROOT = join(fileURLToPath(import.meta.url), '..', '..'); +const MIME = { '.html': 'text/html', '.mjs': 'text/javascript', '.js': 'text/javascript', '.json': 'application/json', '.wasm': 'application/wasm' }; +const ALLOWED = ['host/', 'config/', 'build/']; + +export function serve(port = 0) { + const srv = http.createServer(async (req, res) => { + try { + let p = decodeURIComponent(new URL(req.url, 'http://x').pathname); + if (p === '/') p = '/host/web/index.html'; + const rel = normalize(p).replace(/^\/+/, ''); + if (rel.includes('..') || !ALLOWED.some((a) => rel.startsWith(a)) || rel.startsWith('host/node_modules')) { res.writeHead(404).end('not found'); return; } + const body = await readFile(join(ROOT, rel)); + res.writeHead(200, { 'content-type': MIME[extname(rel)] ?? 'application/octet-stream', 'cache-control': 'no-store' }).end(body); + } catch { res.writeHead(404).end('not found'); } + }); + return new Promise((resolve) => srv.listen(port, '127.0.0.1', () => resolve(srv))); +} + +if (process.argv[1] === fileURLToPath(import.meta.url)) { + const srv = await serve(Number(process.argv[2] ?? process.env.PORT ?? 8080)); + console.log(`moon-plasma host: http://127.0.0.1:${srv.address().port}/`); +} diff --git a/host/src/ascii.mjs b/host/src/ascii.mjs new file mode 100644 index 0000000..9c23fc7 --- /dev/null +++ b/host/src/ascii.mjs @@ -0,0 +1,52 @@ +// Terminal rasteriser: a coarse text-mode view of a render list, used for +// headless runs and CI logs. (Real pixels come from the Canvas2D backend.) + +const SHADES = ' .:-=+*#%@'; +const CW = 8, CH = 16; + +export function renderAscii(ops, screen) { + const cols = Math.ceil(screen.w / CW), rows = Math.ceil(screen.h / CH); + const grid = Array.from({ length: rows }, () => Array(cols).fill(' ')); + const clips = [{ x: 0, y: 0, w: screen.w, h: screen.h }]; + const inClip = (px, py) => { const c = clips[clips.length - 1]; return px >= c.x && py >= c.y && px < c.x + c.w && py < c.y + c.h; }; + const lum = (c) => (0.299 * c.r + 0.587 * c.g + 0.114 * c.b) / 255; + const shade = (c) => SHADES[Math.min(SHADES.length - 1, Math.floor(lum(c) * SHADES.length))]; + const put = (cx, cy, ch) => { if (cx >= 0 && cy >= 0 && cx < cols && cy < rows && inClip(cx * CW + CW / 2, cy * CH + CH / 2)) grid[cy][cx] = ch; }; + for (const op of ops) { + const v = op.val; + switch (op.tag) { + case 'push-clip': { + const c = clips[clips.length - 1]; + const x0 = Math.max(c.x, v.x), y0 = Math.max(c.y, v.y); + const x1 = Math.min(c.x + c.w, v.x + v.w), y1 = Math.min(c.y + c.h, v.y + v.h); + clips.push({ x: x0, y: y0, w: Math.max(0, x1 - x0), h: Math.max(0, y1 - y0) }); + break; + } + case 'pop-clip': if (clips.length < 2) throw new Error('pop-clip without push-clip'); clips.pop(); break; + case 'fill-rect': { + if (v.color.a < 40) break; + for (let cy = Math.floor(v.rect.y / CH); cy <= Math.floor((v.rect.y + v.rect.h - 1) / CH); cy++) + for (let cx = Math.floor(v.rect.x / CW); cx <= Math.floor((v.rect.x + v.rect.w - 1) / CW); cx++) put(cx, cy, shade(v.color)); + break; + } + case 'circle': { + if (!v.filled || v.color.a < 120) break; + for (let cy = 0; cy < rows; cy++) for (let cx = 0; cx < cols; cx++) { + const dx = cx * CW + CW / 2 - v.center.x, dy = cy * CH + CH / 2 - v.center.y; + if (dx * dx + dy * dy <= v.radius * v.radius) put(cx, cy, shade(v.color)); + } + break; + } + case 'text': { + const w = v.text.length; + let x0 = v.origin.x; + if (v.style.align === 'center') x0 -= (w * CW) / 2; else if (v.style.align === 'right') x0 -= w * CW; + const cy = Math.floor(v.origin.y / CH); + for (let i = 0; i < w; i++) put(Math.floor(x0 / CW) + i, cy, v.text[i]); + break; + } + default: break; // stroke-rect / line: omitted in text mode + } + } + return grid.map((r) => r.join('').replace(/\s+$/, '')).join('\n'); +} diff --git a/host/src/cli.mjs b/host/src/cli.mjs new file mode 100644 index 0000000..e83c6f0 --- /dev/null +++ b/host/src/cli.mjs @@ -0,0 +1,26 @@ +#!/usr/bin/env node +// Headless desktop: boots all components under the Node host and prints the +// composed desktop as text, optionally after a scripted interaction. +// node host/src/cli.mjs [--config file] [--time ISO] [--click-launcher] [--scene out.json] +import { writeFile } from 'node:fs/promises'; +import { bootDesktop } from './headless.mjs'; +import { renderAscii } from './ascii.mjs'; + +const args = process.argv.slice(2); +const opt = (n) => { const i = args.indexOf(`--${n}`); return i < 0 ? undefined : args[i + 1]; }; +const flag = (n) => args.includes(`--${n}`); + +const fixed = opt('time') ? new Date(opt('time')) : undefined; +const { desktop, platform } = await bootDesktop({ configPath: opt('config'), now: fixed ? () => fixed : undefined }); + +let f = desktop.frame(); +if (flag('click-launcher')) { + const e = desktop.hit.widgets.find((w) => w.widget.id === 'launcher'); + desktop.pointer('down', e.rect.x + 10, e.rect.y + 10); + f = desktop.frame(); + if (flag('type')) { for (const ch of opt('type')) desktop.key(ch); f = desktop.frame(); } +} +console.log(renderAscii(f.ops, f.screen)); +console.log(`\n-- ${f.ops.length} draw-ops; widgets: ${desktop.widgets.map((w) => `${w.id}=${w.componentName}`).join(', ')}; theme=${platform.tokens.name}`); +if (opt('scene')) await writeFile(opt('scene'), JSON.stringify(f, null, 1)); +if (desktop.faults.length) { console.error(`${desktop.faults.length} component fault(s)`); process.exit(1); } diff --git a/host/src/desktop.mjs b/host/src/desktop.mjs new file mode 100644 index 0000000..d1502f8 --- /dev/null +++ b/host/src/desktop.mjs @@ -0,0 +1,201 @@ +// moon-plasma host core (platform-agnostic: runs in Node and the browser). +// +// Responsibilities (the *only* things that are not components): +// * instantiate components and broker capabilities (deny-by-default grants) +// * drive the frame loop: shell layout -> widget render -> render-list +// * route input to the component that owns the surface under the pointer +// * hot-swap a widget's implementation at runtime +// All policy (layout, look, behaviour) lives in components. + +import { CAPABILITIES } from './platform.mjs'; +import { place, translate } from './scene.mjs'; + +const PKG = 'moonplasma:desktop'; +const PLASMOID = `${PKG}/plasmoid`; +const PANEL = `${PKG}/panel-layout`; +const DESKTOP = `${PKG}/desktop-surface`; + +export class PermissionError extends Error { + constructor(msg) { super(msg); this.name = 'PermissionError'; } +} +export class ComponentFault extends Error { + constructor(component, fn, cause) { + super(`component "${component}" faulted in ${fn}: ${cause?.message ?? cause}`); + this.name = 'ComponentFault'; + this.component = component; + this.fn = fn; + this.cause = cause; + } +} + +/** + * @typedef {{meta: {name:string, world:string, imports:string[], exports:string[]}, + * instantiate: (imports: object) => Promise}} LoadedComponent + * @param {{config: any, loader: (name: string) => Promise, platform: any}} opts + */ +export class Desktop { + constructor({ config, loader, platform }) { + this.config = config; + this.loader = loader; + this.platform = platform; + this.screen = { w: config.screen.w, h: config.screen.h }; + this.shell = null; + this.widgets = []; // {id, align, componentName, grants, meta, plasmoid} + this.faults = []; // visible, never swallowed: also rendered as error tiles + this.hit = { widgets: [], popup: null }; + this.hovered = null; + } + + async start() { + this.shell = await this.#instantiate(this.config.shell.component, this.config.shell.grants, 'shell'); + for (const w of this.config.panel) { + const inst = await this.#instantiate(w.component, w.grants, 'widget'); + this.widgets.push({ id: w.id, align: w.align ?? 'start', grants: w.grants, ...inst }); + } + return this; + } + + /** Replace the implementation behind panel widget `id` without touching others. */ + async swap(id, componentName) { + const i = this.widgets.findIndex((w) => w.id === id); + if (i < 0) throw new Error(`swap: no widget with id "${id}"`); + const old = this.widgets[i]; + const inst = await this.#instantiate(componentName, old.grants, 'widget'); + this.widgets[i] = { id, align: old.align, grants: old.grants, ...inst }; + this.hovered = null; + } + + async #instantiate(componentName, grants, role) { + for (const g of grants) { + if (!CAPABILITIES.includes(g)) throw new PermissionError(`config grants unknown capability "${g}" to ${componentName}`); + } + const c = await this.loader(componentName); + const need = c.meta.imports; + const denied = need.filter((n) => !grants.includes(n)); + if (denied.length) { + throw new PermissionError( + `component "${componentName}" imports [${denied.join(', ')}] which the desktop config does not grant ` + + `(granted: [${grants.join(', ')}])`); + } + const exp = c.meta.exports; + const wantExports = role === 'shell' ? ['panel-layout', 'desktop-surface'] : ['plasmoid']; + for (const e of wantExports) { + if (!exp.includes(e)) throw new Error(`component "${componentName}" does not export ${e}; cannot act as ${role}`); + } + // Only granted AND imported interfaces are wired; jco fails instantiation + // loudly if anything else is missing. + const imports = {}; + for (const n of need) imports[`${PKG}/${n}`] = this.platform.interfaces[n](); + const instance = await c.instantiate(imports); + const get = (iface) => instance[`${iface}@0.1.0`] ?? instance[iface]; + return role === 'shell' + ? { componentName, meta: c.meta, panel: get(PANEL), desktop: get(DESKTOP) } + : { componentName, meta: c.meta, plasmoid: get(PLASMOID) }; + } + + #call(owner, fn, thunk) { + try { + return thunk(); + } catch (e) { + const f = new ComponentFault(owner.componentName, fn, e); + this.faults.push(f); + console.error(`[host] ${f.message}`); + throw f; + } + } + + /** Compose one frame. Returns {ops, layout, screen}. */ + frame() { + const screen = this.screen; + const ops = []; + ops.push(...this.#call(this.shell, 'desktop-surface.render-background', () => this.shell.desktop.renderBackground(screen))); + + const slots = this.widgets.map((w) => { + const info = this.#call(w, 'plasmoid.info', () => w.plasmoid.info()); + w.info = info; + return { id: w.id, preferred: info.preferred, minWidth: info.minWidth, stretch: info.stretch, align: w.align }; + }); + const layout = this.#call(this.shell, 'panel-layout.compute-layout', () => this.shell.panel.computeLayout(screen, slots)); + ops.push(...this.#call(this.shell, 'panel-layout.render-panel', () => this.shell.panel.renderPanel(screen, layout.panel))); + + this.hit = { widgets: [], popup: null }; + const rects = new Map(); + for (const p of layout.placements) rects.set(p.id, p.rect); + for (const w of this.widgets) { + const rect = rects.get(w.id); + if (!rect) throw new Error(`shell returned no placement for widget "${w.id}"`); + this.hit.widgets.push({ widget: w, rect }); + let wops; + try { + wops = this.#call(w, 'plasmoid.render', () => w.plasmoid.render({ w: rect.w, h: rect.h })); + } catch { + wops = faultTile(rect, w.componentName); + } + ops.push(...place(wops, rect)); + } + + // Popup layer (at most one popup open at a time). + for (const entry of this.hit.widgets) { + let pop; + try { + pop = this.#call(entry.widget, 'plasmoid.popup', () => entry.widget.plasmoid.popup()); + } catch { continue; } + if (!pop) continue; + const prect = this.#call(this.shell, 'panel-layout.popup-position', () => + this.shell.panel.popupPosition(screen, layout.panel, entry.rect, pop.size)); + this.hit.popup = { widget: entry.widget, anchor: entry.rect, rect: prect }; + ops.push(...place(pop.ops, prect)); + break; + } + return { ops, layout, screen }; + } + + #send(widget, target, event) { + return this.#call(widget, 'plasmoid.on-event', () => widget.plasmoid.onEvent(target, event)); + } + + /** @param {'move'|'down'|'up'} kind Returns true when a redraw is needed. */ + pointer(kind, x, y) { + const pt = { x, y }; + const inside = (r) => x >= r.x && y >= r.y && x < r.x + r.w && y < r.y + r.h; + const tag = { move: 'pointer-move', down: 'pointer-down', up: 'pointer-up' }[kind]; + if (!tag) throw new Error(`unknown pointer kind ${kind}`); + let dirty = false; + const popup = this.hit.popup; + if (popup && inside(popup.rect)) { + return this.#send(popup.widget, 'popup', { tag, val: { x: x - popup.rect.x, y: y - popup.rect.y } }); + } + if (popup && kind === 'down' && !inside(popup.anchor)) { + // Click outside the popup: tell its owner it lost focus, then let the + // click fall through to whatever is underneath. + dirty = this.#send(popup.widget, 'widget', { tag: 'focus-lost', val: undefined }) || dirty; + } + const target = this.hit.widgets.find((e) => inside(e.rect)); + if (this.hovered && this.hovered !== target?.widget) { + dirty = this.#send(this.hovered, 'widget', { tag: 'pointer-leave', val: undefined }) || dirty; + } + this.hovered = target?.widget ?? null; + if (target) { + dirty = this.#send(target.widget, 'widget', { tag, val: { x: x - target.rect.x, y: y - target.rect.y } }) || dirty; + } + void pt; + return dirty; + } + + key(k) { + const popup = this.hit.popup; + if (!popup) return false; + return this.#send(popup.widget, 'popup', { tag: 'key-down', val: k }); + } +} + +function faultTile(rect, name) { + const red = { r: 200, g: 40, b: 40, a: 255 }; + return [ + { tag: 'fill-rect', val: { rect: { x: 0, y: 0, w: rect.w, h: rect.h }, color: red, radius: 4 } }, + { tag: 'text', val: { origin: { x: 6, y: Math.floor(rect.h / 2) }, text: `${name} crashed`, + style: { size: 12, color: { r: 255, g: 255, b: 255, a: 255 }, align: 'left', bold: true } } }, + ]; +} + +export { translate }; diff --git a/host/src/headless.mjs b/host/src/headless.mjs new file mode 100644 index 0000000..7657659 --- /dev/null +++ b/host/src/headless.mjs @@ -0,0 +1,19 @@ +// Headless bring-up shared by the CLI and the tests. +import { readFile } from 'node:fs/promises'; +import { join, dirname } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { Desktop } from './desktop.mjs'; +import { createPlatform } from './platform.mjs'; +import { tokensFromJson } from './theme.mjs'; +import { nodeLoader } from './loader-node.mjs'; + +export const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..'); + +export async function bootDesktop({ configPath = join(ROOT, 'config', 'desktop.json'), now, buildDir = join(ROOT, 'build') } = {}) { + const config = JSON.parse(await readFile(configPath, 'utf8')); + const apps = JSON.parse(await readFile(join(ROOT, 'config', 'apps.json'), 'utf8')); + const themeJson = JSON.parse(await readFile(join(ROOT, 'config', 'themes', `${config.theme}.json`), 'utf8')); + const platform = createPlatform({ apps, tokens: tokensFromJson(themeJson), now }); + const desktop = await new Desktop({ config, loader: nodeLoader(buildDir), platform }).start(); + return { desktop, platform, config }; +} diff --git a/host/src/loader-node.mjs b/host/src/loader-node.mjs new file mode 100644 index 0000000..bdd929a --- /dev/null +++ b/host/src/loader-node.mjs @@ -0,0 +1,14 @@ +import { readFile } from 'node:fs/promises'; +import { join } from 'node:path'; +import { pathToFileURL } from 'node:url'; + +/** Loader for Node: reads build/ produced by scripts/build.sh. */ +export function nodeLoader(buildDir) { + return async (name) => { + const meta = JSON.parse(await readFile(join(buildDir, 'components', `${name}.meta.json`), 'utf8')); + const dir = join(buildDir, 'jco', name); + const mod = await import(pathToFileURL(join(dir, `${name}.js`)).href); + const getCoreModule = async (p) => WebAssembly.compile(await readFile(join(dir, p))); + return { meta, instantiate: (imports) => mod.instantiate(getCoreModule, imports) }; + }; +} diff --git a/host/src/loader-web.mjs b/host/src/loader-web.mjs new file mode 100644 index 0000000..ff9a2c1 --- /dev/null +++ b/host/src/loader-web.mjs @@ -0,0 +1,16 @@ +/** Loader for browsers: fetches the jco output under /build/. */ +export function webLoader(base) { + return async (name) => { + const r = await fetch(`${base}/build/components/${name}.meta.json`); + if (!r.ok) throw new Error(`cannot load ${name}.meta.json: HTTP ${r.status}`); + const meta = await r.json(); + const dir = `${base}/build/jco/${name}`; + const mod = await import(`${dir}/${name}.js`); + const getCoreModule = async (p) => { + const res = await fetch(`${dir}/${p}`); + if (!res.ok) throw new Error(`cannot fetch ${p}: HTTP ${res.status}`); + return WebAssembly.compile(await res.arrayBuffer()); + }; + return { meta, instantiate: (imports) => mod.instantiate(getCoreModule, imports) }; + }; +} diff --git a/host/src/platform.mjs b/host/src/platform.mjs new file mode 100644 index 0000000..1815b6a --- /dev/null +++ b/host/src/platform.mjs @@ -0,0 +1,39 @@ +// Host-side implementations of the capability interfaces components may import. +// This is where a native host would talk to the OS; here it is in-memory so the +// desktop is deterministic and testable. + +/** @param {{now?: () => Date, apps: any[], tokens: any}} opts */ +export function createPlatform({ now = () => new Date(), apps, tokens }) { + const p = { + tokens, + apps, + launches: [], + now, + launchable: new Set(apps.map((a) => a.id)), + }; + /** Capability name -> WIT interface implementation (jco import shape). */ + p.interfaces = { + theme: () => ({ getTokens: () => p.tokens }), + clock: () => ({ + now() { + const d = p.now(); + return { + year: d.getFullYear(), month: d.getMonth() + 1, day: d.getDate(), + hour: d.getHours(), minute: d.getMinutes(), second: d.getSeconds(), weekday: d.getDay(), + }; + }, + }), + 'app-catalog': () => ({ listApps: () => p.apps }), + 'app-launch': () => ({ + launch(id) { + if (!p.launchable.has(id)) return { tag: 'err', val: `unknown application: ${id}` }; + p.launches.push(id); + console.log(`[host] launch ${id}`); + return { tag: 'ok', val: undefined }; + }, + }), + }; + return p; +} + +export const CAPABILITIES = ['theme', 'clock', 'app-catalog', 'app-launch']; diff --git a/host/src/scene.mjs b/host/src/scene.mjs new file mode 100644 index 0000000..b609af6 --- /dev/null +++ b/host/src/scene.mjs @@ -0,0 +1,36 @@ +// Render-list helpers. A draw-op is a jco-lifted WIT variant: {tag, val}. + +/** Translate a draw-op list by (dx, dy), returning new ops. */ +export function translate(ops, dx, dy) { + return ops.map((op) => { + const v = op.val; + switch (op.tag) { + case 'fill-rect': + case 'stroke-rect': + return { tag: op.tag, val: { ...v, rect: { ...v.rect, x: v.rect.x + dx, y: v.rect.y + dy } } }; + case 'line': + return { tag: op.tag, val: { ...v, start: { x: v.start.x + dx, y: v.start.y + dy }, end: { x: v.end.x + dx, y: v.end.y + dy } } }; + case 'circle': + return { tag: op.tag, val: { ...v, center: { x: v.center.x + dx, y: v.center.y + dy } } }; + case 'text': + return { tag: op.tag, val: { ...v, origin: { x: v.origin.x + dx, y: v.origin.y + dy } } }; + case 'push-clip': + return { tag: op.tag, val: { ...v, x: v.x + dx, y: v.y + dy } }; + case 'pop-clip': + return op; + default: + throw new Error(`unknown draw-op tag: ${op.tag}`); + } + }); +} + +/** Place a component's local-space ops at `rect`, clipped to it. */ +export function place(ops, rect) { + return [ + { tag: 'push-clip', val: { ...rect } }, + ...translate(ops, rect.x, rect.y), + { tag: 'pop-clip', val: undefined }, + ]; +} + +export const colorCss = (c) => `rgba(${c.r},${c.g},${c.b},${(c.a / 255).toFixed(3)})`; diff --git a/host/src/theme.mjs b/host/src/theme.mjs new file mode 100644 index 0000000..0702e54 --- /dev/null +++ b/host/src/theme.mjs @@ -0,0 +1,29 @@ +// Theme files use kebab-case keys and #rrggbb[aa] colours; components see the +// WIT `theme.tokens` record (camelCase in jco). + +const camel = (k) => k.replace(/-([a-z])/g, (_, c) => c.toUpperCase()); + +export function parseColor(s) { + const m = /^#([0-9a-fA-F]{6})([0-9a-fA-F]{2})?$/.exec(s); + if (!m) throw new Error(`invalid colour "${s}" (expected #rrggbb or #rrggbbaa)`); + const n = parseInt(m[1], 16); + return { r: (n >> 16) & 255, g: (n >> 8) & 255, b: n & 255, a: m[2] ? parseInt(m[2], 16) : 255 }; +} + +const PALETTE_KEYS = ['desktop-top', 'desktop-bottom', 'surface', 'surface-hover', 'surface-popup', + 'foreground', 'foreground-muted', 'accent', 'accent-foreground', 'border']; +const NUM_KEYS = ['font-size', 'radius', 'spacing', 'panel-height']; + +export function tokensFromJson(json) { + const palette = {}; + for (const k of PALETTE_KEYS) { + if (!(k in (json.palette ?? {}))) throw new Error(`theme "${json.name}": missing palette.${k}`); + palette[camel(k)] = parseColor(json.palette[k]); + } + const out = { name: json.name, palette }; + for (const k of NUM_KEYS) { + if (!Number.isInteger(json[k]) || json[k] < 0) throw new Error(`theme "${json.name}": ${k} must be a non-negative integer`); + out[camel(k)] = json[k]; + } + return out; +} diff --git a/host/test/desktop.test.mjs b/host/test/desktop.test.mjs new file mode 100644 index 0000000..9dae71d --- /dev/null +++ b/host/test/desktop.test.mjs @@ -0,0 +1,165 @@ +// Host integration tests: instantiate the real MoonBit components (built by +// scripts/build.sh) under the Node host and exercise the desktop end to end. +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { readFile, stat, writeFile, mkdtemp } from 'node:fs/promises'; +import { join } from 'node:path'; +import { tmpdir } from 'node:os'; +import { bootDesktop, ROOT } from '../src/headless.mjs'; +import { PermissionError } from '../src/desktop.mjs'; +import { tokensFromJson } from '../src/theme.mjs'; + +const NOW = new Date(2026, 10, 24, 14, 7, 37); // Tue 24 Nov 2026, local time +const fixed = () => NOW; +const texts = (ops) => ops.filter((o) => o.tag === 'text').map((o) => o.val.text); +const configWith = async (mutate) => { + const cfg = JSON.parse(await readFile(join(ROOT, 'config', 'desktop.json'), 'utf8')); + mutate(cfg); + const dir = await mkdtemp(join(tmpdir(), 'moonplasma-')); + const p = join(dir, 'desktop.json'); + await writeFile(p, JSON.stringify(cfg)); + return p; +}; + +test('boots shell + widgets and composes a frame', async () => { + const { desktop } = await bootDesktop({ now: fixed }); + const f = desktop.frame(); + assert.deepEqual(f.screen, { w: 1280, h: 720 }); + assert.ok(f.ops.length > 50); + const t = texts(f.ops); + assert.ok(t.includes('14:07'), `clock text missing: ${t}`); + assert.ok(t.includes('Tue 24 Nov')); + assert.ok(t.includes('moon-plasma')); + assert.ok(t.includes('Applications')); + assert.equal(desktop.faults.length, 0); +}); + +test('shell lays the panel out at the bottom, launcher left, clock right', async () => { + const { desktop } = await bootDesktop({ now: fixed }); + const { layout } = desktop.frame(); + assert.deepEqual(layout.panel, { x: 0, y: 720 - 44, w: 1280, h: 44 }); + const byId = Object.fromEntries(layout.placements.map((p) => [p.id, p.rect])); + assert.ok(byId.launcher.x < 20); + assert.equal(byId.clock.x + byId.clock.w, 1280 - 5); + for (const r of Object.values(byId)) { + assert.ok(r.y >= layout.panel.y && r.y + r.h <= 720, 'widget inside the panel'); + } +}); + +test('launcher: click opens popup, row click launches via host capability, popup closes', async () => { + const { desktop, platform } = await bootDesktop({ now: fixed }); + desktop.frame(); + const l = desktop.hit.widgets.find((w) => w.widget.id === 'launcher').rect; + assert.equal(desktop.hit.popup, null); + assert.equal(desktop.pointer('down', l.x + 5, l.y + 5), true); + const f = desktop.frame(); + assert.ok(desktop.hit.popup, 'popup is open'); + assert.ok(texts(f.ops).includes('Terminal')); + const pr = desktop.hit.popup.rect; + assert.ok(pr.y + pr.h <= 720 - 44, 'popup sits above the panel'); + // second row (52px header + 46px rows) + desktop.pointer('move', pr.x + 20, pr.y + 52 + 46 + 5); + desktop.pointer('down', pr.x + 20, pr.y + 52 + 46 + 5); + assert.deepEqual(platform.launches, ['org.moonplasma.files']); + desktop.frame(); + assert.equal(desktop.hit.popup, null, 'popup closed after launch'); +}); + +test('launcher: keyboard search narrows the list and Enter launches the first match', async () => { + const { desktop, platform } = await bootDesktop({ now: fixed }); + desktop.frame(); + const l = desktop.hit.widgets.find((w) => w.widget.id === 'launcher').rect; + desktop.pointer('down', l.x + 5, l.y + 5); + desktop.frame(); + for (const ch of 'calc') desktop.key(ch); + const f = desktop.frame(); + const t = texts(f.ops); + assert.ok(t.includes('Calculator') && !t.includes('Terminal')); + desktop.key('Enter'); + assert.deepEqual(platform.launches, ['org.moonplasma.calc']); +}); + +test('clicking outside the popup dismisses it (focus-lost)', async () => { + const { desktop } = await bootDesktop({ now: fixed }); + desktop.frame(); + const l = desktop.hit.widgets.find((w) => w.widget.id === 'launcher').rect; + desktop.pointer('down', l.x + 5, l.y + 5); + desktop.frame(); + assert.ok(desktop.hit.popup); + desktop.pointer('down', 900, 200); + desktop.frame(); + assert.equal(desktop.hit.popup, null); +}); + +test('permissions: a component importing an ungranted capability is refused', async () => { + const cfg = await configWith((c) => { c.panel[1].grants = ['theme']; }); // clock needs "clock" + await assert.rejects(bootDesktop({ configPath: cfg }), (e) => { + assert.ok(e instanceof PermissionError); + assert.match(e.message, /clock-digital.*imports \[clock\]/); + return true; + }); +}); + +test('permissions: unknown capability names in config are rejected', async () => { + const cfg = await configWith((c) => { c.panel[1].grants.push('filesystem'); }); + await assert.rejects(bootDesktop({ configPath: cfg }), /unknown capability "filesystem"/); +}); + +test('a component cannot act in a role it does not export', async () => { + const cfg = await configWith((c) => { c.panel[1].component = 'shell'; c.panel[1].grants = ['theme']; }); + await assert.rejects(bootDesktop({ configPath: cfg }), /does not export plasmoid/); +}); + +test('hot-swap: clock-digital -> clock-binary at runtime, other components untouched', async () => { + const files = ['shell', 'launcher', 'clock-digital', 'clock-binary'].map((n) => join(ROOT, 'build', 'components', `${n}.wasm`)); + const before = await Promise.all(files.map(async (f) => (await stat(f)).mtimeMs)); + const { desktop } = await bootDesktop({ now: fixed }); + const a = desktop.frame(); + assert.ok(texts(a.ops).includes('14:07')); + const launcherInstance = desktop.widgets.find((w) => w.id === 'launcher').plasmoid; + await desktop.swap('clock', 'clock-binary'); + const b = desktop.frame(); + assert.ok(!texts(b.ops).includes('14:07')); + assert.ok(b.ops.filter((o) => o.tag === 'circle').length >= 20, 'binary clock dots drawn'); + assert.equal(desktop.widgets.find((w) => w.id === 'launcher').plasmoid, launcherInstance, 'launcher instance reused'); + const after = await Promise.all(files.map(async (f) => (await stat(f)).mtimeMs)); + assert.deepEqual(after, before, 'no component binary was rebuilt'); +}); + +test('config-level swap (desktop.binary-clock.json) picks the other implementation', async () => { + const { desktop } = await bootDesktop({ configPath: join(ROOT, 'config', 'desktop.binary-clock.json'), now: fixed }); + assert.equal(desktop.widgets.find((w) => w.id === 'clock').componentName, 'clock-binary'); + assert.ok(desktop.frame().ops.some((o) => o.tag === 'circle' && o.val.filled)); +}); + +test('theme tokens flow through to components (live theme switch)', async () => { + const { desktop, platform } = await bootDesktop({ now: fixed }); + const firstFill = (ops) => ops.find((o) => o.tag === 'fill-rect').val.color; + const night = firstFill(desktop.frame().ops); + const day = JSON.parse(await readFile(join(ROOT, 'config', 'themes', 'moon-day.json'), 'utf8')); + platform.tokens = tokensFromJson(day); + const light = firstFill(desktop.frame().ops); + assert.notDeepEqual(night, light); + assert.deepEqual(light, { r: 0xcf, g: 0xe3, b: 0xff, a: 255 }); // desktop-top of moon-day +}); + +test('component faults are surfaced loudly and isolated to the widget', async () => { + const { desktop, platform } = await bootDesktop({ now: fixed }); + platform.now = () => { throw new Error('rtc exploded'); }; + const f = desktop.frame(); // does not take the desktop down + assert.equal(desktop.faults.length, 1); + assert.match(desktop.faults[0].message, /clock-digital.*render/); + assert.ok(texts(f.ops).includes('clock-digital crashed'), 'visible error tile'); + assert.ok(texts(f.ops).includes('Applications'), 'other widgets still render'); +}); + +test('build manifests match scripts/components.txt', async () => { + const lines = (await readFile(join(ROOT, 'scripts', 'components.txt'), 'utf8')).split('\n') + .filter((l) => l.trim() && !l.startsWith('#')); + for (const l of lines) { + const [name, world] = l.trim().split(/\s+/); + const meta = JSON.parse(await readFile(join(ROOT, 'build', 'components', `${name}.meta.json`), 'utf8')); + assert.equal(meta.world, world); + assert.ok(meta.imports.includes('theme')); + } +}); diff --git a/host/web/canvas.mjs b/host/web/canvas.mjs new file mode 100644 index 0000000..9effac7 --- /dev/null +++ b/host/web/canvas.mjs @@ -0,0 +1,50 @@ +// Canvas2D backend: rasterises a render list (draw-ops in screen coordinates). +import { colorCss } from '../src/scene.mjs'; + +function roundRectPath(ctx, r, radius) { + ctx.beginPath(); + const rad = Math.min(radius, r.w / 2, r.h / 2); + if (rad > 0) ctx.roundRect(r.x, r.y, r.w, r.h, rad); else ctx.rect(r.x, r.y, r.w, r.h); +} + +export function paint(ctx, ops, screen) { + ctx.clearRect(0, 0, screen.w, screen.h); + let depth = 0; + for (const op of ops) { + const v = op.val; + switch (op.tag) { + case 'push-clip': + ctx.save(); depth++; + ctx.beginPath(); ctx.rect(v.x, v.y, v.w, v.h); ctx.clip(); + break; + case 'pop-clip': + if (depth === 0) throw new Error('pop-clip without push-clip'); + ctx.restore(); depth--; + break; + case 'fill-rect': + ctx.fillStyle = colorCss(v.color); roundRectPath(ctx, v.rect, v.radius); ctx.fill(); + break; + case 'stroke-rect': + ctx.strokeStyle = colorCss(v.color); ctx.lineWidth = v.width; + roundRectPath(ctx, { x: v.rect.x + 0.5, y: v.rect.y + 0.5, w: v.rect.w - 1, h: v.rect.h - 1 }, v.radius); ctx.stroke(); + break; + case 'line': + ctx.strokeStyle = colorCss(v.color); ctx.lineWidth = v.width; + ctx.beginPath(); ctx.moveTo(v.start.x + 0.5, v.start.y + 0.5); ctx.lineTo(v.end.x + 0.5, v.end.y + 0.5); ctx.stroke(); + break; + case 'circle': + ctx.beginPath(); ctx.arc(v.center.x, v.center.y, v.radius, 0, Math.PI * 2); + if (v.filled) { ctx.fillStyle = colorCss(v.color); ctx.fill(); } + else { ctx.strokeStyle = colorCss(v.color); ctx.lineWidth = 1.5; ctx.stroke(); } + break; + case 'text': + ctx.font = `${v.style.bold ? '600 ' : ''}${v.style.size}px system-ui, "DejaVu Sans", sans-serif`; + ctx.fillStyle = colorCss(v.style.color); + ctx.textAlign = v.style.align; ctx.textBaseline = 'middle'; + ctx.fillText(v.text, v.origin.x, v.origin.y); + break; + default: throw new Error(`unknown draw-op ${op.tag}`); + } + } + if (depth !== 0) throw new Error(`unbalanced clip stack (${depth})`); +} diff --git a/host/web/index.html b/host/web/index.html new file mode 100644 index 0000000..ddf885b --- /dev/null +++ b/host/web/index.html @@ -0,0 +1,17 @@ + + + + + moon-plasma + + + + +
loading components…
+ + + diff --git a/host/web/main.mjs b/host/web/main.mjs new file mode 100644 index 0000000..44077ce --- /dev/null +++ b/host/web/main.mjs @@ -0,0 +1,46 @@ +import { Desktop } from '../src/desktop.mjs'; +import { createPlatform } from '../src/platform.mjs'; +import { tokensFromJson } from '../src/theme.mjs'; +import { webLoader } from '../src/loader-web.mjs'; +import { paint } from './canvas.mjs'; + +const base = new URL('../../', import.meta.url).href.replace(/\/$/, ''); +const q = new URLSearchParams(location.search); +const getJson = async (p) => { + const r = await fetch(`${base}/${p}`); + if (!r.ok) throw new Error(`GET ${p}: HTTP ${r.status}`); + return r.json(); +}; + +const status = document.getElementById('status'); +try { + const config = await getJson(`config/${q.get('config') ?? 'desktop.json'}`); + const apps = await getJson('config/apps.json'); + const tokens = tokensFromJson(await getJson(`config/themes/${q.get('theme') ?? config.theme}.json`)); + const fixed = q.get('time') ? new Date(q.get('time')) : null; + const platform = createPlatform({ apps, tokens, now: fixed ? () => fixed : undefined }); + const desktop = await new Desktop({ config, loader: webLoader(base), platform }).start(); + + const canvas = document.getElementById('screen'); + canvas.width = desktop.screen.w; canvas.height = desktop.screen.h; + const ctx = canvas.getContext('2d'); + const redraw = () => paint(ctx, desktop.frame().ops, desktop.screen); + const pos = (e) => { const r = canvas.getBoundingClientRect(); return [Math.round((e.clientX - r.left) * canvas.width / r.width), Math.round((e.clientY - r.top) * canvas.height / r.height)]; }; + for (const [ev, kind] of [['pointermove', 'move'], ['pointerdown', 'down'], ['pointerup', 'up']]) { + canvas.addEventListener(ev, (e) => { const [x, y] = pos(e); if (desktop.pointer(kind, x, y)) redraw(); }); + } + window.addEventListener('keydown', (e) => { + const k = e.key.length === 1 || ['Backspace', 'Enter', 'Escape'].includes(e.key) ? e.key : null; + if (k && desktop.key(k)) { e.preventDefault(); redraw(); } + }); + redraw(); + if (!fixed) setInterval(redraw, 1000); + status.textContent = `${desktop.widgets.map((w) => `${w.id}=${w.componentName}`).join(' ')} | theme: ${platform.tokens.name}`; + // Handle for automation / the browser console. + window.moonPlasma = { desktop, platform, redraw, swap: async (id, c) => { await desktop.swap(id, c); redraw(); }, ready: true }; +} catch (e) { + status.textContent = `ERROR: ${e.message}`; + status.style.color = '#f66'; + window.moonPlasmaError = String(e.stack ?? e); + throw e; +} diff --git a/interface/moonplasma/desktop/app-catalog/ffi.mbt b/interface/moonplasma/desktop/app-catalog/ffi.mbt new file mode 100644 index 0000000..2e44d7a --- /dev/null +++ b/interface/moonplasma/desktop/app-catalog/ffi.mbt @@ -0,0 +1,27 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + +///| +fn wasmImportListApps(p0 : Int) = "moonplasma:desktop/app-catalog@0.1.0" "list-apps" + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = +#|(func (param i32) (result i32) (local i32) +#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc +#| local.tee 1 i32.const 0 call $moonbit.init_array8 +#| local.get 1) + +///| +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = +#|(func (param i32) (result i32) local.get 0 i32.load) + +///| +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = +#|(func (param i32) (param i32) (result i32) +#| local.get 0 +#| local.get 1 call $moonbit.init_array16 +#| local.get 0) + +///| +extern "wasm" fn mbt_ffi_free(position : Int) = +#|(func (param i32) local.get 0 call $moonbit.decref) + diff --git a/interface/moonplasma/desktop/app-catalog/moon.pkg b/interface/moonplasma/desktop/app-catalog/moon.pkg new file mode 100644 index 0000000..7825dc5 --- /dev/null +++ b/interface/moonplasma/desktop/app-catalog/moon.pkg @@ -0,0 +1,5 @@ +import { + "moonplasma/desktop/interface/moonplasma/desktop/types" @types, +} + +warnings = "-44" diff --git a/interface/moonplasma/desktop/app-catalog/pkg.generated.mbti b/interface/moonplasma/desktop/app-catalog/pkg.generated.mbti new file mode 100644 index 0000000..0022a1c --- /dev/null +++ b/interface/moonplasma/desktop/app-catalog/pkg.generated.mbti @@ -0,0 +1,17 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/interface/moonplasma/desktop/app-catalog" + +import { + "moonplasma/desktop/interface/moonplasma/desktop/types", +} + +// Values +pub fn list_apps() -> Array[@types.AppEntry] + +// Errors + +// Types and methods + +// Type aliases + +// Traits diff --git a/interface/moonplasma/desktop/app-catalog/top.mbt b/interface/moonplasma/desktop/app-catalog/top.mbt new file mode 100644 index 0000000..830a68c --- /dev/null +++ b/interface/moonplasma/desktop/app-catalog/top.mbt @@ -0,0 +1,31 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! +///| +/// Installed applications (static list in the PoC; .desktop files later). +pub fn list_apps() -> Array[@types.AppEntry] { + + let return_area = mbt_ffi_malloc(8) + wasmImportListApps(return_area); + + let array : Array[@types.AppEntry] = []; + for index = 0; index < (mbt_ffi_load32((return_area) + 4)); index = index + 1 { + let iter_base = (mbt_ffi_load32((return_area) + 0)) + (index * 40) + + let result = mbt_ffi_ptr2str(mbt_ffi_load32((iter_base) + 0), mbt_ffi_load32((iter_base) + 4)) + + let result0 = mbt_ffi_ptr2str(mbt_ffi_load32((iter_base) + 8), mbt_ffi_load32((iter_base) + 12)) + + let result1 = mbt_ffi_ptr2str(mbt_ffi_load32((iter_base) + 16), mbt_ffi_load32((iter_base) + 20)) + + let result2 = mbt_ffi_ptr2str(mbt_ffi_load32((iter_base) + 24), mbt_ffi_load32((iter_base) + 28)) + + let result3 = mbt_ffi_ptr2str(mbt_ffi_load32((iter_base) + 32), mbt_ffi_load32((iter_base) + 36)) + + array.push(@types.AppEntry::{id : result, name : result0, comment : result1, category : result2, glyph : result3}) + } + mbt_ffi_free(mbt_ffi_load32((return_area) + 0)) + let ret = array + mbt_ffi_free(return_area) + return ret + +} + diff --git a/interface/moonplasma/desktop/app-launch/ffi.mbt b/interface/moonplasma/desktop/app-launch/ffi.mbt new file mode 100644 index 0000000..d926210 --- /dev/null +++ b/interface/moonplasma/desktop/app-launch/ffi.mbt @@ -0,0 +1,36 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + +///| +fn wasmImportLaunch(p0 : Int, p1 : Int, p2 : Int) = "moonplasma:desktop/app-launch@0.1.0" "launch" + +///| +#owned(str) +extern "wasm" fn mbt_ffi_str2ptr(str : String) -> Int = +#|(func (param i32) (result i32) local.get 0) + +///| +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = +#|(func (param i32) (result i32) local.get 0 i32.load) + +///| +extern "wasm" fn mbt_ffi_free(position : Int) = +#|(func (param i32) local.get 0 call $moonbit.decref) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = +#|(func (param i32) (result i32) (local i32) +#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc +#| local.tee 1 i32.const 0 call $moonbit.init_array8 +#| local.get 1) + +///| +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = +#|(func (param i32) (param i32) (result i32) +#| local.get 0 +#| local.get 1 call $moonbit.init_array16 +#| local.get 0) + +///| +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = +#|(func (param i32) (result i32) local.get 0 i32.load8_u) + diff --git a/interface/moonplasma/desktop/app-launch/moon.pkg b/interface/moonplasma/desktop/app-launch/moon.pkg new file mode 100644 index 0000000..e2a6033 --- /dev/null +++ b/interface/moonplasma/desktop/app-launch/moon.pkg @@ -0,0 +1 @@ +warnings = "-44" diff --git a/interface/moonplasma/desktop/app-launch/pkg.generated.mbti b/interface/moonplasma/desktop/app-launch/pkg.generated.mbti new file mode 100644 index 0000000..2c44b7a --- /dev/null +++ b/interface/moonplasma/desktop/app-launch/pkg.generated.mbti @@ -0,0 +1,13 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/interface/moonplasma/desktop/app-launch" + +// Values +pub fn launch(String) -> Result[Unit, String] + +// Errors + +// Types and methods + +// Type aliases + +// Traits diff --git a/interface/moonplasma/desktop/app-launch/top.mbt b/interface/moonplasma/desktop/app-launch/top.mbt new file mode 100644 index 0000000..e5e0bc6 --- /dev/null +++ b/interface/moonplasma/desktop/app-launch/top.mbt @@ -0,0 +1,29 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! +///| +/// Ask the host to start an application by catalog id. +pub fn launch(id : String) -> Result[Unit, String] { + + let ptr = mbt_ffi_str2ptr(id) + let return_area = mbt_ffi_malloc(12) + wasmImportLaunch(ptr, id.length(), return_area); + + let lifted = match (mbt_ffi_load8_u((return_area) + 0)) { + 0 => { + + Result::Ok(()) + } + 1 => { + + let result = mbt_ffi_ptr2str(mbt_ffi_load32((return_area) + 4), mbt_ffi_load32((return_area) + 8)) + + Result::Err(result) + } + _ => panic() + } + let ret = lifted + mbt_ffi_free(ptr) + mbt_ffi_free(return_area) + return ret + +} + diff --git a/interface/moonplasma/desktop/clock/README.md b/interface/moonplasma/desktop/clock/README.md new file mode 100644 index 0000000..6d537fd --- /dev/null +++ b/interface/moonplasma/desktop/clock/README.md @@ -0,0 +1,2 @@ +Host-brokered capabilities. A component can only call what its world +imports AND what the host grants it in the desktop manifest. \ No newline at end of file diff --git a/interface/moonplasma/desktop/clock/ffi.mbt b/interface/moonplasma/desktop/clock/ffi.mbt new file mode 100644 index 0000000..babaa5d --- /dev/null +++ b/interface/moonplasma/desktop/clock/ffi.mbt @@ -0,0 +1,24 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + +///| +fn wasmImportNow(p0 : Int) = "moonplasma:desktop/clock@0.1.0" "now" + +///| +extern "wasm" fn mbt_ffi_free(position : Int) = +#|(func (param i32) local.get 0 call $moonbit.decref) + +///| +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = +#|(func (param i32) (result i32) local.get 0 i32.load8_u) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = +#|(func (param i32) (result i32) (local i32) +#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc +#| local.tee 1 i32.const 0 call $moonbit.init_array8 +#| local.get 1) + +///| +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = +#|(func (param i32) (result i32) local.get 0 i32.load) + diff --git a/interface/moonplasma/desktop/clock/moon.pkg b/interface/moonplasma/desktop/clock/moon.pkg new file mode 100644 index 0000000..7825dc5 --- /dev/null +++ b/interface/moonplasma/desktop/clock/moon.pkg @@ -0,0 +1,5 @@ +import { + "moonplasma/desktop/interface/moonplasma/desktop/types" @types, +} + +warnings = "-44" diff --git a/interface/moonplasma/desktop/clock/pkg.generated.mbti b/interface/moonplasma/desktop/clock/pkg.generated.mbti new file mode 100644 index 0000000..cd4c50f --- /dev/null +++ b/interface/moonplasma/desktop/clock/pkg.generated.mbti @@ -0,0 +1,17 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/interface/moonplasma/desktop/clock" + +import { + "moonplasma/desktop/interface/moonplasma/desktop/types", +} + +// Values +pub fn now() -> @types.Datetime + +// Errors + +// Types and methods + +// Type aliases + +// Traits diff --git a/interface/moonplasma/desktop/clock/top.mbt b/interface/moonplasma/desktop/clock/top.mbt new file mode 100644 index 0000000..2fd7244 --- /dev/null +++ b/interface/moonplasma/desktop/clock/top.mbt @@ -0,0 +1,13 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! +///| +/// Local wall-clock time (the host owns the time zone). +pub fn now() -> @types.Datetime { + + let return_area = mbt_ffi_malloc(12) + wasmImportNow(return_area); + let ret = @types.Datetime::{year : (mbt_ffi_load32((return_area) + 0)).reinterpret_as_uint(), month : (mbt_ffi_load8_u((return_area) + 4)).to_byte(), day : (mbt_ffi_load8_u((return_area) + 5)).to_byte(), hour : (mbt_ffi_load8_u((return_area) + 6)).to_byte(), minute : (mbt_ffi_load8_u((return_area) + 7)).to_byte(), second : (mbt_ffi_load8_u((return_area) + 8)).to_byte(), weekday : (mbt_ffi_load8_u((return_area) + 9)).to_byte()} + mbt_ffi_free(return_area) + return ret + +} + diff --git a/interface/moonplasma/desktop/theme/README.md b/interface/moonplasma/desktop/theme/README.md new file mode 100644 index 0000000..522f855 --- /dev/null +++ b/interface/moonplasma/desktop/theme/README.md @@ -0,0 +1 @@ +Look-and-feel design tokens (Plasma "Look and Feel"/colour scheme analogue). \ No newline at end of file diff --git a/interface/moonplasma/desktop/theme/ffi.mbt b/interface/moonplasma/desktop/theme/ffi.mbt new file mode 100644 index 0000000..a4e6bfc --- /dev/null +++ b/interface/moonplasma/desktop/theme/ffi.mbt @@ -0,0 +1,31 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + +///| +fn wasmImportGetTokens(p0 : Int) = "moonplasma:desktop/theme@0.1.0" "get-tokens" + +///| +extern "wasm" fn mbt_ffi_load32(offset : Int) -> Int = +#|(func (param i32) (result i32) local.get 0 i32.load) + +///| +extern "wasm" fn mbt_ffi_free(position : Int) = +#|(func (param i32) local.get 0 call $moonbit.decref) + +///| +extern "wasm" fn mbt_ffi_load8_u(offset : Int) -> Int = +#|(func (param i32) (result i32) local.get 0 i32.load8_u) + +///| +extern "wasm" fn mbt_ffi_malloc(size : Int) -> Int = +#|(func (param i32) (result i32) (local i32) +#| local.get 0 i32.const 4 i32.add call $moonbit.gc.malloc +#| local.tee 1 i32.const 0 call $moonbit.init_array8 +#| local.get 1) + +///| +extern "wasm" fn mbt_ffi_ptr2str(ptr : Int, len : Int) -> String = +#|(func (param i32) (param i32) (result i32) +#| local.get 0 +#| local.get 1 call $moonbit.init_array16 +#| local.get 0) + diff --git a/interface/moonplasma/desktop/theme/moon.pkg b/interface/moonplasma/desktop/theme/moon.pkg new file mode 100644 index 0000000..7825dc5 --- /dev/null +++ b/interface/moonplasma/desktop/theme/moon.pkg @@ -0,0 +1,5 @@ +import { + "moonplasma/desktop/interface/moonplasma/desktop/types" @types, +} + +warnings = "-44" diff --git a/interface/moonplasma/desktop/theme/pkg.generated.mbti b/interface/moonplasma/desktop/theme/pkg.generated.mbti new file mode 100644 index 0000000..731b4ff --- /dev/null +++ b/interface/moonplasma/desktop/theme/pkg.generated.mbti @@ -0,0 +1,38 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/interface/moonplasma/desktop/theme" + +import { + "moonplasma/desktop/interface/moonplasma/desktop/types", +} + +// Values +pub fn get_tokens() -> Tokens + +// Errors + +// Types and methods +pub(all) struct Palette { + desktop_top : @types.Color + desktop_bottom : @types.Color + surface : @types.Color + surface_hover : @types.Color + surface_popup : @types.Color + foreground : @types.Color + foreground_muted : @types.Color + accent : @types.Color + accent_foreground : @types.Color + border : @types.Color +} + +pub(all) struct Tokens { + name : String + palette : Palette + font_size : UInt32 + radius : UInt32 + spacing : UInt32 + panel_height : UInt32 +} + +// Type aliases + +// Traits diff --git a/interface/moonplasma/desktop/theme/top.mbt b/interface/moonplasma/desktop/theme/top.mbt new file mode 100644 index 0000000..466f96b --- /dev/null +++ b/interface/moonplasma/desktop/theme/top.mbt @@ -0,0 +1,23 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! +///| +pub(all) struct Palette { + desktop_top : @types.Color; desktop_bottom : @types.Color; surface : @types.Color; surface_hover : @types.Color; surface_popup : @types.Color; foreground : @types.Color; foreground_muted : @types.Color; accent : @types.Color; accent_foreground : @types.Color; border : @types.Color +} +///| +pub(all) struct Tokens { + name : String; palette : Palette; font_size : UInt; radius : UInt; spacing : UInt; panel_height : UInt +} +///| +/// Read on every render so a theme swap shows up on the next frame. +pub fn get_tokens() -> Tokens { + + let return_area = mbt_ffi_malloc(64) + wasmImportGetTokens(return_area); + + let result = mbt_ffi_ptr2str(mbt_ffi_load32((return_area) + 0), mbt_ffi_load32((return_area) + 4)) + let ret = Tokens::{name : result, palette : Palette::{desktop_top : @types.Color::{r : (mbt_ffi_load8_u((return_area) + 8)).to_byte(), g : (mbt_ffi_load8_u((return_area) + 9)).to_byte(), b : (mbt_ffi_load8_u((return_area) + 10)).to_byte(), a : (mbt_ffi_load8_u((return_area) + 11)).to_byte()}, desktop_bottom : @types.Color::{r : (mbt_ffi_load8_u((return_area) + 12)).to_byte(), g : (mbt_ffi_load8_u((return_area) + 13)).to_byte(), b : (mbt_ffi_load8_u((return_area) + 14)).to_byte(), a : (mbt_ffi_load8_u((return_area) + 15)).to_byte()}, surface : @types.Color::{r : (mbt_ffi_load8_u((return_area) + 16)).to_byte(), g : (mbt_ffi_load8_u((return_area) + 17)).to_byte(), b : (mbt_ffi_load8_u((return_area) + 18)).to_byte(), a : (mbt_ffi_load8_u((return_area) + 19)).to_byte()}, surface_hover : @types.Color::{r : (mbt_ffi_load8_u((return_area) + 20)).to_byte(), g : (mbt_ffi_load8_u((return_area) + 21)).to_byte(), b : (mbt_ffi_load8_u((return_area) + 22)).to_byte(), a : (mbt_ffi_load8_u((return_area) + 23)).to_byte()}, surface_popup : @types.Color::{r : (mbt_ffi_load8_u((return_area) + 24)).to_byte(), g : (mbt_ffi_load8_u((return_area) + 25)).to_byte(), b : (mbt_ffi_load8_u((return_area) + 26)).to_byte(), a : (mbt_ffi_load8_u((return_area) + 27)).to_byte()}, foreground : @types.Color::{r : (mbt_ffi_load8_u((return_area) + 28)).to_byte(), g : (mbt_ffi_load8_u((return_area) + 29)).to_byte(), b : (mbt_ffi_load8_u((return_area) + 30)).to_byte(), a : (mbt_ffi_load8_u((return_area) + 31)).to_byte()}, foreground_muted : @types.Color::{r : (mbt_ffi_load8_u((return_area) + 32)).to_byte(), g : (mbt_ffi_load8_u((return_area) + 33)).to_byte(), b : (mbt_ffi_load8_u((return_area) + 34)).to_byte(), a : (mbt_ffi_load8_u((return_area) + 35)).to_byte()}, accent : @types.Color::{r : (mbt_ffi_load8_u((return_area) + 36)).to_byte(), g : (mbt_ffi_load8_u((return_area) + 37)).to_byte(), b : (mbt_ffi_load8_u((return_area) + 38)).to_byte(), a : (mbt_ffi_load8_u((return_area) + 39)).to_byte()}, accent_foreground : @types.Color::{r : (mbt_ffi_load8_u((return_area) + 40)).to_byte(), g : (mbt_ffi_load8_u((return_area) + 41)).to_byte(), b : (mbt_ffi_load8_u((return_area) + 42)).to_byte(), a : (mbt_ffi_load8_u((return_area) + 43)).to_byte()}, border : @types.Color::{r : (mbt_ffi_load8_u((return_area) + 44)).to_byte(), g : (mbt_ffi_load8_u((return_area) + 45)).to_byte(), b : (mbt_ffi_load8_u((return_area) + 46)).to_byte(), a : (mbt_ffi_load8_u((return_area) + 47)).to_byte()}}, font_size : (mbt_ffi_load32((return_area) + 48)).reinterpret_as_uint(), radius : (mbt_ffi_load32((return_area) + 52)).reinterpret_as_uint(), spacing : (mbt_ffi_load32((return_area) + 56)).reinterpret_as_uint(), panel_height : (mbt_ffi_load32((return_area) + 60)).reinterpret_as_uint()} + mbt_ffi_free(return_area) + return ret + +} + diff --git a/interface/moonplasma/desktop/types/README.md b/interface/moonplasma/desktop/types/README.md new file mode 100644 index 0000000..615caa7 --- /dev/null +++ b/interface/moonplasma/desktop/types/README.md @@ -0,0 +1,2 @@ +Shared value types. Everything here is plain data (no resources) so that +it can cross any component boundary and any host implementation. \ No newline at end of file diff --git a/interface/moonplasma/desktop/types/ffi.mbt b/interface/moonplasma/desktop/types/ffi.mbt new file mode 100644 index 0000000..cdedbce --- /dev/null +++ b/interface/moonplasma/desktop/types/ffi.mbt @@ -0,0 +1,2 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + diff --git a/interface/moonplasma/desktop/types/moon.pkg b/interface/moonplasma/desktop/types/moon.pkg new file mode 100644 index 0000000..e2a6033 --- /dev/null +++ b/interface/moonplasma/desktop/types/moon.pkg @@ -0,0 +1 @@ +warnings = "-44" diff --git a/interface/moonplasma/desktop/types/pkg.generated.mbti b/interface/moonplasma/desktop/types/pkg.generated.mbti new file mode 100644 index 0000000..79db869 --- /dev/null +++ b/interface/moonplasma/desktop/types/pkg.generated.mbti @@ -0,0 +1,120 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/interface/moonplasma/desktop/types" + +// Values + +// Errors + +// Types and methods +pub(all) struct AppEntry { + id : String + name : String + comment : String + category : String + glyph : String +} + +pub(all) struct CircleOp { + center : Point + radius : UInt32 + color : Color + filled : Bool +} + +pub(all) struct Color { + r : Byte + g : Byte + b : Byte + a : Byte +} + +pub(all) struct Datetime { + year : UInt32 + month : Byte + day : Byte + hour : Byte + minute : Byte + second : Byte + weekday : Byte +} + +pub(all) enum DrawOp { + FillRect(FillRectOp) + StrokeRect(StrokeRectOp) + Line(LineOp) + Circle(CircleOp) + Text(TextOp) + PushClip(Rect) + PopClip +} + +pub(all) struct FillRectOp { + rect : Rect + color : Color + radius : UInt32 +} + +pub(all) enum InputEvent { + PointerMove(Point) + PointerDown(Point) + PointerUp(Point) + PointerLeave + FocusLost + KeyDown(String) +} + +pub(all) struct LineOp { + start : Point + end : Point + color : Color + width : UInt32 +} + +pub(all) struct Point { + x : Int32 + y : Int32 +} + +pub(all) struct Rect { + x : Int32 + y : Int32 + w : UInt32 + h : UInt32 +} + +pub(all) struct Size { + w : UInt32 + h : UInt32 +} + +pub(all) struct StrokeRectOp { + rect : Rect + color : Color + width : UInt32 + radius : UInt32 +} + +pub(all) enum TextAlign { + LEFT + CENTER + RIGHT +} +pub fn TextAlign::from(Int32) -> Self +pub fn TextAlign::ordinal(Self) -> Int32 + +pub(all) struct TextOp { + origin : Point + text : String + style : TextStyle +} + +pub(all) struct TextStyle { + size : UInt32 + color : Color + align : TextAlign + bold : Bool +} + +// Type aliases + +// Traits diff --git a/interface/moonplasma/desktop/types/top.mbt b/interface/moonplasma/desktop/types/top.mbt new file mode 100644 index 0000000..3961624 --- /dev/null +++ b/interface/moonplasma/desktop/types/top.mbt @@ -0,0 +1,98 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! +///| +pub(all) struct Size { + w : UInt; h : UInt +} +///| +pub(all) struct Point { + x : Int; y : Int +} +///| +pub(all) struct Rect { + x : Int; y : Int; w : UInt; h : UInt +} +///| +/// Non-premultiplied sRGB, 8 bits per channel. +pub(all) struct Color { + r : Byte; g : Byte; b : Byte; a : Byte +} +///| +pub(all) enum TextAlign { + LEFT; CENTER; RIGHT +} derive() + +///| +pub fn TextAlign::ordinal(self : TextAlign) -> Int { + match self { + LEFT => 0 + CENTER => 1 + RIGHT => 2 + } +} + +///| +pub fn TextAlign::from(self : Int) -> TextAlign { + match self { + 0 => LEFT + 1 => CENTER + 2 => RIGHT + _ => panic() + } +} +///| +pub(all) struct TextStyle { + size : UInt; color : Color; align : TextAlign; bold : Bool +} +///| +pub(all) struct FillRectOp { + rect : Rect; color : Color; radius : UInt +} +///| +pub(all) struct StrokeRectOp { + rect : Rect; color : Color; width : UInt; radius : UInt +} +///| +pub(all) struct LineOp { + start : Point; end : Point; color : Color; width : UInt +} +///| +pub(all) struct CircleOp { + center : Point; radius : UInt; color : Color; filled : Bool +} +///| +/// `origin` is the left edge (align=left), centre (center) or right edge +/// (right) of the text, at the vertical *middle* of the line box. +pub(all) struct TextOp { + origin : Point; text : String; style : TextStyle +} +///| +/// The render-list vocabulary. Components never touch pixels: they return +/// a list of these in their own local coordinate space (origin top-left), +/// and the host/compositor translates, clips and rasterises them. +pub(all) enum DrawOp { + FillRect(FillRectOp) + StrokeRect(StrokeRectOp) + Line(LineOp) + Circle(CircleOp) + Text(TextOp) + PushClip(Rect) + PopClip +} +///| +pub(all) enum InputEvent { + PointerMove(Point) + PointerDown(Point) + PointerUp(Point) + PointerLeave + FocusLost + KeyDown(String) +} +///| +pub(all) struct Datetime { + year : UInt; month : Byte; day : Byte; hour : Byte; minute : Byte; second : Byte; weekday : Byte +} +///| +pub(all) struct AppEntry { + id : String; name : String; comment : String; category : String; glyph : String +} + diff --git a/lib/clock/clock.mbt b/lib/clock/clock.mbt new file mode 100644 index 0000000..3d5ad75 --- /dev/null +++ b/lib/clock/clock.mbt @@ -0,0 +1,140 @@ +///| Render logic for the clock widgets (pure: tokens + time in, ops out). + +///| +pub fn digital_info() -> (String, String, Int, Int, Int) { + // id, name, preferred w, preferred h, min w + ("org.moonplasma.clock.digital", "Digital Clock", 120, 36, 80) +} + +///| +pub fn render_digital( + size : @types.Size, + t : @theme.Tokens, + now : @types.Datetime, +) -> Array[@types.DrawOp] { + let w = size.w.reinterpret_as_int() + let h = size.h.reinterpret_as_int() + let fs = t.font_size.reinterpret_as_int() + let time = @timefmt.hhmm(now.hour.to_int(), now.minute.to_int()) + let date = @timefmt.date_line( + now.weekday.to_int(), + now.day.to_int(), + now.month.to_int(), + ) + [ + @ui.text(w / 2, h / 2 - fs / 2 + 1, time, fs + 4, t.palette.foreground, align=CENTER, bold=true), + @ui.text(w / 2, h / 2 + fs / 2 + 4, date, fs - 3, t.palette.foreground_muted, align=CENTER), + ] +} + +///| +pub fn binary_info() -> (String, String, Int, Int, Int) { + ("org.moonplasma.clock.binary", "Binary Clock", 96, 36, 96) +} + +///| BCD binary clock: six columns (H H M M S S), four rows; lit bits use the +/// accent colour, unused high bits of the tens digits are not drawn. +pub fn render_binary( + size : @types.Size, + t : @theme.Tokens, + now : @types.Datetime, +) -> Array[@types.DrawOp] { + let w = size.w.reinterpret_as_int() + let h = size.h.reinterpret_as_int() + let digits = [ + (now.hour.to_int() / 10, 2), + (now.hour.to_int() % 10, 4), + (now.minute.to_int() / 10, 3), + (now.minute.to_int() % 10, 4), + (now.second.to_int() / 10, 3), + (now.second.to_int() % 10, 4), + ] + let ops = [] + let cols = digits.length() + let step_x = w / cols + let step_y = h / 4 + let r = (if step_x < step_y { step_x } else { step_y }) / 2 - 1 + for c = 0; c < cols; c = c + 1 { + let (d, nbits) = digits[c] + let bits = @timefmt.bcd_bits(d, nbits) + for i = 0; i < nbits; i = i + 1 { + // Row 3 is the least significant bit. + let row = 4 - nbits + i + let cx = c * step_x + step_x / 2 + let cy = row * step_y + step_y / 2 + if bits[i] { + ops.push(@ui.circle(cx, cy, r, t.palette.accent)) + } else { + ops.push(@ui.circle(cx, cy, r, t.palette.border, filled=false)) + } + } + } + ops +} + +///| +fn test_tokens() -> @theme.Tokens { + let c = @ui.color(10, 20, 30, 255) + { + name: "t", + palette: { + desktop_top: c, + desktop_bottom: c, + surface: c, + surface_hover: c, + surface_popup: c, + foreground: c, + foreground_muted: c, + accent: c, + accent_foreground: c, + border: c, + }, + font_size: 14, + radius: 6, + spacing: 6, + panel_height: 44, + } +} + +///| +fn test_time() -> @types.Datetime { + { + year: 2026, + month: b'\x0B', + day: b'\x18', + hour: b'\x0E', + minute: b'\x07', + second: b'\x25', + weekday: b'\x02', + } +} + +///| +test "digital clock shows HH:MM and the date" { + let ops = render_digital(@ui.size(120, 36), test_tokens(), test_time()) + assert_eq(ops.length(), 2) + match ops[0] { + Text(t) => assert_eq(t.text, "14:07") + _ => fail("expected text") + } + match ops[1] { + Text(t) => assert_eq(t.text, "Tue 24 Nov") + _ => fail("expected text") + } +} + +///| +test "binary clock draws one dot per displayed bit" { + let ops = render_binary(@ui.size(96, 36), test_tokens(), test_time()) + // 2+4+3+4+3+4 bits + assert_eq(ops.length(), 20) + let mut lit = 0 + for op in ops { + match op { + Circle(c) => if c.filled { lit += 1 } + _ => () + } + } + // 14:07:37 -> 1,4,0,7,3,7 -> popcount 1+1+0+3+2+3 + assert_eq(lit, 10) +} diff --git a/lib/clock/moon.pkg b/lib/clock/moon.pkg new file mode 100644 index 0000000..107c0a1 --- /dev/null +++ b/lib/clock/moon.pkg @@ -0,0 +1,6 @@ +import { + "moonplasma/desktop/interface/moonplasma/desktop/types" @types, + "moonplasma/desktop/interface/moonplasma/desktop/theme" @theme, + "moonplasma/desktop/lib/ui" @ui, + "moonplasma/desktop/lib/timefmt" @timefmt, +} diff --git a/lib/clock/pkg.generated.mbti b/lib/clock/pkg.generated.mbti new file mode 100644 index 0000000..922e2e1 --- /dev/null +++ b/lib/clock/pkg.generated.mbti @@ -0,0 +1,24 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/lib/clock" + +import { + "moonplasma/desktop/interface/moonplasma/desktop/theme", + "moonplasma/desktop/interface/moonplasma/desktop/types", +} + +// Values +pub fn binary_info() -> (String, String, Int32, Int32, Int32) + +pub fn digital_info() -> (String, String, Int32, Int32, Int32) + +pub fn render_binary(@types.Size, @theme.Tokens, @types.Datetime) -> Array[@types.DrawOp] + +pub fn render_digital(@types.Size, @theme.Tokens, @types.Datetime) -> Array[@types.DrawOp] + +// Errors + +// Types and methods + +// Type aliases + +// Traits diff --git a/lib/launcher/launcher.mbt b/lib/launcher/launcher.mbt new file mode 100644 index 0000000..92bf3e0 --- /dev/null +++ b/lib/launcher/launcher.mbt @@ -0,0 +1,320 @@ +///| Kickoff-style application launcher: state machine + render logic. Pure; +/// host capabilities (app list, launch) are passed in by the component stub. + +///| Which surface an event is addressed to (mirrors the WIT `surface` enum). +pub(all) enum Target { + Widget + Popup +} + +///| +pub struct State { + mut open : Bool + mut query : String + mut hover : Int + mut error : String +} + +///| +pub fn State::new() -> State { + { open: false, query: "", hover: -1, error: "" } +} + +///| +pub let popup_w : Int = 340 + +///| +let header_h : Int = 52 + +///| +let row_h : Int = 46 + +///| +let max_rows : Int = 8 + +///| +fn ascii_lower(s : String) -> String { + let sb = StringBuilder() + for c in s { + if c >= 'A' && c <= 'Z' { + sb.write_char(Int::unsafe_to_char(c.to_int() + 32)) + } else { + sb.write_char(c) + } + } + sb.to_string() +} + +///| +fn contains_ci(hay : String, needle : String) -> Bool { + if needle.length() == 0 { + return true + } + ascii_lower(hay).contains(ascii_lower(needle)) +} + +///| KRunner-ish filter: case-insensitive substring over name, comment and category. +pub fn filter(apps : Array[@types.AppEntry], query : String) -> Array[@types.AppEntry] { + apps.filter(a => { + contains_ci(a.name, query) || + contains_ci(a.comment, query) || + contains_ci(a.category, query) + }) +} + +///| +fn visible_rows(n : Int) -> Int { + if n > max_rows { max_rows } else { n } +} + +///| +pub fn popup_size(apps : Array[@types.AppEntry], st : State) -> @types.Size { + let rows = visible_rows(filter(apps, st.query).length()) + let rows = if rows == 0 { 1 } else { rows } + @ui.size(popup_w, header_h + rows * row_h + 8) +} + +///| +pub fn close(st : State) -> Unit { + st.open = false + st.query = "" + st.hover = -1 +} + +///| The panel button: a crescent moon plus a label. +pub fn render_button( + size : @types.Size, + t : @theme.Tokens, + st : State, +) -> Array[@types.DrawOp] { + let w = size.w.reinterpret_as_int() + let h = size.h.reinterpret_as_int() + let bg = if st.open { t.palette.accent } else { t.palette.surface_hover } + let fg = if st.open { t.palette.accent_foreground } else { t.palette.foreground } + let r = t.radius.reinterpret_as_int() + let cy = h / 2 + [ + @ui.fill_rect(@ui.rect(0, 0, w, h), bg, radius=r), + // Crescent: light disc with a button-coloured disc biting into it. + @ui.circle(18, cy, 9, fg), + @ui.circle(22, cy - 3, 8, bg), + @ui.text(36, cy, "Applications", t.font_size.reinterpret_as_int(), fg, bold=true), + ] +} + +///| +pub fn render_popup( + apps : Array[@types.AppEntry], + t : @theme.Tokens, + st : State, +) -> Array[@types.DrawOp] { + let size = popup_size(apps, st) + let w = size.w.reinterpret_as_int() + let h = size.h.reinterpret_as_int() + let fs = t.font_size.reinterpret_as_int() + let r = t.radius.reinterpret_as_int() + let p = t.palette + let ops = [ + @ui.fill_rect(@ui.rect(0, 0, w, h), p.surface_popup, radius=r + 4), + @ui.stroke_rect(@ui.rect(0, 0, w, h), p.border, radius=r + 4), + // search field + @ui.fill_rect(@ui.rect(10, 10, w - 20, 32), p.surface, radius=r), + ] + let q = if st.query.length() == 0 { + @ui.text(20, 26, "Type to search applications...", fs - 1, p.foreground_muted) + } else { + @ui.text(20, 26, st.query + "_", fs, p.foreground) + } + ops.push(q) + let shown = filter(apps, st.query) + if shown.length() == 0 { + ops.push( + @ui.text(w / 2, header_h + row_h / 2, "No matching applications", fs, p.foreground_muted, align=CENTER), + ) + } + let n = visible_rows(shown.length()) + for i = 0; i < n; i = i + 1 { + let a = shown[i] + let y = header_h + i * row_h + if i == st.hover { + ops.push(@ui.fill_rect(@ui.rect(6, y, w - 12, row_h - 2), p.accent, radius=r)) + } + let fg = if i == st.hover { p.accent_foreground } else { p.foreground } + let sub = if i == st.hover { p.accent_foreground } else { p.foreground_muted } + ops.push(@ui.circle(30, y + row_h / 2 - 1, 15, p.surface_hover)) + ops.push(@ui.text(30, y + row_h / 2 - 1, a.glyph, fs, fg, align=CENTER, bold=true)) + ops.push(@ui.text(56, y + 14, a.name, fs, fg, bold=true)) + ops.push(@ui.text(56, y + 31, a.comment, fs - 3, sub)) + } + if st.error.length() > 0 { + ops.push(@ui.text(14, h - 12, st.error, fs - 3, @ui.color(240, 90, 90, 255))) + } + ops +} + +///| Row index under a popup-local point, or -1. +pub fn row_at(apps : Array[@types.AppEntry], st : State, p : @types.Point) -> Int { + if p.x < 6 || p.x >= popup_w - 6 || p.y < header_h { + return -1 + } + let i = (p.y - header_h) / row_h + if i < visible_rows(filter(apps, st.query).length()) { i } else { -1 } +} + +///| Handle an event. `launch` is the host capability. Returns true on redraw. +pub fn handle_event( + apps : Array[@types.AppEntry], + st : State, + target : Target, + ev : @types.InputEvent, + launch : (String) -> Result[Unit, String], +) -> Bool { + match (target, ev) { + (Widget, PointerDown(_)) => { + if st.open { + close(st) + } else { + st.open = true + st.error = "" + } + true + } + (Popup, PointerMove(p)) => { + let i = row_at(apps, st, p) + if i != st.hover { + st.hover = i + true + } else { + false + } + } + (Popup, PointerLeave) => + if st.hover != -1 { + st.hover = -1 + true + } else { + false + } + (Popup, PointerDown(p)) => { + let i = row_at(apps, st, p) + if i >= 0 { + activate(apps, st, i, launch) + } + true + } + (_, FocusLost) => + if st.open { + close(st) + true + } else { + false + } + (_, KeyDown(k)) => + if !st.open { + false + } else if k == "Escape" { + close(st) + true + } else if k == "Backspace" { + if st.query.length() > 0 { + st.query = st.query[:st.query.length() - 1].to_owned() + } + st.hover = -1 + true + } else if k == "Enter" { + if filter(apps, st.query).length() > 0 { + activate(apps, st, 0, launch) + } + true + } else if k.length() == 1 { + st.query = st.query + k + st.hover = -1 + true + } else { + false + } + _ => false + } +} + +///| Launch the i-th filtered app; a failure is shown in the popup (not hidden). +fn activate( + apps : Array[@types.AppEntry], + st : State, + i : Int, + launch : (String) -> Result[Unit, String], +) -> Unit { + let a = filter(apps, st.query)[i] + match launch(a.id) { + Ok(_) => close(st) + Err(e) => st.error = "Launch failed: " + e + } +} + +///| +fn sample_apps() -> Array[@types.AppEntry] { + [ + { id: "a", name: "Terminal", comment: "Command line", category: "System", glyph: ">_" }, + { id: "b", name: "Files", comment: "Browse folders", category: "Utilities", glyph: "F" }, + { id: "c", name: "Web Browser", comment: "Browse the web", category: "Internet", glyph: "W" }, + ] +} + +///| +test "filter is case-insensitive over name/comment/category" { + let apps = sample_apps() + assert_eq(filter(apps, "").length(), 3) + assert_eq(filter(apps, "TERM").length(), 1) + assert_eq(filter(apps, "folders")[0].id, "b") + assert_eq(filter(apps, "internet")[0].id, "c") + assert_eq(filter(apps, "zzz").length(), 0) +} + +///| +test "open, type, launch via keyboard" { + let apps = sample_apps() + let st = State::new() + let launched : Array[String] = [] + let launch = id => { + launched.push(id) + Ok(()) + } + assert_true(handle_event(apps, st, Widget, PointerDown({ x: 1, y: 1 }), launch)) + assert_true(st.open) + assert_true(handle_event(apps, st, Popup, KeyDown("f"), launch)) + assert_true(handle_event(apps, st, Popup, KeyDown("i"), launch)) + assert_eq(st.query, "fi") + assert_true(handle_event(apps, st, Popup, KeyDown("Enter"), launch)) + assert_eq(launched, ["b"]) + assert_false(st.open) +} + +///| +test "click on a row launches; failure is surfaced and keeps the menu open" { + let apps = sample_apps() + let st = State::new() + st.open = true + let i = row_at(apps, st, { x: 20, y: 52 + 46 + 5 }) + assert_eq(i, 1) + let _ = handle_event( + apps, + st, + Popup, + PointerDown({ x: 20, y: 52 + 46 + 5 }), + _ => Err("boom"), + ) + assert_true(st.open) + assert_eq(st.error, "Launch failed: boom") +} + +///| +test "focus loss closes and hover tracks the pointer" { + let apps = sample_apps() + let st = State::new() + st.open = true + assert_true(handle_event(apps, st, Popup, PointerMove({ x: 20, y: 60 }), _ => Ok(()))) + assert_eq(st.hover, 0) + assert_false(handle_event(apps, st, Popup, PointerMove({ x: 21, y: 61 }), _ => Ok(()))) + assert_true(handle_event(apps, st, Widget, FocusLost, _ => Ok(()))) + assert_false(st.open) +} diff --git a/lib/launcher/moon.pkg b/lib/launcher/moon.pkg new file mode 100644 index 0000000..7a6c415 --- /dev/null +++ b/lib/launcher/moon.pkg @@ -0,0 +1,5 @@ +import { + "moonplasma/desktop/interface/moonplasma/desktop/types" @types, + "moonplasma/desktop/interface/moonplasma/desktop/theme" @theme, + "moonplasma/desktop/lib/ui" @ui, +} diff --git a/lib/launcher/pkg.generated.mbti b/lib/launcher/pkg.generated.mbti new file mode 100644 index 0000000..e53da1e --- /dev/null +++ b/lib/launcher/pkg.generated.mbti @@ -0,0 +1,44 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/lib/launcher" + +import { + "moonplasma/desktop/interface/moonplasma/desktop/theme", + "moonplasma/desktop/interface/moonplasma/desktop/types", +} + +// Values +pub fn close(State) -> Unit + +pub fn filter(Array[@types.AppEntry], String) -> Array[@types.AppEntry] + +pub fn handle_event(Array[@types.AppEntry], State, Target, @types.InputEvent, (String) -> Result[Unit, String]) -> Bool + +pub fn popup_size(Array[@types.AppEntry], State) -> @types.Size + +pub let popup_w : Int32 + +pub fn render_button(@types.Size, @theme.Tokens, State) -> Array[@types.DrawOp] + +pub fn render_popup(Array[@types.AppEntry], @theme.Tokens, State) -> Array[@types.DrawOp] + +pub fn row_at(Array[@types.AppEntry], State, @types.Point) -> Int32 + +// Errors + +// Types and methods +pub struct State { + mut open : Bool + mut query : String + mut hover : Int32 + mut error : String +} +pub fn State::new() -> Self + +pub(all) enum Target { + Widget + Popup +} + +// Type aliases + +// Traits diff --git a/lib/panel/moon.pkg b/lib/panel/moon.pkg new file mode 100644 index 0000000..e69de29 diff --git a/lib/panel/panel.mbt b/lib/panel/panel.mbt new file mode 100644 index 0000000..404ff6a --- /dev/null +++ b/lib/panel/panel.mbt @@ -0,0 +1,218 @@ +///| Panel layout algorithm (pure integer geometry, no WIT types). + +///| +pub(all) struct SlotIn { + id : String + pref_w : Int + pref_h : Int + min_w : Int + stretch : Bool + end_align : Bool +} + +///| +pub(all) struct Placed { + id : String + x : Int + y : Int + w : Int + h : Int +} + +///| +pub(all) struct PanelLayout { + x : Int + y : Int + w : Int + h : Int + placements : Array[Placed] +} + +///| Bottom, full-width panel. Widgets pack towards their edge in slot order. +/// Free space goes to `stretch` slots; if even the minimum widths do not fit +/// the call fails (Err) rather than silently dropping widgets. +pub fn layout( + screen_w : Int, + screen_h : Int, + panel_h : Int, + margin : Int, + spacing : Int, + slots : Array[SlotIn], +) -> Result[PanelLayout, String] { + if panel_h <= 0 || panel_h > screen_h { + return Err("panel height \{panel_h} does not fit screen height \{screen_h}") + } + let n = slots.length() + let avail = screen_w - 2 * margin - (if n > 1 { spacing * (n - 1) } else { 0 }) + let widths : Array[Int] = slots.map(s => s.pref_w) + let mut total = 0 + for w in widths { + total += w + } + if total > avail { + // Shrink towards min_w, taking the deficit from the widest slack first. + let mut deficit = total - avail + let mut guard_iter = 0 + while deficit > 0 && guard_iter < 100000 { + guard_iter += 1 + let mut best = -1 + let mut best_slack = 0 + for i = 0; i < n; i = i + 1 { + let slack = widths[i] - slots[i].min_w + if slack > best_slack { + best_slack = slack + best = i + } + } + if best < 0 { + return Err( + "panel overflow: slots need at least \{avail + deficit}px but only \{avail}px available", + ) + } + widths[best] = widths[best] - 1 + deficit -= 1 + } + } else if total < avail { + let mut free = avail - total + let mut stretchers = 0 + for s in slots { + if s.stretch { + stretchers += 1 + } + } + if stretchers > 0 { + let share = free / stretchers + let mut rem = free - share * stretchers + for i = 0; i < n; i = i + 1 { + if slots[i].stretch { + widths[i] = widths[i] + share + (if rem > 0 { 1 } else { 0 }) + if rem > 0 { + rem -= 1 + } + } + } + free = 0 + } + } + let inner_h = panel_h - 2 * margin + let py = screen_h - panel_h + let placed : Array[Placed?] = Array::make(n, None) + let mut x = margin + for i = 0; i < n; i = i + 1 { + if !slots[i].end_align { + placed[i] = Some(place(slots[i], x, py, margin, inner_h, widths[i])) + x += widths[i] + spacing + } + } + let mut rx = screen_w - margin + for i = n - 1; i >= 0; i = i - 1 { + if slots[i].end_align { + rx -= widths[i] + placed[i] = Some(place(slots[i], rx, py, margin, inner_h, widths[i])) + rx -= spacing + } + } + let out : Array[Placed] = [] + for p in placed { + match p { + Some(v) => out.push(v) + None => abort("unreachable: unplaced slot") + } + } + Ok({ x: 0, y: py, w: screen_w, h: panel_h, placements: out }) +} + +///| +fn place( + s : SlotIn, + x : Int, + py : Int, + margin : Int, + inner_h : Int, + w : Int, +) -> Placed { + let h = if s.pref_h < inner_h { s.pref_h } else { inner_h } + { id: s.id, x, y: py + margin + (inner_h - h) / 2, w, h } +} + +///| Popup rectangle: above the panel, left-aligned with its anchor widget and +/// clamped inside the screen. +pub fn popup_position( + screen_w : Int, + panel_y : Int, + anchor_x : Int, + popup_w : Int, + popup_h : Int, + gap : Int, +) -> (Int, Int) { + let max_x = screen_w - popup_w + let x = if anchor_x > max_x { max_x } else { anchor_x } + let x = if x < 0 { 0 } else { x } + let y = panel_y - popup_h - gap + let y = if y < 0 { 0 } else { y } + (x, y) +} + +///| +fn slot(id : String, pref : Int, min : Int, stretch : Bool, end_ : Bool) -> SlotIn { + { id, pref_w: pref, pref_h: 30, min_w: min, stretch, end_align: end_ } +} + +///| +test "start and end packing" { + let r = layout( + 1000, + 600, + 40, + 4, + 6, + [slot("a", 100, 50, false, false), slot("b", 80, 40, false, true)], + ).unwrap() + assert_eq((r.x, r.y, r.w, r.h), (0, 560, 1000, 40)) + assert_eq((r.placements[0].x, r.placements[0].w), (4, 100)) + assert_eq((r.placements[1].x, r.placements[1].w), (916, 80)) + // 30px tall widget centred in 32px inner area. + assert_eq(r.placements[0].y, 565) +} + +///| +test "stretch takes the free space" { + let r = layout( + 500, + 300, + 40, + 0, + 0, + [slot("a", 100, 50, false, false), slot("s", 10, 10, true, false)], + ).unwrap() + assert_eq(r.placements[1].w, 400) +} + +///| +test "shrinks to minimum then fails loudly" { + let ok = layout( + 200, + 300, + 40, + 0, + 0, + [slot("a", 150, 80, false, false), slot("b", 150, 80, false, false)], + ).unwrap() + assert_eq((ok.placements[0].w, ok.placements[1].w), (100, 100)) + let bad = layout( + 100, + 300, + 40, + 0, + 0, + [slot("a", 150, 80, false, false), slot("b", 150, 80, false, false)], + ) + assert_true(bad is Err(_)) +} + +///| +test "popup clamps to screen" { + assert_eq(popup_position(1000, 560, 4, 300, 200, 6), (4, 354)) + assert_eq(popup_position(1000, 560, 900, 300, 200, 6), (700, 354)) + assert_eq(popup_position(1000, 100, 4, 300, 200, 6), (4, 0)) +} diff --git a/lib/panel/pkg.generated.mbti b/lib/panel/pkg.generated.mbti new file mode 100644 index 0000000..b483a86 --- /dev/null +++ b/lib/panel/pkg.generated.mbti @@ -0,0 +1,39 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/lib/panel" + +// Values +pub fn layout(Int32, Int32, Int32, Int32, Int32, Array[SlotIn]) -> Result[PanelLayout, String] + +pub fn popup_position(Int32, Int32, Int32, Int32, Int32, Int32) -> (Int32, Int32) + +// Errors + +// Types and methods +pub(all) struct PanelLayout { + x : Int32 + y : Int32 + w : Int32 + h : Int32 + placements : Array[Placed] +} + +pub(all) struct Placed { + id : String + x : Int32 + y : Int32 + w : Int32 + h : Int32 +} + +pub(all) struct SlotIn { + id : String + pref_w : Int32 + pref_h : Int32 + min_w : Int32 + stretch : Bool + end_align : Bool +} + +// Type aliases + +// Traits diff --git a/lib/shell/moon.pkg b/lib/shell/moon.pkg new file mode 100644 index 0000000..7a6c415 --- /dev/null +++ b/lib/shell/moon.pkg @@ -0,0 +1,5 @@ +import { + "moonplasma/desktop/interface/moonplasma/desktop/types" @types, + "moonplasma/desktop/interface/moonplasma/desktop/theme" @theme, + "moonplasma/desktop/lib/ui" @ui, +} diff --git a/lib/shell/pkg.generated.mbti b/lib/shell/pkg.generated.mbti new file mode 100644 index 0000000..1d875b4 --- /dev/null +++ b/lib/shell/pkg.generated.mbti @@ -0,0 +1,20 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/lib/shell" + +import { + "moonplasma/desktop/interface/moonplasma/desktop/theme", + "moonplasma/desktop/interface/moonplasma/desktop/types", +} + +// Values +pub fn render_background(@types.Size, @theme.Tokens) -> Array[@types.DrawOp] + +pub fn render_panel(@types.Rect, @theme.Tokens) -> Array[@types.DrawOp] + +// Errors + +// Types and methods + +// Type aliases + +// Traits diff --git a/lib/shell/shell.mbt b/lib/shell/shell.mbt new file mode 100644 index 0000000..d1c2867 --- /dev/null +++ b/lib/shell/shell.mbt @@ -0,0 +1,104 @@ +///| Desktop background and panel chrome (pure render logic). + +///| Vertical gradient built from horizontal bands, a soft "plasma" glow and a +/// wordmark. Everything derives from theme tokens. +pub fn render_background( + screen : @types.Size, + t : @theme.Tokens, +) -> Array[@types.DrawOp] { + let w = screen.w.reinterpret_as_int() + let h = screen.h.reinterpret_as_int() + let p = t.palette + let bands = 48 + let ops = [] + for i = 0; i < bands; i = i + 1 { + let y0 = h * i / bands + let y1 = h * (i + 1) / bands + ops.push( + @ui.fill_rect( + @ui.rect(0, y0, w, y1 - y0 + 1), + @ui.lerp_color(p.desktop_top, p.desktop_bottom, i, bands - 1), + ), + ) + } + // Plasma glow: concentric translucent discs. + let gx = w * 3 / 4 + let gy = h * 3 / 10 + let rings = 8 + for i = 0; i < rings; i = i + 1 { + let r = 40 + (rings - i) * 22 + ops.push(@ui.circle(gx, gy, r, @ui.with_alpha(p.accent, 14 + i * 4))) + } + ops.push(@ui.circle(gx, gy, 38, @ui.with_alpha(p.accent, 200))) + ops.push(@ui.circle(gx + 14, gy - 10, 34, p.desktop_top)) + ops.push( + @ui.text(w / 2, h / 2 - 20, "moon-plasma", 54, @ui.with_alpha(p.foreground, 235), align=CENTER, bold=true), + ) + ops.push( + @ui.text( + w / 2, + h / 2 + 24, + "every part is a WebAssembly component", + t.font_size.reinterpret_as_int() + 2, + p.foreground_muted, + align=CENTER, + ), + ) + ops +} + +///| +pub fn render_panel( + panel : @types.Rect, + t : @theme.Tokens, +) -> Array[@types.DrawOp] { + let p = t.palette + [ + @ui.fill_rect(panel, p.surface), + @ui.line(panel.x, panel.y, panel.x + @ui.rect_w(panel), panel.y, p.border), + ] +} + +///| +fn test_tokens() -> @theme.Tokens { + let c = @ui.color(10, 20, 30, 255) + let d = @ui.color(110, 120, 130, 255) + { + name: "t", + palette: { + desktop_top: c, + desktop_bottom: d, + surface: c, + surface_hover: c, + surface_popup: c, + foreground: c, + foreground_muted: c, + accent: c, + accent_foreground: c, + border: c, + }, + font_size: 14, + radius: 6, + spacing: 6, + panel_height: 44, + } +} + +///| +test "background gradient covers the screen top to bottom" { + let ops = render_background(@ui.size(800, 600), test_tokens()) + match ops[0] { + FillRect(f) => { + assert_eq(f.rect.y, 0) + assert_eq(f.color.r.to_int(), 10) + } + _ => fail("expected fill") + } + match ops[47] { + FillRect(f) => { + assert_eq(f.color.r.to_int(), 110) + assert_true(f.rect.y + f.rect.h.reinterpret_as_int() >= 600) + } + _ => fail("expected fill") + } +} diff --git a/lib/timefmt/moon.pkg b/lib/timefmt/moon.pkg new file mode 100644 index 0000000..e69de29 diff --git a/lib/timefmt/pkg.generated.mbti b/lib/timefmt/pkg.generated.mbti new file mode 100644 index 0000000..6eab8f3 --- /dev/null +++ b/lib/timefmt/pkg.generated.mbti @@ -0,0 +1,25 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/lib/timefmt" + +// Values +pub fn bcd_bits(Int32, Int32) -> Array[Bool] + +pub fn date_line(Int32, Int32, Int32) -> String + +pub fn hhmm(Int32, Int32) -> String + +pub fn hhmmss(Int32, Int32, Int32) -> String + +pub fn month_short(Int32) -> String + +pub fn pad2(Int32) -> String + +pub fn weekday_short(Int32) -> String + +// Errors + +// Types and methods + +// Type aliases + +// Traits diff --git a/lib/timefmt/timefmt.mbt b/lib/timefmt/timefmt.mbt new file mode 100644 index 0000000..c6d0b81 --- /dev/null +++ b/lib/timefmt/timefmt.mbt @@ -0,0 +1,65 @@ +///| Pure time formatting helpers shared by the clock widgets. + +///| +pub fn pad2(n : Int) -> String { + if n < 10 && n >= 0 { "0" + n.to_string() } else { n.to_string() } +} + +///| +let weekdays : Array[String] = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] + +///| +let months : Array[String] = [ + "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", +] + +///| Weekday 0 = Sunday. Aborts on out-of-range input instead of guessing. +pub fn weekday_short(i : Int) -> String { + guard i >= 0 && i < 7 else { abort("weekday out of range: \{i}") } + weekdays[i] +} + +///| Month 1..12. +pub fn month_short(m : Int) -> String { + guard m >= 1 && m <= 12 else { abort("month out of range: \{m}") } + months[m - 1] +} + +///| +pub fn hhmm(hour : Int, minute : Int) -> String { + pad2(hour) + ":" + pad2(minute) +} + +///| +pub fn hhmmss(hour : Int, minute : Int, second : Int) -> String { + hhmm(hour, minute) + ":" + pad2(second) +} + +///| e.g. "Tue 24 Nov" +pub fn date_line(weekday : Int, day : Int, month : Int) -> String { + weekday_short(weekday) + " " + day.to_string() + " " + month_short(month) +} + +///| The `bits` low bits of `digit`, most significant first. +pub fn bcd_bits(digit : Int, bits : Int) -> Array[Bool] { + let out = [] + let mut i = bits - 1 + while i >= 0 { + out.push(((digit >> i) & 1) == 1) + i = i - 1 + } + out +} + +///| +test "formatting" { + assert_eq(hhmm(9, 5), "09:05") + assert_eq(hhmmss(23, 59, 7), "23:59:07") + assert_eq(date_line(2, 24, 11), "Tue 24 Nov") +} + +///| +test "bcd bits" { + assert_eq(bcd_bits(5, 4), [false, true, false, true]) + assert_eq(bcd_bits(2, 2), [true, false]) +} diff --git a/lib/ui/moon.pkg b/lib/ui/moon.pkg new file mode 100644 index 0000000..4359b9d --- /dev/null +++ b/lib/ui/moon.pkg @@ -0,0 +1,3 @@ +import { + "moonplasma/desktop/interface/moonplasma/desktop/types" @types, +} diff --git a/lib/ui/pkg.generated.mbti b/lib/ui/pkg.generated.mbti new file mode 100644 index 0000000..6710c81 --- /dev/null +++ b/lib/ui/pkg.generated.mbti @@ -0,0 +1,43 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/lib/ui" + +import { + "moonplasma/desktop/interface/moonplasma/desktop/types", +} + +// Values +pub fn circle(Int32, Int32, Int32, @types.Color, filled? : Bool) -> @types.DrawOp + +pub fn color(Int32, Int32, Int32, Int32) -> @types.Color + +pub fn contains(@types.Rect, @types.Point) -> Bool + +pub fn fill_rect(@types.Rect, @types.Color, radius? : Int32) -> @types.DrawOp + +pub fn lerp_color(@types.Color, @types.Color, Int32, Int32) -> @types.Color + +pub fn line(Int32, Int32, Int32, Int32, @types.Color, width? : Int32) -> @types.DrawOp + +pub fn rect(Int32, Int32, Int32, Int32) -> @types.Rect + +pub fn rect_h(@types.Rect) -> Int32 + +pub fn rect_w(@types.Rect) -> Int32 + +pub fn size(Int32, Int32) -> @types.Size + +pub fn stroke_rect(@types.Rect, @types.Color, width? : Int32, radius? : Int32) -> @types.DrawOp + +pub fn text(Int32, Int32, String, Int32, @types.Color, align? : @types.TextAlign, bold? : Bool) -> @types.DrawOp + +pub fn text_width(String, Int32) -> Int32 + +pub fn with_alpha(@types.Color, Int32) -> @types.Color + +// Errors + +// Types and methods + +// Type aliases + +// Traits diff --git a/lib/ui/ui.mbt b/lib/ui/ui.mbt new file mode 100644 index 0000000..e333847 --- /dev/null +++ b/lib/ui/ui.mbt @@ -0,0 +1,171 @@ +///| Shared drawing helpers for components. Pure functions over the WIT types. + +///| +pub fn color(r : Int, g : Int, b : Int, a : Int) -> @types.Color { + { r: r.to_byte(), g: g.to_byte(), b: b.to_byte(), a: a.to_byte() } +} + +///| +fn chan(b : Byte) -> Int { + b.to_int() +} + +///| Linear interpolation of two colours; `num/den` is the weight of `b`. +pub fn lerp_color( + a : @types.Color, + b : @types.Color, + num : Int, + den : Int, +) -> @types.Color { + guard den > 0 else { abort("lerp_color: den must be positive") } + let n = if num < 0 { 0 } else if num > den { den } else { num } + fn mix(x : Byte, y : Byte, n : Int, den : Int) -> Int { + (chan(x) * (den - n) + chan(y) * n) / den + } + + color( + mix(a.r, b.r, n, den), + mix(a.g, b.g, n, den), + mix(a.b, b.b, n, den), + mix(a.a, b.a, n, den), + ) +} + +///| +pub fn with_alpha(c : @types.Color, a : Int) -> @types.Color { + color(chan(c.r), chan(c.g), chan(c.b), a) +} + +///| +pub fn rect(x : Int, y : Int, w : Int, h : Int) -> @types.Rect { + { x, y, w: w.reinterpret_as_uint(), h: h.reinterpret_as_uint() } +} + +///| +pub fn size(w : Int, h : Int) -> @types.Size { + { w: w.reinterpret_as_uint(), h: h.reinterpret_as_uint() } +} + +///| +pub fn rect_w(r : @types.Rect) -> Int { + r.w.reinterpret_as_int() +} + +///| +pub fn rect_h(r : @types.Rect) -> Int { + r.h.reinterpret_as_int() +} + +///| +pub fn contains(r : @types.Rect, p : @types.Point) -> Bool { + p.x >= r.x && + p.y >= r.y && + p.x < r.x + rect_w(r) && + p.y < r.y + rect_h(r) +} + +///| +pub fn fill_rect( + r : @types.Rect, + c : @types.Color, + radius~ : Int = 0, +) -> @types.DrawOp { + @types.DrawOp::FillRect({ rect: r, color: c, radius: radius.reinterpret_as_uint() }) +} + +///| +pub fn stroke_rect( + r : @types.Rect, + c : @types.Color, + width~ : Int = 1, + radius~ : Int = 0, +) -> @types.DrawOp { + @types.DrawOp::StrokeRect({ + rect: r, + color: c, + width: width.reinterpret_as_uint(), + radius: radius.reinterpret_as_uint(), + }) +} + +///| +pub fn line( + x0 : Int, + y0 : Int, + x1 : Int, + y1 : Int, + c : @types.Color, + width~ : Int = 1, +) -> @types.DrawOp { + @types.DrawOp::Line({ + start: { x: x0, y: y0 }, + end: { x: x1, y: y1 }, + color: c, + width: width.reinterpret_as_uint(), + }) +} + +///| +pub fn circle( + cx : Int, + cy : Int, + radius : Int, + c : @types.Color, + filled~ : Bool = true, +) -> @types.DrawOp { + @types.DrawOp::Circle({ + center: { x: cx, y: cy }, + radius: radius.reinterpret_as_uint(), + color: c, + filled, + }) +} + +///| Draw `s` with `origin` at the vertical middle of the line box. +pub fn text( + x : Int, + y : Int, + s : String, + size : Int, + c : @types.Color, + align~ : @types.TextAlign = LEFT, + bold~ : Bool = false, +) -> @types.DrawOp { + @types.DrawOp::Text({ + origin: { x, y }, + text: s, + style: { size: size.reinterpret_as_uint(), color: c, align, bold }, + }) +} + +///| The text-metrics contract of the PoC host: every glyph advances by +/// `ceil(0.6 * size)` pixels (monospace). Replaced by a real shaping +/// interface in a later milestone. +pub fn text_width(s : String, size : Int) -> Int { + s.length() * ((size * 6 + 9) / 10) +} + +///| +test "lerp_color endpoints and midpoint" { + let a = color(0, 0, 0, 255) + let b = color(200, 100, 50, 255) + assert_eq(lerp_color(a, b, 0, 10).r.to_int(), 0) + assert_eq(lerp_color(a, b, 10, 10).r.to_int(), 200) + assert_eq(lerp_color(a, b, 5, 10).g.to_int(), 50) + assert_eq(lerp_color(a, b, 99, 10).b.to_int(), 50) +} + +///| +test "contains is half-open" { + let r = rect(10, 10, 5, 5) + assert_true(contains(r, { x: 10, y: 10 })) + assert_true(contains(r, { x: 14, y: 14 })) + assert_false(contains(r, { x: 15, y: 10 })) + assert_false(contains(r, { x: 9, y: 10 })) +} + +///| +test "text_width follows the 0.6em contract" { + assert_eq(text_width("12:30", 20), 60) + assert_eq(text_width("", 20), 0) +} diff --git a/moon.mod b/moon.mod new file mode 100644 index 0000000..62c0f52 --- /dev/null +++ b/moon.mod @@ -0,0 +1,5 @@ +name = "moonplasma/desktop" + +version = "0.1.0" + +preferred_target = "wasm" diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..f648455 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +# Build every component: MoonBit -> core wasm -> component -> jco transpile. +# scripts/build.sh [component-name ...] (default: all in components.txt) +# Outputs: build/components/.wasm (+ .meta.json), build/jco// (JS host glue). +# Components build independently: rebuilding one never touches another's output. +set -euo pipefail +ROOT="$(cd "$(dirname "$0")/.." && pwd)"; cd "$ROOT" +export PATH="$ROOT/.tools/bin:$HOME/.moon/bin:$PATH" +for t in moon wasm-tools; do + command -v "$t" >/dev/null || { echo "error: $t not found (run scripts/setup-toolchain.sh; install MoonBit)" >&2; exit 1; } +done +JCO="$ROOT/host/node_modules/.bin/jco" +[ -x "$JCO" ] || { echo "error: jco missing; run: (cd host && npm ci)" >&2; exit 1; } + +want=("$@") +mkdir -p build/components build/jco +wasm-tools component wit wit >/dev/null # the WIT package itself must parse + +echo ">> moon build (wasm, release)" +moon build --target wasm --release 2>&1 | grep -v -E 'Warning|^\s*$|[│╭╰─]' || true +[ "${PIPESTATUS[0]}" -eq 0 ] || { echo "error: moon build failed" >&2; exit 1; } + +while read -r name world; do + case "$name" in ''|'#'*) continue;; esac + if [ ${#want[@]} -gt 0 ] && [[ ! " ${want[*]} " =~ " $name " ]]; then continue; fi + core="_build/wasm/release/build/components/$name/gen/gen.wasm" + [ -f "$core" ] || { echo "error: $core missing" >&2; exit 1; } + out="build/components/$name.wasm" + wasm-tools component embed wit "$core" --world "$world" --encoding utf16 -o "build/components/$name.embed.wasm" + wasm-tools component new "build/components/$name.embed.wasm" -o "$out" + rm -f "build/components/$name.embed.wasm" + wasm-tools validate --features component-model "$out" + # Conformance: the component must be a valid implementation of its world. + wasm-tools component targets --world "$world" wit "$out" >/dev/null + # Capability manifest: which host interfaces the binary imports. + imports="$(wasm-tools component wit "$out" | sed -n 's/^ import moonplasma:desktop\/\([a-z-]*\)@.*;/\1/p' | grep -v '^types$' | sort | paste -sd, - || true)" + exports="$(wasm-tools component wit "$out" | sed -n 's/^ export moonplasma:desktop\/\([a-z-]*\)@.*;/\1/p' | sort | paste -sd, -)" + printf '{"name":"%s","world":"%s","imports":[%s],"exports":[%s]}\n' "$name" "$world" \ + "$(echo "$imports" | sed 's/\([a-z-]\+\)/"\1"/g')" "$(echo "$exports" | sed 's/\([a-z-]\+\)/"\1"/g')" \ + > "build/components/$name.meta.json" + rm -rf "build/jco/$name" + "$JCO" transpile "$out" -o "build/jco/$name" --instantiation async --no-typescript --name "$name" >/dev/null + echo "{\"type\":\"module\"}" > "build/jco/$name/package.json" + printf ' %-14s %-16s %7s bytes imports=[%s]\n' "$name" "$world" "$(stat -c %s "$out")" "$imports" +done < scripts/components.txt +echo "ok" diff --git a/scripts/components.txt b/scripts/components.txt new file mode 100644 index 0000000..08cedf9 --- /dev/null +++ b/scripts/components.txt @@ -0,0 +1,5 @@ +# +clock-digital clock-widget +clock-binary clock-widget +launcher launcher-widget +shell shell diff --git a/scripts/gen-bindings.sh b/scripts/gen-bindings.sh new file mode 100755 index 0000000..0f7460a --- /dev/null +++ b/scripts/gen-bindings.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +# (Re)generate the MoonBit guest bindings for every component from wit/. +# +# Shared import bindings land in ./interface and ./world (one copy for all +# components); each component's export bindings land in components//gen. +# The first run also writes moon.pkg for each package; later runs pass +# --ignore-stub so hand-edited moon.pkg / stub.mbt files are preserved. +# +# scripts/gen-bindings.sh regenerate in place +# scripts/gen-bindings.sh --check regenerate into a temp dir and fail if the +# committed bindings differ (order-insensitive: +# wit-bindgen 0.63 emits helper fns in varying order) +set -euo pipefail +ROOT="$(cd "$(dirname "$0")/.." && pwd)"; cd "$ROOT" +export PATH="$ROOT/.tools/bin:$PATH" +mkdir -p .tools +log="$ROOT/.tools/bindgen.log" + +generate() { # + local out="$1" ignore="$2" name world extra + while read -r name world; do + case "$name" in ''|'#'*) continue;; esac + extra=(); [ "$ignore" = 1 ] && extra+=(--ignore-stub) + wit-bindgen moonbit wit --world "$world" --out-dir "$out" \ + --gen-dir "components/$name/gen" --project-name moonplasma/desktop \ + --ignore-module-file "${extra[@]}" >/dev/null 2>"$log" || { cat "$log" >&2; exit 1; } + done < scripts/components.txt +} + +if [ "${1:-}" = "--check" ]; then + tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT + generate "$tmp" 0 + bad=0 + while IFS= read -r f; do + rel="${f#"$tmp"/}" + case "$rel" in */moon.pkg|*/README.md) continue;; esac # hand-edited / docs + if [ ! -f "$rel" ] || ! diff -q <(sort "$f") <(sort "$rel") >/dev/null; then + echo "stale binding: $rel" >&2; bad=1 + fi + done < <(find "$tmp" -type f) + [ "$bad" = 0 ] || { echo "error: bindings differ from wit/; run scripts/gen-bindings.sh and commit" >&2; exit 1; } + echo "bindings up to date" +else + first=0; [ -d components/shell/gen ] || first=1 + generate . $((1 - first)) + echo "bindings regenerated" +fi diff --git a/scripts/screenshot.mjs b/scripts/screenshot.mjs new file mode 100644 index 0000000..9fb14cd --- /dev/null +++ b/scripts/screenshot.mjs @@ -0,0 +1,54 @@ +#!/usr/bin/env node +// Drive the browser host with headless Chromium and save PNG screenshots. +// CHROME_PATH=/path/to/chrome node scripts/screenshot.mjs [--tag name] +// Uses playwright-core (devDependency of host/) with an already-installed +// Chromium; nothing is downloaded here. +import { mkdir } from 'node:fs/promises'; +import { join } from 'node:path'; +import { createRequire } from 'node:module'; +import { fileURLToPath } from 'node:url'; +import { serve } from '../host/serve.mjs'; + +const require = createRequire(join(fileURLToPath(import.meta.url), '..', '..', 'host', 'package.json')); +const { chromium } = require('playwright-core'); +const outdir = process.argv[2]; +if (!outdir) { console.error('usage: screenshot.mjs [--tag name]'); process.exit(2); } +const tagI = process.argv.indexOf('--tag'); +const tag = tagI > 0 ? process.argv[tagI + 1] : 'desktop'; +const exe = process.env.CHROME_PATH; +if (!exe) { console.error('error: set CHROME_PATH to a Chromium/Chrome executable'); process.exit(2); } +await mkdir(outdir, { recursive: true }); + +const srv = await serve(0); +const url = `http://127.0.0.1:${srv.address().port}/host/web/index.html`; +const browser = await chromium.launch({ executablePath: exe, args: ['--no-sandbox'] }); +const page = await browser.newPage({ viewport: { width: 1280, height: 748 } }); +const errors = []; +page.on('pageerror', (e) => errors.push(String(e))); +page.on('console', (m) => { if (m.type() === 'error') errors.push(m.text()); }); +const T = 'time=2026-11-24T14:07:37'; +const shot = async (name, query, steps) => { + await page.goto(`${url}?${T}&${query}`); + await page.waitForFunction(() => window.moonPlasma?.ready || window.moonPlasmaError, null, { timeout: 30000 }); + const err = await page.evaluate(() => window.moonPlasmaError); + if (err) throw new Error(`host failed in browser: ${err}`); + if (steps) await steps(); + const f = join(outdir, `${tag}-${name}.png`); + await page.locator('#screen').screenshot({ path: f }); + console.log(f); +}; +const canvasPoint = async (x, y) => { const b = await page.locator('#screen').boundingBox(); return [b.x + x, b.y + y]; }; +const click = async (x, y) => { const [px, py] = await canvasPoint(x, y); await page.mouse.move(px, py); await page.mouse.down(); await page.mouse.up(); }; + +await shot('1-desktop', 'config=desktop.json'); +await shot('2-launcher-open', 'config=desktop.json', async () => { + await click(60, 700); + await page.keyboard.type('s'); + const [px, py] = await canvasPoint(100, 450); await page.mouse.move(px, py); +}); +await shot('3-binary-clock-swapped', 'config=desktop.json', async () => { + await page.evaluate(() => window.moonPlasma.swap('clock', 'clock-binary')); +}); +await shot('4-day-theme', 'config=desktop.json&theme=moon-day', async () => { await click(60, 700); }); +await browser.close(); srv.close(); +if (errors.length) { console.error('browser errors:\n' + errors.join('\n')); process.exit(1); } diff --git a/scripts/setup-toolchain.sh b/scripts/setup-toolchain.sh new file mode 100755 index 0000000..a77a543 --- /dev/null +++ b/scripts/setup-toolchain.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# Install wasm-tools, wit-bindgen and wasmtime (static release binaries) into +# ./.tools/bin without root. jco is installed by `npm ci` in host/. +# MoonBit itself is installed separately (https://www.moonbitlang.com/download). +set -euo pipefail +ROOT="$(cd "$(dirname "$0")/.." && pwd)" +# shellcheck source=versions.env +source "$ROOT/scripts/versions.env" +BIN="$ROOT/.tools/bin" +mkdir -p "$BIN" +tmp="$(mktemp -d)"; trap 'rm -rf "$tmp"' EXIT + +have() { [ -x "$BIN/$1" ] && "$BIN/$1" --version 2>/dev/null | grep -q "$2"; } + +arch="$(uname -m)" +[ "$arch" = "x86_64" ] || { echo "error: only x86_64 linux is wired up in setup-toolchain.sh (got $arch)" >&2; exit 1; } + +if ! have wasm-tools "$WASM_TOOLS_VERSION"; then + echo ">> wasm-tools $WASM_TOOLS_VERSION" + curl -fsSL "https://github.com/bytecodealliance/wasm-tools/releases/download/v$WASM_TOOLS_VERSION/wasm-tools-$WASM_TOOLS_VERSION-x86_64-linux.tar.gz" | tar xz -C "$tmp" + cp "$tmp"/wasm-tools-*/wasm-tools "$BIN/" +fi +if ! have wit-bindgen "$WIT_BINDGEN_VERSION"; then + echo ">> wit-bindgen $WIT_BINDGEN_VERSION" + curl -fsSL "https://github.com/bytecodealliance/wit-bindgen/releases/download/v$WIT_BINDGEN_VERSION/wit-bindgen-$WIT_BINDGEN_VERSION-x86_64-linux.tar.gz" | tar xz -C "$tmp" + cp "$tmp"/wit-bindgen-*/wit-bindgen "$BIN/" +fi +if ! have wasmtime "$WASMTIME_VERSION"; then + echo ">> wasmtime $WASMTIME_VERSION" + curl -fsSL "https://github.com/bytecodealliance/wasmtime/releases/download/v$WASMTIME_VERSION/wasmtime-v$WASMTIME_VERSION-x86_64-linux.tar.xz" | tar xJ -C "$tmp" + cp "$tmp"/wasmtime-*/wasmtime "$BIN/" +fi +echo "installed into $BIN:" +"$BIN/wasm-tools" --version; "$BIN/wit-bindgen" --version; "$BIN/wasmtime" --version diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 0000000..8f15a27 --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# Full verification, identical to CI: +# WIT parses -> bindings are fresh -> moon check/test (pure logic) -> +# build all components -> conformance -> host integration tests. +set -euo pipefail +ROOT="$(cd "$(dirname "$0")/.." && pwd)"; cd "$ROOT" +export PATH="$ROOT/.tools/bin:$HOME/.moon/bin:$PATH" +step() { printf '\n== %s\n' "$*"; } + +step "bindings are in sync with wit/" +scripts/gen-bindings.sh --check + +step "moon check" +moon check + +step "moon test (pure logic, wasm target)" +moon test + +step "build components" +scripts/build.sh + +if command -v wasmtime >/dev/null; then + step "wasmtime accepts every component (compile only; hosts supply the imports)" + for f in build/components/*.wasm; do + wasmtime compile "$f" -o "$(mktemp -u).cwasm" >/dev/null && echo " ok $(basename "$f")" + done +fi + +step "host integration tests (jco + Node)" +(cd host && npm test) diff --git a/scripts/versions.env b/scripts/versions.env new file mode 100644 index 0000000..5fcb6bc --- /dev/null +++ b/scripts/versions.env @@ -0,0 +1,5 @@ +# Pinned toolchain versions (see docs/TOOLCHAIN.md). +WASM_TOOLS_VERSION=1.263.0 +WIT_BINDGEN_VERSION=0.63.0 +WASMTIME_VERSION=51.0.0 +JCO_VERSION=1.42.0 diff --git a/wit/capabilities.wit b/wit/capabilities.wit new file mode 100644 index 0000000..e3695c5 --- /dev/null +++ b/wit/capabilities.wit @@ -0,0 +1,21 @@ +package moonplasma:desktop@0.1.0; + +/// Host-brokered capabilities. A component can only call what its world +/// imports AND what the host grants it in the desktop manifest. + +interface clock { + use types.{datetime}; + /// Local wall-clock time (the host owns the time zone). + now: func() -> datetime; +} + +interface app-catalog { + use types.{app-entry}; + /// Installed applications (static list in the PoC; .desktop files later). + list-apps: func() -> list; +} + +interface app-launch { + /// Ask the host to start an application by catalog id. + launch: func(id: string) -> result<_, string>; +} diff --git a/wit/plasmoid.wit b/wit/plasmoid.wit new file mode 100644 index 0000000..39e57ec --- /dev/null +++ b/wit/plasmoid.wit @@ -0,0 +1,31 @@ +package moonplasma:desktop@0.1.0; + +/// The widget (plasmoid) contract. +interface plasmoid { + use types.{size, draw-op, input-event}; + + record plasmoid-info { + /// Stable machine id, e.g. "org.moonplasma.clock.digital". + id: string, + name: string, + preferred: size, + min-width: u32, + /// Whether the panel may grow this widget beyond `preferred`. + stretch: bool, + } + + record popup-surface { + size: size, + ops: list, + } + + enum surface { widget, popup } + + info: func() -> plasmoid-info; + /// Draw the widget into a `size` box (local coordinates). + render: func(size: size) -> list; + /// Present when the widget wants a popup surface (e.g. a launcher menu). + popup: func() -> option; + /// Returns true when the widget's visuals changed and a redraw is needed. + on-event: func(target: surface, event: input-event) -> bool; +} diff --git a/wit/shell.wit b/wit/shell.wit new file mode 100644 index 0000000..1826c6b --- /dev/null +++ b/wit/shell.wit @@ -0,0 +1,37 @@ +package moonplasma:desktop@0.1.0; + +/// Panel layout/chrome contract (the plasmashell "containment" analogue). +interface panel-layout { + use types.{size, rect, draw-op}; + + enum edge { start, end } + + record slot { + id: string, + preferred: size, + min-width: u32, + stretch: bool, + /// Which end of the panel the widget packs towards. + align: edge, + } + + record placement { id: string, rect: rect } + + record layout { + panel: rect, + placements: list, + } + + /// Decide where the panel sits and where each widget goes. + compute-layout: func(screen: size, slots: list) -> layout; + /// Panel background/frame (drawn beneath the widgets), in screen coords. + render-panel: func(screen: size, panel: rect) -> list; + /// Place a popup of `popup` size for the widget at `anchor`. + popup-position: func(screen: size, panel: rect, anchor: rect, popup: size) -> rect; +} + +/// Desktop surface contract (wallpaper / desktop containment). +interface desktop-surface { + use types.{size, draw-op}; + render-background: func(screen: size) -> list; +} diff --git a/wit/theme.wit b/wit/theme.wit new file mode 100644 index 0000000..48f8364 --- /dev/null +++ b/wit/theme.wit @@ -0,0 +1,31 @@ +package moonplasma:desktop@0.1.0; + +/// Look-and-feel design tokens (Plasma "Look and Feel"/colour scheme analogue). +interface theme { + use types.{color}; + + record palette { + desktop-top: color, + desktop-bottom: color, + surface: color, + surface-hover: color, + surface-popup: color, + foreground: color, + foreground-muted: color, + accent: color, + accent-foreground: color, + border: color, + } + + record tokens { + name: string, + palette: palette, + font-size: u32, + radius: u32, + spacing: u32, + panel-height: u32, + } + + /// Read on every render so a theme swap shows up on the next frame. + get-tokens: func() -> tokens; +} diff --git a/wit/types.wit b/wit/types.wit new file mode 100644 index 0000000..3c77598 --- /dev/null +++ b/wit/types.wit @@ -0,0 +1,74 @@ +package moonplasma:desktop@0.1.0; + +/// Shared value types. Everything here is plain data (no resources) so that +/// it can cross any component boundary and any host implementation. +interface types { + record size { w: u32, h: u32 } + record point { x: s32, y: s32 } + record rect { x: s32, y: s32, w: u32, h: u32 } + /// Non-premultiplied sRGB, 8 bits per channel. + record color { r: u8, g: u8, b: u8, a: u8 } + + enum text-align { left, center, right } + + record text-style { + /// Pixel height of the em box. + size: u32, + color: color, + align: text-align, + bold: bool, + } + + record fill-rect-op { rect: rect, color: color, radius: u32 } + record stroke-rect-op { rect: rect, color: color, width: u32, radius: u32 } + record line-op { start: point, end: point, color: color, width: u32 } + record circle-op { center: point, radius: u32, color: color, filled: bool } + /// `origin` is the left edge (align=left), centre (center) or right edge + /// (right) of the text, at the vertical *middle* of the line box. + record text-op { origin: point, text: string, style: text-style } + + /// The render-list vocabulary. Components never touch pixels: they return + /// a list of these in their own local coordinate space (origin top-left), + /// and the host/compositor translates, clips and rasterises them. + variant draw-op { + fill-rect(fill-rect-op), + stroke-rect(stroke-rect-op), + line(line-op), + circle(circle-op), + text(text-op), + push-clip(rect), + pop-clip, + } + + variant input-event { + pointer-move(point), + pointer-down(point), + pointer-up(point), + pointer-leave, + /// Sent to a popup owner when the user clicks outside its popup. + focus-lost, + /// A printable character ("a") or a named key ("Backspace", "Enter", "Escape"). + key-down(string), + } + + record datetime { + year: u32, + month: u8, + day: u8, + hour: u8, + minute: u8, + second: u8, + /// 0 = Sunday .. 6 = Saturday + weekday: u8, + } + + record app-entry { + id: string, + name: string, + comment: string, + category: string, + /// A short glyph (1-2 chars) standing in for an icon until the icon + /// theme interface lands. + glyph: string, + } +} diff --git a/wit/worlds.wit b/wit/worlds.wit new file mode 100644 index 0000000..e303e2c --- /dev/null +++ b/wit/worlds.wit @@ -0,0 +1,30 @@ +package moonplasma:desktop@0.1.0; + +/// Minimum every widget gets: theme tokens. Everything else is opt-in. +world widget { + import theme; + export plasmoid; +} + +world clock-widget { + include widget; + import clock; +} + +world launcher-widget { + include widget; + import app-catalog; + import app-launch; +} + +world panel { + import theme; + export panel-layout; +} + +/// Reference shell: panel + desktop background in one component. +world shell { + import theme; + export desktop-surface; + export panel-layout; +} diff --git a/world/clock-widget/ffi_import.mbt b/world/clock-widget/ffi_import.mbt new file mode 100644 index 0000000..cdedbce --- /dev/null +++ b/world/clock-widget/ffi_import.mbt @@ -0,0 +1,2 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + diff --git a/world/clock-widget/import.mbt b/world/clock-widget/import.mbt new file mode 100644 index 0000000..cdedbce --- /dev/null +++ b/world/clock-widget/import.mbt @@ -0,0 +1,2 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + diff --git a/world/clock-widget/moon.pkg b/world/clock-widget/moon.pkg new file mode 100644 index 0000000..e2a6033 --- /dev/null +++ b/world/clock-widget/moon.pkg @@ -0,0 +1 @@ +warnings = "-44" diff --git a/world/clock-widget/pkg.generated.mbti b/world/clock-widget/pkg.generated.mbti new file mode 100644 index 0000000..60dfab5 --- /dev/null +++ b/world/clock-widget/pkg.generated.mbti @@ -0,0 +1,12 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/world/clock-widget" + +// Values + +// Errors + +// Types and methods + +// Type aliases + +// Traits diff --git a/world/launcher-widget/ffi_import.mbt b/world/launcher-widget/ffi_import.mbt new file mode 100644 index 0000000..cdedbce --- /dev/null +++ b/world/launcher-widget/ffi_import.mbt @@ -0,0 +1,2 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + diff --git a/world/launcher-widget/import.mbt b/world/launcher-widget/import.mbt new file mode 100644 index 0000000..cdedbce --- /dev/null +++ b/world/launcher-widget/import.mbt @@ -0,0 +1,2 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + diff --git a/world/launcher-widget/moon.pkg b/world/launcher-widget/moon.pkg new file mode 100644 index 0000000..e2a6033 --- /dev/null +++ b/world/launcher-widget/moon.pkg @@ -0,0 +1 @@ +warnings = "-44" diff --git a/world/launcher-widget/pkg.generated.mbti b/world/launcher-widget/pkg.generated.mbti new file mode 100644 index 0000000..f0c0b62 --- /dev/null +++ b/world/launcher-widget/pkg.generated.mbti @@ -0,0 +1,12 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/world/launcher-widget" + +// Values + +// Errors + +// Types and methods + +// Type aliases + +// Traits diff --git a/world/shell/README.md b/world/shell/README.md new file mode 100644 index 0000000..abbae71 --- /dev/null +++ b/world/shell/README.md @@ -0,0 +1 @@ +Reference shell: panel + desktop background in one component. \ No newline at end of file diff --git a/world/shell/ffi_import.mbt b/world/shell/ffi_import.mbt new file mode 100644 index 0000000..cdedbce --- /dev/null +++ b/world/shell/ffi_import.mbt @@ -0,0 +1,2 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + diff --git a/world/shell/import.mbt b/world/shell/import.mbt new file mode 100644 index 0000000..cdedbce --- /dev/null +++ b/world/shell/import.mbt @@ -0,0 +1,2 @@ +// Generated by `wit-bindgen` 0.63.0. DO NOT EDIT! + diff --git a/world/shell/moon.pkg b/world/shell/moon.pkg new file mode 100644 index 0000000..e2a6033 --- /dev/null +++ b/world/shell/moon.pkg @@ -0,0 +1 @@ +warnings = "-44" diff --git a/world/shell/pkg.generated.mbti b/world/shell/pkg.generated.mbti new file mode 100644 index 0000000..bbd6127 --- /dev/null +++ b/world/shell/pkg.generated.mbti @@ -0,0 +1,12 @@ +// Generated using `moon info`, DON'T EDIT IT +package "moonplasma/desktop/world/shell" + +// Values + +// Errors + +// Types and methods + +// Type aliases + +// Traits