Skip to main content

Crate cranpose_liquid

Crate cranpose_liquid 

Source
Expand description

§cranpose-liquid

cranpose-liquid provides Cranpose’s glass surfaces, controls, semantic colors, typography, and motion. Apps use the crate for buttons, cards, menus, sliders, tabs, toggles, and themed surfaces across Cranpose targets.

Depend directly on cranpose-liquid when an app uses these components. The feature set is empty. The app also needs cranpose with its host and renderer features, plus the usual Cranpose UI setup.

§Theme and button

LiquidTheme supplies colors and typography to its child components. A button uses a GlassButtonSpec and composes a GlassButtonLabel:

use cranpose_liquid::{
    GlassButton, GlassButtonLabel, GlassButtonSpec, LiquidTheme, LiquidThemeSpec,
};
use cranpose_ui::{Modifier, composable};

#[composable]
fn SaveAction(on_save: impl Fn() + 'static) {
    LiquidTheme(LiquidThemeSpec::default(), move || {
        GlassButton(Modifier::empty(), GlassButtonSpec::prominent(), on_save, || {
            GlassButtonLabel("Save".into(), GlassButtonSpec::prominent());
        });
    });
}

The app host supplies composition, input, draw output, and platform services. SchemeMode::Auto follows the system appearance; Light and Dark pin a palette. GlassButtonSpec selects glass, prominent, plain, or destructive styles.

Re-exports§

pub use appearance::GlassTintAmount;
pub use appearance::InvalidGlassTintAmount;
pub use dynamics::LiquidDynamics;
pub use dynamics::LiquidPose;
pub use dynamics::rememberLiquidDynamics;
pub use material::Glass;
pub use material::GlassContourHighlight;
pub use material::GlassDeformation;
pub use material::GlassDynamics;
pub use material::GlassFaceResponse;
pub use material::GlassFaceTone;
pub use material::GlassKeyFill;
pub use material::GlassMorph;
pub use material::GlassRefraction;
pub use material::GlassShadow;
pub use material::GlassSpectrum;
pub use material::GlassSpecularHighlight;
pub use material::GlassVariant;
pub use material::LiquidModifierExt;
pub use material::LiquidShape;
pub use material::glass_light_direction;
pub use material::set_glass_light_direction;
pub use motion::LiquidMotion;
pub use motion::liquid_press_scale;
pub use theme::LiquidColors;
pub use theme::LiquidSegmentedStyle;
pub use theme::LiquidTheme;
pub use theme::LiquidThemeSpec;
pub use theme::LiquidTypography;
pub use theme::ProvideLiquidSegmentedStyle;
pub use theme::SchemeMode;
pub use theme::liquid_colors;
pub use theme::liquid_glass_tint_amount;
pub use theme::liquid_segmented_style;
pub use theme::liquid_typography;
pub use widgets::*;

Modules§

appearance
Application-wide Liquid Glass appearance preferences.
dynamics
Water-droplet motion physics shared by every travelling liquid lens.
icons
Built-in vector icon set (24×24 viewBox path data, Material Design icons, Apache-2.0), rasterized through cranpose_ui_graphics::VectorPath and tinted at draw time.
material
The Liquid Glass material: Gaussian backdrop frost followed by wcKSRD refraction applied to a composable’s own bounds through LiquidModifierExt::glass_effect — the analogue of SwiftUI’s .glassEffect(_:in:).
motion
Liquid motion: the spring presets every component shares, and the press interaction (scale + specular boost) that makes glass feel physical.
prelude
Everything an app needs to build Liquid UI.
theme
Liquid theme: semantic colors, the iOS-style type ramp, and glass defaults, provided to the subtree through composition locals — the analogue of MaterialTheme.
widgets
The Liquid component set.