diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b61d2429d0..e7ae30d3ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -89,14 +89,15 @@ jobs: # 10 GB cache limit and get the corpus, SonarCloud and Windows ARM64 entries evicted. This deletes # the old entries when the `cache warm` leg starts saving (scripts/ci-clear-rolling-cache.py). # When the leg fails or is canceled, before its save or during it, this job fails too, so "Re-run - # failed jobs" runs it again beside the re-run leg. The script's 160-minute wait starts when the leg - # starts, which is after `gate / select legs` and a free runner, so this job's timeout leaves - # 40 minutes for that. + # failed jobs" runs it again beside the re-run leg. The leg starts after `gate / select legs` and a + # free runner: the script fails when the leg has not started within 120 minutes, and then waits + # up to 160 minutes from the leg's start. This job's timeout is longer than both together, so the + # script reports a leg that starts late with its own error before the job times out. cold-cache-clear: name: cold cache clear if: github.event_name == 'schedule' runs-on: ubuntu-24.04 - timeout-minutes: 200 + timeout-minutes: 290 permissions: actions: write steps: diff --git a/ASSETS.md b/ASSETS.md index 9220086fa7..03f33d9a6e 100644 --- a/ASSETS.md +++ b/ASSETS.md @@ -33,7 +33,7 @@ Generated-in-code art is original and has no file to list. This covers the defau **Font files are never committed here.** Fonts shared by the Crafting Apps live in [storytold/craft-fonts](https://github.com/storytold/craft-fonts). The small Latin UI/document fonts below predate that rule and stay. -**Optional build input: craft-fonts.** Builds made with `CRAFT_FONTS_DIR=` (all official releases) embed the Japanese fonts listed in its [`ATTRIBUTION.md`](https://github.com/storytold/craft-fonts/blob/main/ATTRIBUTION.md): BIZ UDPGothic Regular and Bold, Shippori Mincho Regular and BIZ UDMincho Regular (web builds: BIZ UDPGothic Regular only), all under the SIL Open Font License 1.1. They are not files in this repository; release packages carry each one's `OFL-.txt`. Builds without `CRAFT_FONTS_DIR` embed none of them. +**Optional build input: craft-fonts.** Builds made with `CRAFT_FONTS_DIR=` (all official releases) embed the Japanese fonts listed in its [`ATTRIBUTION.md`](https://github.com/storytold/craft-fonts/blob/main/ATTRIBUTION.md): BIZ UDPGothic Regular and Bold, Shippori Mincho Regular and BIZ UDMincho Regular (web builds: BIZ UDPGothic Regular only), all under the SIL Open Font License 1.1. They are not files in this repository; release packages carry each one's `OFL-.txt`. Builds without `CRAFT_FONTS_DIR` embed none of them. Desktop builds with a checkout whose opt-in `fonts/latin-manifest.txt` lists Noto Sans Condensed SemiBold (The Noto Project Authors, SIL Open Font License 1.1, from the [notofonts/latin-greek-cyrillic NotoSans-v2.015 release](https://github.com/notofonts/latin-greek-cyrillic/releases/tag/NotoSans-v2.015)) also embed that face, for document tab titles. | Asset | Author | Source | Licence | Notes | |---|---|---|---|---| diff --git a/Cargo.lock b/Cargo.lock index 53ddb08a11..12572feaa3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8876,6 +8876,16 @@ dependencies = [ "vectorcraft-text", ] +[[package]] +name = "vectorcraft-plugin-worker" +version = "0.24.1" +dependencies = [ + "js-sys", + "vectorcraft-plugins", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "vectorcraft-plugins" version = "0.24.1" diff --git a/NOTICE b/NOTICE index 99d05d6235..4d7c813796 100644 --- a/NOTICE +++ b/NOTICE @@ -45,6 +45,8 @@ fonts listed in https://github.com/storytold/craft-fonts/blob/main/ATTRIBUTION.m Shippori Mincho, BIZ UDMincho, Noto Sans CJK SC and Noto Sans Arabic in the current manifest; web builds BIZ UDPGothic Regular only) under the SIL Open Font License 1.1. Their license texts ship with the release packages as OFL-.txt. +Desktop builds with a craft-fonts checkout whose fonts/latin-manifest.txt lists Noto Sans Condensed +SemiBold (Copyright 2022 The Noto Project Authors, SIL Open Font License 1.1) also embed that face. PDF import decodes CJK text with Adobe's CMap resources (https://github.com/adobe-type-tools/cmap-resources), compiled into the app through the hayro-cmap crate under the BSD 3-Clause License: diff --git a/apps/vectorcraft-plugin-worker/Cargo.toml b/apps/vectorcraft-plugin-worker/Cargo.toml new file mode 100644 index 0000000000..a2dfc0b944 --- /dev/null +++ b/apps/vectorcraft-plugin-worker/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "vectorcraft-plugin-worker" +description = "The web build's plug-in worker: checks plug-in modules being installed and runs filters off the page" +version.workspace = true +edition.workspace = true +license.workspace = true +publish = false + +[lints] +workspace = true + +[[bin]] +name = "vectorcraft-plugin-worker" +path = "src/main.rs" + +[target.'cfg(target_arch = "wasm32")'.dependencies] +vectorcraft-plugins = { workspace = true } +wasm-bindgen = "0.2" +js-sys = "0.3" +web-sys = { version = "0.3", features = ["DedicatedWorkerGlobalScope", "MessageEvent"] } diff --git a/apps/vectorcraft-plugin-worker/src/main.rs b/apps/vectorcraft-plugin-worker/src/main.rs new file mode 100644 index 0000000000..4699ca2e3f --- /dev/null +++ b/apps/vectorcraft-plugin-worker/src/main.rs @@ -0,0 +1,37 @@ +//! The web build's plug-in worker ([`vectorcraft_plugins::worker`]). Trunk builds it beside the +//! app (`data-type="worker"` in `apps/vectorcraft-web/index.html`), and the page starts one for each +//! module it checks and each filter it runs, through the loader Trunk writes for it +//! (`vectorcraft-plugin-worker_loader.js`). Each message, both ways, is one `Uint8Array`. + +#[cfg(target_arch = "wasm32")] +fn main() { + use std::cell::RefCell; + use std::rc::Rc; + + use wasm_bindgen::JsCast as _; + use wasm_bindgen::prelude::Closure; + use web_sys::{DedicatedWorkerGlobalScope, MessageEvent}; + + let scope: DedicatedWorkerGlobalScope = js_sys::global().unchecked_into(); + let poster = scope.clone(); + let post = Rc::new(move |msg: Vec| { + let bytes = js_sys::Uint8Array::from(msg.as_slice()); + // A message that can't be posted leaves the page waiting, and its time budget ends the run. + let _ = poster.post_message_with_transfer(&bytes, &js_sys::Array::of1(&bytes.buffer())); + }); + let worker = Rc::new(RefCell::new(vectorcraft_plugins::worker::Worker::new(post))); + let handler = Rc::clone(&worker); + let on_message = Closure::::new(move |e: MessageEvent| { + let msg = js_sys::Uint8Array::new(&e.data()).to_vec(); + handler.borrow_mut().handle(&msg); + }); + scope.set_onmessage(Some(on_message.as_ref().unchecked_ref())); + // The handler lives as long as the worker. + on_message.forget(); + worker.borrow().ready(); +} + +#[cfg(not(target_arch = "wasm32"))] +fn main() { + eprintln!("vectorcraft-plugin-worker only runs in the browser, as the web build's plug-in worker"); +} diff --git a/apps/vectorcraft-web/Cargo.toml b/apps/vectorcraft-web/Cargo.toml index 7208bea2ab..a9a1013520 100644 --- a/apps/vectorcraft-web/Cargo.toml +++ b/apps/vectorcraft-web/Cargo.toml @@ -33,4 +33,4 @@ wasm-bindgen = "0.2" serde_json = { workspace = true } wasm-bindgen-futures = "0.4" js-sys = "0.3" -web-sys = { version = "0.3", features = ["Window", "Document", "Element", "HtmlElement", "HtmlCanvasElement", "HtmlInputElement", "KeyboardEvent", "HtmlIFrameElement", "HtmlAnchorElement", "Blob", "BlobPropertyBag", "ClipboardEvent", "DataTransfer", "File", "FileList", "Url", "Location", "CssStyleDeclaration", "Event", "EventTarget", "MouseEvent", "PointerEvent", "TouchEvent", "AddEventListenerOptions", "DomRect", "DragEvent", "Storage", "Navigator", "RequestInit", "Response", "AbortController", "AbortSignal"] } +web-sys = { version = "0.3", features = ["Window", "Document", "Element", "HtmlElement", "HtmlCanvasElement", "HtmlInputElement", "KeyboardEvent", "HtmlIFrameElement", "HtmlAnchorElement", "Blob", "BlobPropertyBag", "ClipboardEvent", "DataTransfer", "File", "FileList", "Url", "Location", "CssStyleDeclaration", "Event", "EventTarget", "MouseEvent", "PointerEvent", "TouchEvent", "AddEventListenerOptions", "DomRect", "DragEvent", "Storage", "Navigator", "RequestInit", "Response", "AbortController", "AbortSignal", "Node", "Worker", "MessageEvent", "ErrorEvent", "Performance"] } diff --git a/apps/vectorcraft-web/index.html b/apps/vectorcraft-web/index.html index 2ccfc271b0..965bd03ebd 100644 --- a/apps/vectorcraft-web/index.html +++ b/apps/vectorcraft-web/index.html @@ -17,6 +17,8 @@ + +