@jarrodmedrano/claude-skills 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/bevy/SKILL.md +406 -0
- package/.claude/skills/bevy/references/bevy_specific_tips.md +385 -0
- package/.claude/skills/bevy/references/common_pitfalls.md +217 -0
- package/.claude/skills/bevy/references/ecs_patterns.md +277 -0
- package/.claude/skills/bevy/references/project_structure.md +116 -0
- package/.claude/skills/bevy/references/ui_development.md +147 -0
- package/.claude/skills/domain-driven-design/SKILL.md +459 -0
- package/.claude/skills/domain-driven-design/references/ddd_foundations_and_patterns.md +664 -0
- package/.claude/skills/domain-driven-design/references/rich_hickey_principles.md +406 -0
- package/.claude/skills/domain-driven-design/references/visualization_examples.md +790 -0
- package/.claude/skills/domain-driven-design/references/wlaschin_patterns.md +639 -0
- package/.claude/skills/godot/SKILL.md +728 -0
- package/.claude/skills/godot/assets/templates/attribute_template.gd +109 -0
- package/.claude/skills/godot/assets/templates/component_template.gd +76 -0
- package/.claude/skills/godot/assets/templates/interaction_template.gd +108 -0
- package/.claude/skills/godot/assets/templates/item_resource.tres +11 -0
- package/.claude/skills/godot/assets/templates/spell_resource.tres +20 -0
- package/.claude/skills/godot/references/architecture-patterns.md +608 -0
- package/.claude/skills/godot/references/common-pitfalls.md +518 -0
- package/.claude/skills/godot/references/file-formats.md +491 -0
- package/.claude/skills/godot/references/godot4-physics-api.md +302 -0
- package/.claude/skills/godot/scripts/validate_tres.py +145 -0
- package/.claude/skills/godot/scripts/validate_tscn.py +170 -0
- package/.claude/skills/react-three-fiber/SKILL.md +2055 -0
- package/.claude/skills/react-three-fiber/scripts/build-scene.ts +171 -0
- package/package.json +1 -1
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# Bevy ECS Patterns Reference
|
|
2
|
+
|
|
3
|
+
## Component Design Patterns
|
|
4
|
+
|
|
5
|
+
### Component Types
|
|
6
|
+
|
|
7
|
+
**1. Data Components**
|
|
8
|
+
Store game state, always derive `Component`:
|
|
9
|
+
```rust
|
|
10
|
+
#[derive(Component, Clone, Debug)]
|
|
11
|
+
pub struct BigFive {
|
|
12
|
+
pub openness: f32,
|
|
13
|
+
pub conscientiousness: f32,
|
|
14
|
+
pub extraversion: f32,
|
|
15
|
+
pub agreeableness: f32,
|
|
16
|
+
pub neuroticism: f32,
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**2. Marker Components**
|
|
21
|
+
Used for queries and categorization:
|
|
22
|
+
```rust
|
|
23
|
+
#[derive(Component)]
|
|
24
|
+
pub struct Player;
|
|
25
|
+
|
|
26
|
+
#[derive(Component)]
|
|
27
|
+
pub struct NPC;
|
|
28
|
+
|
|
29
|
+
#[derive(Component)]
|
|
30
|
+
pub struct Burning; // Marker: entity is on fire
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**3. Tag Components**
|
|
34
|
+
Temporary state or UI markers:
|
|
35
|
+
```rust
|
|
36
|
+
#[derive(Component)]
|
|
37
|
+
pub struct HoveredEntity;
|
|
38
|
+
|
|
39
|
+
#[derive(Component)]
|
|
40
|
+
pub struct InspectedEntity;
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Component Best Practices
|
|
44
|
+
|
|
45
|
+
**✅ DO:**
|
|
46
|
+
- Keep components focused on single responsibility
|
|
47
|
+
- Use `Option<T>` for components that may not always be present
|
|
48
|
+
- Derive `Clone` for components that need to be copied
|
|
49
|
+
- Add helper methods via `impl` blocks
|
|
50
|
+
- Use archetypal patterns for common configurations
|
|
51
|
+
|
|
52
|
+
```rust
|
|
53
|
+
impl BigFive {
|
|
54
|
+
pub fn temperature(&self) -> f32 {
|
|
55
|
+
self.extraversion * 500.0 + 20.0
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
pub fn fire() -> Self {
|
|
59
|
+
Self {
|
|
60
|
+
openness: 0.8,
|
|
61
|
+
conscientiousness: -0.7,
|
|
62
|
+
extraversion: 0.9,
|
|
63
|
+
agreeableness: -0.5,
|
|
64
|
+
neuroticism: 0.7,
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**❌ DON'T:**
|
|
71
|
+
- Put logic in components
|
|
72
|
+
- Store references to other entities directly (use `Entity` IDs)
|
|
73
|
+
- Create deeply nested component hierarchies
|
|
74
|
+
- Use components as function parameters
|
|
75
|
+
|
|
76
|
+
## Query Patterns
|
|
77
|
+
|
|
78
|
+
**1. Basic Query**
|
|
79
|
+
```rust
|
|
80
|
+
fn system(query: Query<&ComponentA>) {
|
|
81
|
+
for component in query.iter() {
|
|
82
|
+
// Process each entity
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**2. Multi-Component Query**
|
|
88
|
+
```rust
|
|
89
|
+
fn system(query: Query<(&ComponentA, &ComponentB, &mut ComponentC)>) {
|
|
90
|
+
for (a, b, mut c) in query.iter_mut() {
|
|
91
|
+
// Read a, b; mutate c
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**3. Optional Components**
|
|
97
|
+
```rust
|
|
98
|
+
fn system(query: Query<(&Name, Option<&BigFive>)>) {
|
|
99
|
+
for (name, maybe_traits) in query.iter() {
|
|
100
|
+
if let Some(traits) = maybe_traits {
|
|
101
|
+
// Has BigFive
|
|
102
|
+
} else {
|
|
103
|
+
// Doesn't have BigFive
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**4. Filtered Query**
|
|
110
|
+
```rust
|
|
111
|
+
fn system(
|
|
112
|
+
query: Query<(&BigFive, &Name), (With<Player>, Without<NPC>)>
|
|
113
|
+
) {
|
|
114
|
+
// Only entities that have Player and don't have NPC
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**5. Multiple Mutable Access**
|
|
119
|
+
```rust
|
|
120
|
+
fn system(
|
|
121
|
+
mut query: Query<&mut BigFive>,
|
|
122
|
+
events: EventReader<CastSpellEvent>,
|
|
123
|
+
) {
|
|
124
|
+
for event in events.read() {
|
|
125
|
+
if let Ok([mut source, mut target]) =
|
|
126
|
+
query.get_many_mut([event.source, event.target])
|
|
127
|
+
{
|
|
128
|
+
// Can mutate both at once
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Common Design Patterns
|
|
135
|
+
|
|
136
|
+
### Derivation Pattern
|
|
137
|
+
|
|
138
|
+
**Problem:** Some properties should be calculated from others.
|
|
139
|
+
|
|
140
|
+
**Solution:**
|
|
141
|
+
```rust
|
|
142
|
+
// Source of truth
|
|
143
|
+
#[derive(Component)]
|
|
144
|
+
pub struct BigFive {
|
|
145
|
+
pub extraversion: f32,
|
|
146
|
+
// ...
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
impl BigFive {
|
|
150
|
+
pub fn temperature(&self) -> f32 {
|
|
151
|
+
self.extraversion * 500.0 + 20.0
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// Cached derived value
|
|
156
|
+
#[derive(Component)]
|
|
157
|
+
pub struct Temperature {
|
|
158
|
+
pub degrees: f32,
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// System to sync
|
|
162
|
+
pub fn derive_temperature(
|
|
163
|
+
mut query: Query<(&BigFive, &mut Temperature), Changed<BigFive>>,
|
|
164
|
+
) {
|
|
165
|
+
for (traits, mut temp) in query.iter_mut() {
|
|
166
|
+
temp.degrees = traits.temperature();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### State Machine Pattern
|
|
172
|
+
|
|
173
|
+
**Problem:** Entities need to change behavior based on state.
|
|
174
|
+
|
|
175
|
+
**Solution:**
|
|
176
|
+
```rust
|
|
177
|
+
#[derive(Component)]
|
|
178
|
+
pub enum NPCState {
|
|
179
|
+
Idle,
|
|
180
|
+
Patrolling,
|
|
181
|
+
Investigating,
|
|
182
|
+
Attacking,
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
pub fn npc_behavior(
|
|
186
|
+
mut query: Query<(&mut Transform, &NPCState)>,
|
|
187
|
+
) {
|
|
188
|
+
for (mut transform, state) in query.iter_mut() {
|
|
189
|
+
match state {
|
|
190
|
+
NPCState::Idle => { /* ... */ }
|
|
191
|
+
NPCState::Patrolling => { /* ... */ }
|
|
192
|
+
NPCState::Investigating => { /* ... */ }
|
|
193
|
+
NPCState::Attacking => { /* ... */ }
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Threshold/Trigger Pattern
|
|
200
|
+
|
|
201
|
+
**Problem:** Need to detect when values cross boundaries.
|
|
202
|
+
|
|
203
|
+
**Solution:**
|
|
204
|
+
```rust
|
|
205
|
+
pub fn check_thresholds(
|
|
206
|
+
mut query: Query<(Entity, &BigFive, &Name), Changed<BigFive>>,
|
|
207
|
+
mut commands: Commands,
|
|
208
|
+
) {
|
|
209
|
+
for (entity, traits, name) in query.iter() {
|
|
210
|
+
// Check threshold
|
|
211
|
+
if traits.extraversion > 0.6 {
|
|
212
|
+
commands.entity(entity).insert(Burning {
|
|
213
|
+
intensity: traits.extraversion,
|
|
214
|
+
});
|
|
215
|
+
println!("{} IGNITES!", name);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Remove if below threshold
|
|
219
|
+
if traits.extraversion <= 0.6 {
|
|
220
|
+
commands.entity(entity).remove::<Burning>();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Event-Driven Pattern
|
|
227
|
+
|
|
228
|
+
**Problem:** Systems need to communicate without tight coupling.
|
|
229
|
+
|
|
230
|
+
**Solution:**
|
|
231
|
+
```rust
|
|
232
|
+
// Define event
|
|
233
|
+
#[derive(Event)]
|
|
234
|
+
pub struct SpellCastEvent {
|
|
235
|
+
pub caster: Entity,
|
|
236
|
+
pub target: Entity,
|
|
237
|
+
pub spell_type: SpellType,
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Writer system
|
|
241
|
+
pub fn cast_spell(
|
|
242
|
+
input: Res<ButtonInput<KeyCode>>,
|
|
243
|
+
mut events: EventWriter<SpellCastEvent>,
|
|
244
|
+
) {
|
|
245
|
+
if input.just_pressed(KeyCode::Space) {
|
|
246
|
+
events.send(SpellCastEvent { /* ... */ });
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Reader system
|
|
251
|
+
pub fn process_spells(
|
|
252
|
+
mut events: EventReader<SpellCastEvent>,
|
|
253
|
+
mut query: Query<&mut BigFive>,
|
|
254
|
+
) {
|
|
255
|
+
for event in events.read() {
|
|
256
|
+
// Process spell
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Initialization Pattern
|
|
262
|
+
|
|
263
|
+
**Pattern: Initialize derived components**
|
|
264
|
+
```rust
|
|
265
|
+
// Entities spawned with BigFive but missing Temperature/Mass
|
|
266
|
+
pub fn initialize_derived_physics(
|
|
267
|
+
mut commands: Commands,
|
|
268
|
+
query: Query<(Entity, &BigFive), (Without<Temperature>, Without<Mass>)>,
|
|
269
|
+
) {
|
|
270
|
+
for (entity, traits) in query.iter() {
|
|
271
|
+
commands.entity(entity).insert((
|
|
272
|
+
Temperature { degrees: traits.temperature() },
|
|
273
|
+
Mass { kilograms: traits.mass() },
|
|
274
|
+
));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
```
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Bevy Project Structure Reference
|
|
2
|
+
|
|
3
|
+
## Standard Bevy Layout
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
src/
|
|
7
|
+
├── main.rs # App setup, plugin registration, system scheduling
|
|
8
|
+
├── components/
|
|
9
|
+
│ ├── mod.rs
|
|
10
|
+
│ ├── properties.rs # Core data components
|
|
11
|
+
│ ├── effects.rs # State marker components
|
|
12
|
+
│ ├── ui.rs # UI marker components
|
|
13
|
+
│ └── [domain].rs # Domain-specific components
|
|
14
|
+
├── systems/
|
|
15
|
+
│ ├── mod.rs
|
|
16
|
+
│ ├── [feature].rs # Feature systems (one file per major feature)
|
|
17
|
+
│ └── ui/
|
|
18
|
+
│ ├── mod.rs
|
|
19
|
+
│ └── [ui_feature].rs
|
|
20
|
+
├── events.rs # Game events and messages
|
|
21
|
+
└── resources.rs # Global resources
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Key Principles
|
|
25
|
+
|
|
26
|
+
**1. Separation of Concerns**
|
|
27
|
+
- **Components** = Pure data, no logic
|
|
28
|
+
- **Systems** = Pure logic, operate on components
|
|
29
|
+
- **Events** = Communication between systems
|
|
30
|
+
- **Resources** = Global state (use sparingly)
|
|
31
|
+
|
|
32
|
+
**2. Module Organization**
|
|
33
|
+
```rust
|
|
34
|
+
// Good: Grouped by feature
|
|
35
|
+
src/systems/personality_physics.rs
|
|
36
|
+
src/systems/thresholds.rs
|
|
37
|
+
src/systems/spells.rs
|
|
38
|
+
|
|
39
|
+
// Bad: Grouped by system type
|
|
40
|
+
src/systems/update_systems.rs
|
|
41
|
+
src/systems/query_systems.rs
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**3. Component Files**
|
|
45
|
+
Keep related components together:
|
|
46
|
+
```rust
|
|
47
|
+
// src/components/effects.rs
|
|
48
|
+
#[derive(Component)]
|
|
49
|
+
pub struct Burning { pub intensity: f32 }
|
|
50
|
+
|
|
51
|
+
#[derive(Component)]
|
|
52
|
+
pub struct Frozen;
|
|
53
|
+
|
|
54
|
+
#[derive(Component)]
|
|
55
|
+
pub struct Dissolving { pub progress: f32 }
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## System Ordering
|
|
59
|
+
|
|
60
|
+
Systems run in the order they're added. Use comments to make dependencies clear:
|
|
61
|
+
|
|
62
|
+
```rust
|
|
63
|
+
.add_systems(
|
|
64
|
+
Update,
|
|
65
|
+
(
|
|
66
|
+
// Input processing
|
|
67
|
+
spell_input,
|
|
68
|
+
|
|
69
|
+
// State changes (modifies data)
|
|
70
|
+
process_spell_casts,
|
|
71
|
+
|
|
72
|
+
// Derive properties from state
|
|
73
|
+
derive_physics_from_personality,
|
|
74
|
+
|
|
75
|
+
// Check for threshold crossings
|
|
76
|
+
threshold_reactions,
|
|
77
|
+
|
|
78
|
+
// Visual updates (reads state, updates rendering)
|
|
79
|
+
visual_threshold_effects,
|
|
80
|
+
update_temperature_visuals,
|
|
81
|
+
|
|
82
|
+
// UI updates (must run last)
|
|
83
|
+
update_inspect_display,
|
|
84
|
+
update_hover_tooltip,
|
|
85
|
+
),
|
|
86
|
+
)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Change Detection
|
|
90
|
+
|
|
91
|
+
Use `Changed<T>` to avoid unnecessary processing:
|
|
92
|
+
|
|
93
|
+
```rust
|
|
94
|
+
// ✅ GOOD: Only process when BigFive changes
|
|
95
|
+
pub fn threshold_reactions(
|
|
96
|
+
mut query: Query<(Entity, &BigFive, &Name), Changed<BigFive>>,
|
|
97
|
+
mut commands: Commands,
|
|
98
|
+
) {
|
|
99
|
+
for (entity, traits, name) in query.iter() {
|
|
100
|
+
if traits.extraversion > 0.6 {
|
|
101
|
+
commands.entity(entity).insert(Burning {
|
|
102
|
+
intensity: traits.extraversion,
|
|
103
|
+
});
|
|
104
|
+
println!("{} IGNITES!", name);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// ❌ BAD: Runs every frame for all entities
|
|
110
|
+
pub fn threshold_reactions(
|
|
111
|
+
mut query: Query<(Entity, &BigFive, &Name)>,
|
|
112
|
+
mut commands: Commands,
|
|
113
|
+
) {
|
|
114
|
+
// Wasteful!
|
|
115
|
+
}
|
|
116
|
+
```
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Bevy UI Development Reference
|
|
2
|
+
|
|
3
|
+
## Bevy UI Hierarchy
|
|
4
|
+
|
|
5
|
+
Bevy UI uses a flexbox-like layout system:
|
|
6
|
+
|
|
7
|
+
```rust
|
|
8
|
+
commands
|
|
9
|
+
.spawn((
|
|
10
|
+
Node {
|
|
11
|
+
position_type: PositionType::Absolute,
|
|
12
|
+
left: Val::Px(10.0),
|
|
13
|
+
top: Val::Px(10.0),
|
|
14
|
+
width: Val::Px(300.0),
|
|
15
|
+
padding: UiRect::all(Val::Px(10.0)),
|
|
16
|
+
flex_direction: FlexDirection::Column,
|
|
17
|
+
..default()
|
|
18
|
+
},
|
|
19
|
+
BackgroundColor(Color::srgba(0.1, 0.1, 0.1, 0.9)),
|
|
20
|
+
))
|
|
21
|
+
.with_children(|parent| {
|
|
22
|
+
parent.spawn((
|
|
23
|
+
Text::new("Title"),
|
|
24
|
+
TextFont { font_size: 16.0, ..default() },
|
|
25
|
+
TextColor(Color::WHITE),
|
|
26
|
+
));
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## UI Component Pattern
|
|
31
|
+
|
|
32
|
+
**1. Marker Components for UI Elements**
|
|
33
|
+
```rust
|
|
34
|
+
#[derive(Component)]
|
|
35
|
+
pub struct SpellBar;
|
|
36
|
+
|
|
37
|
+
#[derive(Component)]
|
|
38
|
+
pub struct HoverTooltip;
|
|
39
|
+
|
|
40
|
+
#[derive(Component)]
|
|
41
|
+
pub struct InspectPanel;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**2. Setup System (Startup)**
|
|
45
|
+
```rust
|
|
46
|
+
pub fn setup_ui(mut commands: Commands) {
|
|
47
|
+
commands.spawn((
|
|
48
|
+
SpellBar,
|
|
49
|
+
Node { /* layout */ },
|
|
50
|
+
BackgroundColor(/* color */),
|
|
51
|
+
))
|
|
52
|
+
.with_children(|parent| {
|
|
53
|
+
// Child elements
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**3. Update System (Update)**
|
|
59
|
+
```rust
|
|
60
|
+
pub fn update_ui(
|
|
61
|
+
state: Res<GameState>,
|
|
62
|
+
mut query: Query<&mut Text, With<SpellBar>>,
|
|
63
|
+
) {
|
|
64
|
+
for mut text in query.iter_mut() {
|
|
65
|
+
**text = format!("State: {:?}", state);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## UI Best Practices
|
|
71
|
+
|
|
72
|
+
### Layout Tips
|
|
73
|
+
|
|
74
|
+
- Use `Val::Px()` for fixed sizes
|
|
75
|
+
- Use `Val::Percent()` for responsive layouts
|
|
76
|
+
- Use `flex_direction: FlexDirection::Column` for vertical stacking
|
|
77
|
+
- Use `flex_direction: FlexDirection::Row` for horizontal stacking
|
|
78
|
+
- Use `justify_content` and `align_items` for alignment
|
|
79
|
+
|
|
80
|
+
### Positioning
|
|
81
|
+
|
|
82
|
+
**Absolute positioning (HUD elements):**
|
|
83
|
+
```rust
|
|
84
|
+
Node {
|
|
85
|
+
position_type: PositionType::Absolute,
|
|
86
|
+
left: Val::Px(10.0),
|
|
87
|
+
top: Val::Px(10.0),
|
|
88
|
+
..default()
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Centered element:**
|
|
93
|
+
```rust
|
|
94
|
+
Node {
|
|
95
|
+
position_type: PositionType::Absolute,
|
|
96
|
+
left: Val::Percent(50.0),
|
|
97
|
+
top: Val::Percent(50.0),
|
|
98
|
+
margin: UiRect {
|
|
99
|
+
left: Val::Px(-150.0), // Half of width
|
|
100
|
+
top: Val::Px(-100.0), // Half of height
|
|
101
|
+
..default()
|
|
102
|
+
},
|
|
103
|
+
width: Val::Px(300.0),
|
|
104
|
+
height: Val::Px(200.0),
|
|
105
|
+
..default()
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Visibility Control
|
|
110
|
+
|
|
111
|
+
```rust
|
|
112
|
+
// Show/hide with Display
|
|
113
|
+
mut node: Query<&mut Node, With<Panel>>
|
|
114
|
+
|
|
115
|
+
// Hide
|
|
116
|
+
node.display = Display::None;
|
|
117
|
+
|
|
118
|
+
// Show
|
|
119
|
+
node.display = Display::Flex;
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Color and Styling
|
|
123
|
+
|
|
124
|
+
```rust
|
|
125
|
+
// Background
|
|
126
|
+
BackgroundColor(Color::srgba(0.1, 0.1, 0.1, 0.9))
|
|
127
|
+
|
|
128
|
+
// Border
|
|
129
|
+
BorderColor::all(Color::srgba(0.3, 0.6, 0.9, 1.0))
|
|
130
|
+
|
|
131
|
+
// Highlight on selection
|
|
132
|
+
*bg_color = BackgroundColor(Color::srgba(0.2, 0.4, 0.6, 1.0));
|
|
133
|
+
*border_color = BorderColor::all(Color::srgba(0.3, 0.6, 0.9, 1.0));
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Text Updates
|
|
137
|
+
|
|
138
|
+
```rust
|
|
139
|
+
// Update text content
|
|
140
|
+
**text = "New content".to_string();
|
|
141
|
+
|
|
142
|
+
// Or with formatting
|
|
143
|
+
**text = format!("Value: {:.2}", value);
|
|
144
|
+
|
|
145
|
+
// Multi-line text
|
|
146
|
+
**text = "Line 1\nLine 2\nLine 3".to_string();
|
|
147
|
+
```
|