feat: continue tree rust family cutover

- add rust renderer/state-family scaffolds and inline compat host thinning for page tree, file tree, and picker
- route tree/filetree preflight, file projection, resource artifact, and stream delta contracts through rust plans
- preserve canonical move-order validation, file-tree search projection, and related frontend/runtime regression coverage
This commit is contained in:
lix-2026
2026-04-26 19:35:52 +08:00
parent 338bb2e20f
commit e564dfde02
93 changed files with 17492 additions and 1856 deletions
@@ -0,0 +1,78 @@
use std::collections::BTreeSet;
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum TreeShellAction {
Open,
CreateChild,
Rename,
Move,
ContextMenu,
Pick,
AssetOpen,
ResourceCopy,
ResourceMove,
ResourceUpload,
}
#[derive(Debug, Clone, PartialEq, Eq, Default)]
pub struct TreeShellActionRegistry {
pub actions: BTreeSet<TreeShellAction>,
}
impl TreeShellActionRegistry {
pub fn page_tree() -> Self {
Self {
actions: BTreeSet::from([
TreeShellAction::Open,
TreeShellAction::CreateChild,
TreeShellAction::Rename,
TreeShellAction::Move,
TreeShellAction::ContextMenu,
]),
}
}
pub fn file_tree() -> Self {
Self {
actions: BTreeSet::from([
TreeShellAction::Open,
TreeShellAction::ContextMenu,
TreeShellAction::AssetOpen,
TreeShellAction::ResourceCopy,
TreeShellAction::ResourceMove,
TreeShellAction::ResourceUpload,
]),
}
}
pub fn picker() -> Self {
Self {
actions: BTreeSet::from([TreeShellAction::Pick]),
}
}
pub fn allows(&self, action: TreeShellAction) -> bool {
self.actions.contains(&action)
}
}
#[cfg(test)]
mod tests {
use super::{TreeShellAction, TreeShellActionRegistry};
#[test]
fn tree_shell_action_registry_separates_page_filetree_and_picker_actions() {
let page = TreeShellActionRegistry::page_tree();
assert!(page.allows(TreeShellAction::CreateChild));
assert!(!page.allows(TreeShellAction::ResourceUpload));
let filetree = TreeShellActionRegistry::file_tree();
assert!(filetree.allows(TreeShellAction::ResourceMove));
assert!(filetree.allows(TreeShellAction::AssetOpen));
assert!(!filetree.allows(TreeShellAction::Rename));
let picker = TreeShellActionRegistry::picker();
assert!(picker.allows(TreeShellAction::Pick));
assert!(!picker.allows(TreeShellAction::Open));
}
}