Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
96bee7b
docs: add Phase 1 layout foundation plan
intendednull May 9, 2026
1377bbc
feat(buiy_core): add layout::types submodule — Length, Sizing, Edges,…
intendednull May 9, 2026
8c69695
docs(buiy_core): add semantic doc comments to JustifyContent/AlignIte…
intendednull May 9, 2026
dab82fd
docs: amend Phase 1 plan — Task 1 lessons learned
intendednull May 9, 2026
4ef1be5
feat(buiy_core): add layout::components — BoxModel, Display, Position…
intendednull May 9, 2026
1bf342e
style(buiy_core): align layout derive ordering with Phase 0 convention
intendednull May 9, 2026
eda98e3
docs: amend Phase 1 plan — derive ordering convention
intendednull May 9, 2026
1cb0ada
feat(buiy_core): add layout::style — hybrid Style builder over decomp…
intendednull May 9, 2026
b4c6df6
feat(buiy_core): add layout::translate — decomposed → taffy::Style
intendednull May 9, 2026
7820a45
feat(buiy_core): add layout::pipeline — BuiyLayoutStep + 8-step chain…
intendednull May 9, 2026
c7f611b
fix(buiy_core): re-export BuiyLayoutStep and configure_pipeline from …
intendednull May 9, 2026
6c0587b
style: cargo fmt sweep on layout/{style,translate}.rs
intendednull May 9, 2026
816555d
feat(buiy_core): add layout::tree — re-home LayoutTree to the new module
intendednull May 9, 2026
ac33faa
refactor(buiy_core): replace mega-Style with hybrid Style builder + d…
intendednull May 9, 2026
f3b3eef
chore(buiy_core): drop stale dead-code allows now that Task 7 wires t…
intendednull May 9, 2026
00855d8
test(buiy_core): topology, pipeline order, box-sizing, Style API equi…
intendednull May 9, 2026
e19779d
docs: Phase 1 layout migration shipped — flip spec + plan status to a…
intendednull May 9, 2026
752fc0c
chore: flip plan status to active + drop stale dead-code allows
intendednull May 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,32 @@ tagged release.
deferral.
- `bevy_picking` backend. `Hovered` becomes a thin layer over the standard
`PointerHits` event flow. Closes the Phase 0 picking deferral.
- `buiy_core::components::Visual` component (`background_token`,
`foreground_token`, `border_radius`) carrying the render-side surface
formerly mixed into the Phase 0 mega-`Style`. Authors who want themed
widgets insert `Visual` alongside the new layout `Style` builder.
Eventual home is `buiy-render-pipeline-design`.
- `buiy_core::layout` module: 8-step layout pipeline (`BuiyLayoutStep`
system sets), decomposed `BoxModel` / `Display` / `Position` /
`FlexParams` / `FlexItem` components, hybrid `Style` builder that
expands to a `Bundle` on spawn.

### Changed
- Layout subsystem foundation rewritten. Phase 0's flat `layout.rs` is
replaced by a `layout/` directory module. The pipeline is an 8-step
ordered chain (`BuiyLayoutStep` system sets) inside `BuiySet::Layout`;
Phase 1 implements steps 0/1/3/7 and stubs the remaining four for
later phase plans.
- `Style` is now a `Bundle` that decomposes on insert, not a reflectable
`Component`. Reflection / inspectors / BSN see the decomposed
components (`BoxModel`, `Display`, `Position`, `FlexParams`).
- The render extract now queries `(&Visual, &ResolvedLayout)` instead
of `(&Style, &ResolvedLayout)`; entities without `Visual` are skipped
by render. `Button::new` inserts a `Visual` carrying the same theme
tokens Phase 0's `Style` did, so visual appearance is preserved.

