Skip to content

Commit 1aa8716

Browse files
committed
add stripe, start changelog, clean
1 parent 5176ee9 commit 1aa8716

21 files changed

+589
-285
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@ the format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
44

55
## unreleased
66

7+
### changed
8+
9+
- [jonmo](https://github.com/databasedav/jonmo) is now the default signals backend for haalka, the deprecated futures-signals backend is still available via feature flags
10+
- to migrate seamlessly:
11+
- update your haalka installation by disabling default features and adding the appropriate futures-signals feature, likely either `futures_signals_ui` or `futures_signals_text_input`
12+
- replace `HaalkaPlugin` with `HaalkaFuturesSignalsPlugin`
13+
- replace your haalka imports with `haalka::futures_signals`, e.g. `use haalka::prelude::*` should become `use haalka::futures_signals::prelude::*`
14+
- once your application is functional again with the bevy 0.16 to 0.17 changes, re-add `HaalkaPlugin` and migrate your application logic to jonmo signals, which are semantically identical to futures-signals but use ECS components and systems as data sources; for example, all of your `Mutable`s will become `Component`s or `Resource`s; see the examples' diffs for reference migrations and feel free to ask questions in the [discord](https://discord.com/channels/691052431525675048/1343672205233360999)
15+
- remove the futures-signals features and re-enable default features if desired
16+
- component and system based alignment management instead of baking it into alignable structs at compile time, high level API unchanged, see `align.rs`
17+
- `NodeBuilder` and `RawHaalkaEl` consolidated into jonmo's `JonmoBuilder`, `.update_raw_el` becomes `.with_builder`
18+
- `PointerEventAware`, `CursorOnHover`, and `UiRootable` methods no longer insert `Pickable::default()` into the element, it must now be managed by the user
19+
20+
21+
### added
22+
23+
- warnings that cloning base element structs is a bug
24+
25+
### removed
26+
27+
- `impl_haalka_methods!` call for `Button` node type
28+
729
# 0.5.1 (2025-07-05)
830

931
### fixed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,11 @@ All examples are compiled to wasm for both webgl2 and webgpu (check [compatibili
133133

134134
- [**`button`**](https://github.com/databasedav/haalka/blob/main/examples/button.rs) [webgl2](https://databasedav.github.io/haalka/examples/webgl2/button/) [webgpu](https://databasedav.github.io/haalka/examples/webgpu/button/)
135135

136-
a basic button, port of <https://github.com/bevyengine/bevy/blob/main/examples/ui/button.rs>
136+
a basic button, port of <https://github.com/bevyengine/bevy/blob/b176e1888c04b6c37035b85c115ad3a1266c22dd/examples/ui/button.rs>
137137

138138
- [**`align`**](https://github.com/databasedav/haalka/blob/main/examples/align.rs) [webgl2](https://databasedav.github.io/haalka/examples/webgl2/align/) [webgpu](https://databasedav.github.io/haalka/examples/webgpu/align/)
139139

140-
alignment API demo, port of <https://github.com/MoonZoon/MoonZoon/tree/main/examples/align> and <https://github.com/MoonZoon/MoonZoon/tree/main/examples/align_content>
140+
alignment API demo, port of <https://github.com/MoonZoon/MoonZoon/tree/19c6cf6b4d07cd27bee7758977ef1ea4d5b9933d/examples/align> and <https://github.com/MoonZoon/MoonZoon/tree/19c6cf6b4d07cd27bee7758977ef1ea4d5b9933d/examples/align_content>
141141

142142
- [**`scroll`**](https://github.com/databasedav/haalka/blob/main/examples/scroll.rs) [webgl2](https://databasedav.github.io/haalka/examples/webgl2/scroll/) [webgpu](https://databasedav.github.io/haalka/examples/webgpu/scroll/)
143143

examples/button.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
//! Simple button, port of <https://github.com/bevyengine/bevy/blob/main/examples/ui/button.rs>.
22
33
mod utils;
4-
use bevy_ui::Pressed;
54
use utils::*;
65

7-
use bevy::prelude::*;
6+
use bevy::{prelude::*, ui::Pressed};
87
use haalka::prelude::*;
98

109
fn main() {

examples/character_editor.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
//! - On the top of the UI is a text field for the character name.
99
1010
mod utils;
11-
use bevy_input_focus::InputFocus;
12-
use bevy_ui::Pressed;
13-
use bevy_ui_text_input::{TextInputMode, TextInputPrompt};
1411
use utils::*;
1512

16-
use bevy::prelude::*;
13+
use bevy::{input_focus::InputFocus, prelude::*, ui::Pressed};
14+
use bevy_ui_text_input::{TextInputMode, TextInputPrompt};
1715
use haalka::prelude::*;
1816
use strum::{self, IntoEnumIterator};
1917

examples/dragging.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
//! Dragging with z-index stacking
22
33
mod utils;
4-
use bevy_ui::Pressed;
54
use utils::*;
65

7-
use bevy::prelude::*;
6+
use bevy::{prelude::*, ui::Pressed};
87
use haalka::prelude::*;
98

109
fn main() {

examples/key_values_sorted.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
//! (yes i take requests)
55
66
mod utils;
7-
use bevy_input_focus::InputFocus;
87
use bevy_ui_text_input::{TextInputContents, TextInputMode};
98
use utils::*;
109

1110
use std::{cmp::Ordering, collections::HashMap};
1211

13-
use bevy::prelude::*;
12+
use bevy::{input_focus::InputFocus, prelude::*};
1413
use haalka::{
1514
prelude::*,
1615
viewport_mutable::{LogicalRect, MutableViewport},

examples/main_menu.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
//! - Keyboard/Controller: Separate styles for currently focused element.
88
99
mod utils;
10-
use bevy_ui::Pressed;
1110
use haalka::impl_haalka_methods;
1211
use utils::*;
1312

14-
use bevy::prelude::*;
13+
use bevy::{prelude::*, ui::Pressed};
1514
use haalka::prelude::*;
1615
use strum::{Display, EnumIter, IntoEnumIterator};
1716

examples/many_buttons.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
//! Experimental port of <https://github.com/aevyrie/bevy_mod_picking/blob/main/examples/many_buttons.rs>.
22
33
mod utils;
4-
use bevy_ui::Pressed;
5-
use jonmo::builder::JonmoBuilder;
64
use utils::*;
75

8-
use bevy::{diagnostic::LogDiagnosticsPlugin, prelude::*};
6+
use bevy::{diagnostic::LogDiagnosticsPlugin, prelude::*, ui::Pressed};
97
use haalka::prelude::*;
108

119
fn main() {

examples/nested_lists.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
//! Nested dynamic lists, arbitrarily deeply nested retained reactivity, spurred by <https://discord.com/channels/691052431525675048/885021580353237032/1356769984474517617>
22
33
mod utils;
4-
use bevy_color::palettes::css::DARK_GRAY;
5-
use bevy_ui::Overflow;
64
use utils::*;
75

8-
use bevy::prelude::*;
6+
use bevy::{color::palettes::css::DARK_GRAY, prelude::*, ui::Overflow};
97
use haalka::prelude::*;
108

119
fn main() {

examples/responsive_menu.rs

Lines changed: 48 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55
//! buttons.
66
77
mod utils;
8-
use bevy_ui::{Pressed, widget::NodeImageMode};
98
use utils::*;
109

1110
use std::sync::OnceLock;
1211

13-
use bevy::{prelude::*, window::WindowResized};
12+
use bevy::{
13+
prelude::*,
14+
ui::{Pressed, widget::NodeImageMode},
15+
window::WindowResized,
16+
};
1417
use haalka::prelude::*;
1518

1619
fn main() {
@@ -111,67 +114,58 @@ fn nine_slice_button() -> impl Element {
111114
.cursor(CursorIcon::System(SystemCursorIcon::Pointer))
112115
}
113116

114-
fn horizontal() -> impl Element {
115-
Row::<Node>::new()
116-
.with_node(|mut node| {
117-
node.width = Val::Percent(100.);
118-
node.height = Val::Percent(100.);
119-
node.column_gap = Val::Px(GAP);
120-
})
121-
.item(
122-
Column::<Node>::new()
123-
.with_node(|mut node| {
124-
node.width = Val::Percent(50.);
125-
node.height = Val::Percent(100.);
126-
node.row_gap = Val::Px(GAP);
127-
})
128-
.align_content(Align::center())
129-
.items((0..8).map(|_| nine_slice_button())),
130-
)
131-
.item(El::<ImageNode>::new().image_node(ImageNode::new(image().clone())))
132-
}
133-
134-
fn vertical() -> impl Element {
135-
Column::<Node>::new()
136-
.with_node(|mut node| {
137-
node.width = Val::Percent(100.);
138-
node.height = Val::Percent(100.);
139-
node.row_gap = Val::Px(GAP);
140-
})
141-
.item(El::<ImageNode>::new().image_node(ImageNode::new(image().clone())))
142-
.item(
143-
Row::<Node>::new()
144-
.multiline()
145-
.align_content(Align::center())
146-
.with_node(|mut node| {
147-
node.width = Val::Percent(100.);
148-
node.height = Val::Percent(50.);
149-
node.column_gap = Val::Px(GAP);
150-
})
151-
.items((0..8).map(|_| nine_slice_button())),
152-
)
153-
}
154-
155117
fn menu() -> impl Element {
156-
let width = SignalBuilder::from_resource::<Width>().map_in(deref_copied);
118+
let width = SignalBuilder::from_resource::<Width>().dedupe().map_in(deref_copied);
119+
let is_wide = width.clone().map_in(|width| width > 400.).dedupe();
120+
let image_el = || El::<ImageNode>::new().image_node(ImageNode::new(image().clone()));
157121
nine_slice_el(SignalBuilder::always(3))
158122
.with_node(|mut node| {
159123
node.height = Val::Px(BASE_SIZE);
160124
node.padding = UiRect::all(Val::Px(GAP));
161125
})
162126
.on_signal_with_node(
163-
width
164-
.clone()
165-
.map_in(|width| BASE_SIZE.min(width))
166-
.dedupe()
167-
.map_in(Val::Px),
127+
width.map_in(|width| BASE_SIZE.min(width)).dedupe().map_in(Val::Px),
168128
|mut node, width| node.width = width,
169129
)
170-
.child_signal(
171-
width
172-
.map_in(|width| width > 400.)
173-
.dedupe()
174-
.map_bool_in(|| horizontal().type_erase(), || vertical().type_erase()),
130+
.child(
131+
Stripe::<Node>::new()
132+
.direction_signal(
133+
is_wide
134+
.clone()
135+
.map_bool_in(|| stripe::Direction::Row, || stripe::Direction::Column),
136+
)
137+
.with_node(|mut node| {
138+
node.width = Val::Percent(100.);
139+
node.height = Val::Percent(100.);
140+
node.column_gap = Val::Px(GAP);
141+
node.row_gap = Val::Px(GAP);
142+
})
143+
.item_signal(is_wide.clone().not().map_true_in(image_el))
144+
.item(
145+
Stripe::<Node>::new()
146+
.direction_signal(
147+
is_wide
148+
.clone()
149+
.map_bool_in(|| stripe::Direction::Column, || stripe::Direction::Row),
150+
)
151+
.multiline_row_signal(is_wide.clone().not())
152+
.align_content(Align::center())
153+
.on_signal_with_node(is_wide.clone().dedupe(), |mut node, wide| {
154+
if wide {
155+
node.width = Val::Percent(50.);
156+
node.height = Val::Percent(100.);
157+
node.row_gap = Val::Px(GAP);
158+
node.column_gap = Val::Px(0.);
159+
} else {
160+
node.width = Val::Percent(100.);
161+
node.height = Val::Percent(50.);
162+
node.column_gap = Val::Px(GAP);
163+
node.row_gap = Val::Px(0.);
164+
}
165+
})
166+
.items((0..8).map(|_| nine_slice_button())),
167+
)
168+
.item_signal(is_wide.clone().map_true_in(image_el)),
175169
)
176170
}
177171

0 commit comments

Comments
 (0)