Enhance SelectionOption component with hover state and caret visibility logic

- Refactored the `SelectionOption` to be a Roact component that tracks hover state.
- Added logic to determine caret visibility based on node properties (parent-only, has children, and selection state).
- Updated background and text transparency based on hover state for improved UX.
- Adjusted event handling for mouse enter, mouse leave, and click actions to accommodate new behavior.
- Modified `SelectionRadio` to pass necessary props to `SelectionOption` for consistent behavior.
This commit is contained in:
Joe 2026-02-01 09:51:48 -06:00
parent 2b2ada219e
commit 6ed96f1f7e
27 changed files with 99 additions and 56 deletions

View file

@ -91,7 +91,13 @@ impl SourcemapCommand {
.build_global()
.unwrap();
write_sourcemap(&session, self.output.as_deref(), filter, self.absolute)?;
write_sourcemap(
&session,
self.output.as_deref(),
filter,
self.absolute,
false,
)?;
if self.watch {
let rt = Runtime::new().unwrap();
@ -102,7 +108,13 @@ impl SourcemapCommand {
cursor = new_cursor;
if patch_set_affects_sourcemap(&session, &patch_set, filter) {
write_sourcemap(&session, self.output.as_deref(), filter, self.absolute)?;
write_sourcemap(
&session,
self.output.as_deref(),
filter,
self.absolute,
false,
)?;
}
}
}
@ -234,6 +246,7 @@ pub(crate) fn write_sourcemap(
output: Option<&Path>,
filter: fn(&InstanceWithMeta) -> bool,
use_absolute_paths: bool,
quiet: bool,
) -> anyhow::Result<()> {
let tree = session.tree();
@ -252,7 +265,9 @@ pub(crate) fn write_sourcemap(
file.write_all(json_output.as_bytes())?;
file.flush()?;
println!("Created sourcemap at {}", output_path.display());
if !quiet {
println!("Created sourcemap at {}", output_path.display());
}
} else {
// Use standard JSON (not JSON5) for sourcemaps - required by external tools like LSPs
let output = serde_json::to_string(&root_node)?;

View file

@ -214,7 +214,14 @@ impl SyncbackCommand {
// Generate sourcemap after successful syncback
let sourcemap_path = base_path.join("sourcemap.json");
write_sourcemap(&session_old, Some(&sourcemap_path), filter_nothing, false)?;
write_sourcemap(
&session_old,
Some(&sourcemap_path),
filter_nothing,
false,
true,
)?;
eprintln!("Generated sourcemap at {}", sourcemap_path.display());
// Refresh git index if in a git repository
refresh_git_index(base_path);