component-shape-gpui 0.4.0

GPUI component shape runtime contracts and macros.
Documentation

component-shape-gpui

Codecov: component-shape-gpui crates.io: component-shape-gpui

component-shape-gpui is the GPUI facade in the component-shape project for declaring component shapes, constructing their state, rendering them, and binding value changes. Depend on it directly for GPUI integrations; it re-exports the shared metadata and both declaration macros.

Requires Rust 1.99 or newer and uses GPUI Kit 0.9.0. The 0.4 release line uses GPUI Kit 0.9; the 0.3 line uses GPUI Kit 0.8.

Example

Declare a state-only InputShape to publish String compatibility and a stable input suffix without opening a GPUI window. Omitting component selects the non-rendering contract.

use component_shape_gpui::{ComponentShapeFor, McpInput, component_shape};

pub struct InputState;

impl InputState {
    fn new(_window: &mut gpui_kit::Window, _cx: &mut gpui_kit::Context<'_, Self>) -> Self {
        Self
    }
}

component_shape! {
    pub struct InputShape {
        state = InputState;
        value = String;
        field_suffix = "input";
    }
}

fn main() {
    assert_eq!(<InputShape as ComponentShapeFor<String>>::MCP_INPUT, McpInput::string());
}

Use #[derive(GpuiComponentShape)] for an owned rendered component. The API reference documents builders, render contracts, and value binding.