### Removed
- `buiy_core::components::Style` (the Phase 0 mega-component) and
`buiy_core::components::FlexDirection`. Their roles are taken by
`buiy_core::layout::Style` (the hybrid builder) and
`buiy_core::layout::FlexAxis` (the four-variant axis enum).
7 changes: 6 additions & 1 deletion crates/buiy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ use bevy::prelude::*;
pub use buiy_core::{
BuiySet, CorePlugin,
a11y::{A11yDescription, A11yLabel, A11yRole, A11yTreeBuilder, AccessKitAdapterPlugin},
components::{FlexDirection, Node, ResolvedLayout, Style},
components::{Node, ResolvedLayout, Visual},
focus::{FocusVisible, Focusable, FocusedEntity},
layout::{
AlignContent, AlignItems, AspectRatio, BoxModel, BoxSizing, BuiyLayoutStep, Display, Edges,
FlexAxis, FlexGap, FlexItem, FlexParams, FlexWrap, Inset, JustifyContent, LayoutPlugin,
Length, Position, PositionKind, Sizing, Style,
},
picking::{BuiyPickingBackendPlugin, Hovered},
theme::{Theme, UserPreferences, default_light_theme},
};
Expand Down
81 changes: 36 additions & 45 deletions crates/buiy_core/src/components.rs
Original file line number Diff line number Diff line change
@@ -1,57 +1,24 @@
//! Buiy's core component types.
//!
//! Every Buiy component is small, public-fielded, observable, and decomposed
//! by concern. Every component derives `Reflect + Default + Clone + Component`
//! (and Bevy 0.18's `Reflect` derive auto-generates `FromReflect`). See:
//! docs/specs/2026-05-07-buiy-foundation/architecture.md § 2.4.
//! Every Buiy component is small, public-fielded, observable, and
//! decomposed by concern. Layout components live in
//! `crate::layout::components`; this file holds the cross-cutting
//! `Node` marker, the shared `ResolvedLayout` output, and the temporary
//! `Visual` component (token-based rendering surface — eventual owner
//! is `buiy-render-pipeline-design`).
//!
//! See: docs/specs/2026-05-07-buiy-foundation/architecture.md § 2.4.

use bevy::prelude::*;

/// Flex layout direction. Mirrors Taffy's `FlexDirection` for the
/// row / column subset used in Phase 0; v0.x layout-design will widen
/// this to include `RowReverse` / `ColumnReverse` when needed.
///
/// Marked `#[non_exhaustive]` because new variants are expected pre-1.0
/// and external matches must opt in to handling them.
#[derive(Reflect, Default, Clone, Copy, Debug, PartialEq, Eq)]
#[non_exhaustive]
pub enum FlexDirection {
#[default]
Row,
Column,
}

/// A Buiy node — the parallel-to-bevy_ui::Node primitive. Marker that this
/// entity participates in Buiy's layout / render / a11y trees.
/// A Buiy node — the parallel-to-`bevy_ui::Node` primitive. Marker that
/// this entity participates in Buiy's layout / render / a11y trees.
#[derive(Component, Reflect, Default, Clone, Debug)]
#[reflect(Component)]
pub struct Node;

/// Box-model + layout style. Not exhaustive in Phase 0 — only the surface
/// the layout system reads.
#[derive(Component, Reflect, Default, Clone, Debug)]
#[reflect(Component)]
pub struct Style {
/// Width in logical pixels. 0.0 = auto.
pub width: f32,
/// Height in logical pixels. 0.0 = auto.
pub height: f32,
/// Padding on all sides.
pub padding: f32,
/// Margin on all sides.
pub margin: f32,
/// Border radius (uniform; per-corner is a later sub-spec).
pub border_radius: f32,
/// Flex direction. Mapped to Taffy in `layout.rs`.
pub flex_direction: FlexDirection,
/// Token reference for background color (e.g., "color.surface.primary").
pub background_token: String,
/// Token reference for foreground/text color.
pub foreground_token: String,
}

/// Resolved layout output, written by the layout system in `BuiySet::Layout`.
/// Read by render and picking in subsequent sets.
/// Resolved layout output, written by `BuiyLayoutStep::WriteResolvedLayout`.
/// Read by render, picking, and any other downstream subsystem.
#[derive(Component, Reflect, Default, Clone, Debug)]
#[reflect(Component)]
pub struct ResolvedLayout {
Expand All @@ -60,3 +27,27 @@ pub struct ResolvedLayout {
/// Size in logical pixels.
pub size: Vec2,
}

/// Visual surface: theme-token references and corner radius for the
/// Phase 0/1 render pipeline. Optional — entities without `Visual` are
/// skipped by the render extract.
///
/// **Temporary home.** This is a Phase 0 carry-over, kept alive in
/// Phase 1 only because the render extract still consumes
/// `background_token` / `border_radius`. The eventual owner of these
/// concerns is `buiy-render-pipeline-design` (unwritten as of Phase 1);
/// when that spec lands, `Visual` is replaced by richer
/// `Background` / `Border` / `Stroke` / etc. components.
#[derive(Component, Reflect, Default, Clone, Debug)]
#[reflect(Component)]
pub struct Visual {
/// Theme token for the fill (e.g. `"color.surface.secondary"`).
/// Empty string → render skips the fill (transparent).
pub background_token: String,
/// Theme token for foreground / text color (e.g. `"color.text.primary"`).
/// Reserved for the text-rendering integration; Phase 1 render does
/// not consume it.
pub foreground_token: String,
/// Uniform corner radius in logical pixels.
pub border_radius: f32,
}
195 changes: 0 additions & 195 deletions crates/buiy_core/src/layout.rs

This file was deleted.

Loading
Loading