feat: studio.theme.solarized v0.1.0 builds against SDK

Promotes the skeleton to a real WASM plugin component. The
22 KiB stripped artefact at
target/wasm32-wasip2/release/studio_theme_solarized.wasm
is the proof-of-contract for fai-studio-plugin-sdk v0.1.

Implements:

- theme::Guest::theme_for(brightness) returning the
  pinned Solarized Light/Dark palettes (14 ARGB tokens
  each). Brightness names other than "light"/"dark"
  return PluginError::Declined.
- translate::Guest + output_view::Guest as Declined-only
  stubs — v0.1 of the SDK requires all three hooks per
  plugin; v0.2 will split the WIT.

Cargo.toml pins edition 2021 (matches SDK; wit-bindgen
0.36 codegen does not yet support edition 2024).

Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
flemming-it 2026-05-25 14:31:23 +02:00
parent a1f8412205
commit 6817752ae3
5 changed files with 520 additions and 105 deletions

View file

@ -1,42 +1,51 @@
# studio-theme-solarized
First in-tree Studio plugin, by way of being the smallest one
the Studio plugin design supports: a theme.
First in-tree Studio plugin. Ships Ethan Schoonover's
Solarized palette as a Material 3 ColorScheme pair through the
WIT `theme` export.
## Status
**Skeleton.** The crate compiles to the Cargo manifest level but
not to a `.wasm` artefact, because the dependency it points at
(`fai-studio-plugin-sdk`) does not exist yet.
**v0.1 builds.** The `target/wasm32-wasip2/release/studio_theme_solarized.wasm`
artefact (~22 KiB stripped) is a valid F∆I Studio plugin
component. What remains for full round-trip:
Why ship the skeleton now: pins the Solarized colour palette so
the in-tree reference doesn't bike-shed at integration time, and
gives the future SDK author a concrete consumer to test the
generated `#[plugin(theme)]` macro output against.
- The Hub side needs an `InvokePlugin` gRPC RPC + a
Component-Model loader path for `studio-plugin`-world
components. Tracked as task #80.
- Studio side needs `plugin_host.dart` + a theme-picker UI
that lists installed `studio.theme.*` capabilities.
Tracked in:
- `docs/advanced/studio-plugin-sdk.md` (SDK design)
- `docs/advanced/studio-plugins.md` (plugin subsystem overview)
- `docs/advanced/system-gaps.md#s-21`
Until those land, this plugin can be inspected with
`wasm-tools component wit` and packed via `fai pack`
`/tmp/studio-theme-solarized-0.1.0.fai` is sha256
`e3d5aae44bb97f14f8f84e293ef8742700956b69c7d6fe46bb8b3c97fc1b23a0`.
## Palette
Ethan Schoonover's [Solarized](https://ethanschoonover.com/solarized/).
14 Material 3 tokens per brightness, in the order Studio expects
(primary → on-primary → secondary → … → outline-variant).
14 Material 3 tokens per brightness, in the order Studio
expects (primary → on-primary → secondary → … →
outline-variant). Both Light and Dark are explicit consts in
`src/lib.rs`.
The Light and Dark schemes are explicit constants in `src/lib.rs`
so the file's history is a self-contained record of the palette
choice. Bike-shed there if at all.
## Why the source has three Guest impls
## How to finish this plugin
v0.1 of the SDK declares all three plugin hooks (`theme`,
`translate`, `output-view`) in a single WIT world. A plugin
that only cares about one hook still has to declare all three
— the other two return `PluginError::Declined`, and Studio
falls back to its built-in renderer / the `[EN]` badge.
When the SDK lands:
v0.2 will split the WIT into one world per hook so a theme
plugin only writes the theme impl. See
`docs/advanced/studio-plugin-sdk.md` in `fai/platform` for
the design notes.
1. Uncomment the `fai-studio-plugin-sdk` dependency in
`Cargo.toml`.
2. Uncomment the `#[plugin(theme)]` block in `src/lib.rs`.
3. `cargo build --release --target wasm32-wasip2`.
4. `fai pack . -o studio-theme-solarized-0.1.0.fai`.
5. Add to seed.yaml (or to a `studio-plugins/` channel — open
decision; see docs/advanced/studio-plugins.md).
## Build
```bash
cargo build --release --target wasm32-wasip2
cp target/wasm32-wasip2/release/studio_theme_solarized.wasm module.wasm
fai pack .
```