feat(block-editor): add functional Visibility ribbon controls

Add the current-state selector, Visibility States dialog and mode/show/hide
controls to the contextual ribbon, using shared icons, tooltips, modal UI
and adaptive flyouts. Disable the controls until a Visibility parameter exists.

Stage state creation, rename, deletion, current-state changes and reordering
until OK. Support copied, show-all and hide-all new states in one undo step,
preserve native graph metadata, and restore current-state identity on undo/redo.

Implement nonsaved BVMODE and display-only reveal during BVSHOW selection.
Cancelling selection leaves saved visibility flags and history unchanged.
Keep the existing command-line state workflows available.

Validation: 6 targeted tests; 277 block, 31 app dock, 35 ribbon and 12 history
checks passed (overlapping filters). All 17 local DWG fixtures passed in-memory
DWG/DXF preservation checks with unchanged original checksums.
This commit is contained in:
Karim Jerbi committed 2026-10-15 15:08:21 +01:00
1 parent 308990e672
commit daa26007f9
24 files changed
+1341 -34

No files matched your search

+9
View File
@@ -797,6 +797,9 @@ impl HistorySnapshot {
.saturating_add(d.named_parameters.as_ref().map_or(0, |(before, after)| {
before.len().saturating_add(after.len()).saturating_mul(128)
}))
.saturating_add(d.visibility_states.as_ref().map_or(0, |(before, after)| {
(before.len() + after.len()).saturating_mul(32)
}))
.saturating_add(d.reference_designations.len().saturating_mul(16))
.saturating_add(d.label.len()),
HistorySnapshot::ObjectVisibility(v) => v
@@ -833,6 +836,11 @@ pub(super) struct ObjectVisibilitySnapshot {
/// cloning the flat entity store.
#[derive(Clone)]
pub(super) struct DeltaSnapshot {
/// Editor current-state indices must follow undo even when two states show identical objects.
pub(super) visibility_states: Option<(
rustc_hash::FxHashMap<Handle, usize>,
rustc_hash::FxHashMap<Handle, usize>,
)>,
pub(super) entities: Vec<(Handle, Option<Arc<EntityType>>, Option<Arc<EntityType>>)>,
pub(super) current_layout_before: String,
pub(super) current_layout_after: String,
@@ -949,6 +957,7 @@ pub(super) struct HistoryState {
}
pub(super) struct PendingHistorySnapshot {
pub(super) visibility_states_before: rustc_hash::FxHashMap<Handle, usize>,
pub(super) label: String,
pub(super) current_layout: String,
pub(super) active_layer: String,